Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Erik Römmelt 5d28bc36e1 node_modules updated, buefy add to lib folder 5 years ago
..
test node_modules updated, buefy add to lib folder 5 years ago
.travis.yml node_modules updated, buefy add to lib folder 5 years ago
CHANGELOG.md node_modules updated, buefy add to lib folder 5 years ago
CONTRIBUTING.md node_modules updated, buefy add to lib folder 5 years ago
LICENSE.md node_modules updated, buefy add to lib folder 5 years ago
README.md node_modules updated, buefy add to lib folder 5 years ago
index.js node_modules updated, buefy add to lib folder 5 years ago
package.json node_modules updated, buefy add to lib folder 5 years ago

README.md

ldap-escape

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.

Installation

npm install --save ldap-escape

Specification

escapes for search filter

Character Escape
* \2A
( \28
) \29
\ \5C
NUL \00

escapes for distinguished names

Character Escape
, \,
\ \\
# \#
+ \+
< \<
> \>
; \;
" \"
= \=
SPC (leading or trailing) \

Template Literal Tag Functions

ldapEscape.filter

Escapes input for use as an LDAP filter.

ldapEscape.dn

Escapes input for use as an LDAP distinguished name.

Examples

Escape a Search Filter

"use strict";

const ldapEscape = require('ldap-escape');

const uid = 1337;

console.log(ldapEscape.filter`uid=${uid}`); // -> '(uid=1337)'

Escape a DN

"use strict";

const ldapEscape = require('ldap-escape');

const cn = 'alice';

console.log(ldapEscape.dn`cn=${cn},dc=test`); // -> 'cn=alice,dc=test'

Testing

npm test

License

See LICENSE.md