Erik Römmelt 5d28bc36e1 node_modules updated, buefy add to lib folder | 5 years ago | |
---|---|---|
.. | ||
test | 5 years ago | |
.travis.yml | 5 years ago | |
CHANGELOG.md | 5 years ago | |
CONTRIBUTING.md | 5 years ago | |
LICENSE.md | 5 years ago | |
README.md | 5 years ago | |
index.js | 5 years ago | |
package.json | 5 years ago |
Template literal tag functions for LDAP filters and distinguished names to prevent LDAP injection attacks. Uses the escape codes from Active Directory: Characters to Escape.
npm install --save ldap-escape
Character | Escape |
---|---|
* |
\2A |
( |
\28 |
) |
\29 |
\ |
\5C |
NUL |
\00 |
Character | Escape |
---|---|
, |
\, |
\ |
\\ |
# |
\# |
+ |
\+ |
< |
\< |
> |
\> |
; |
\; |
" |
\" |
= |
\= |
SPC (leading or trailing) |
\ |
Escapes input for use as an LDAP filter.
Escapes input for use as an LDAP distinguished name.
"use strict";
const ldapEscape = require('ldap-escape');
const uid = 1337;
console.log(ldapEscape.filter`uid=${uid}`); // -> '(uid=1337)'
"use strict";
const ldapEscape = require('ldap-escape');
const cn = 'alice';
console.log(ldapEscape.dn`cn=${cn},dc=test`); // -> 'cn=alice,dc=test'
npm test
See LICENSE.md