{"id":17306690,"url":"https://github.com/tcort/ldap-escape","last_synced_at":"2025-04-14T13:35:31.269Z","repository":{"id":2254882,"uuid":"46084001","full_name":"tcort/ldap-escape","owner":"tcort","description":"Escape functions for LDAP filters and distinguished names to prevent LDAP injection attacks.","archived":false,"fork":false,"pushed_at":"2023-01-08T15:14:40.000Z","size":274,"stargazers_count":10,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T02:45:58.096Z","etag":null,"topics":["escape","ldap"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tcort.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-12T22:10:00.000Z","updated_at":"2022-12-28T01:58:57.000Z","dependencies_parsed_at":"2023-01-11T16:08:56.249Z","dependency_job_id":null,"html_url":"https://github.com/tcort/ldap-escape","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fldap-escape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fldap-escape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fldap-escape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fldap-escape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tcort","download_url":"https://codeload.github.com/tcort/ldap-escape/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248889138,"owners_count":21178171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["escape","ldap"],"created_at":"2024-10-15T11:59:06.699Z","updated_at":"2025-04-14T13:35:31.243Z","avatar_url":"https://github.com/tcort.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ldap-escape\n\nTemplate literal tag functions for LDAP filters and distinguished names to prevent [LDAP injection](https://www.owasp.org/index.php/LDAP_injection) attacks.\nUses the escape codes from [Active Directory: Characters to Escape](http://social.technet.microsoft.com/wiki/contents/articles/5312.active-directory-characters-to-escape.aspx).\n\n## Installation\n\n    npm install --save ldap-escape\n\n## Specification\n\n### escapes for search filter\n\n| Character | Escape |\n|-----------|--------|\n| `*`       | `\\2A`  |\n| `(`       | `\\28`  |\n| `)`       | `\\29`  |\n| `\\`       | `\\5C`  |\n| `NUL`     | `\\00`  |\n\n### escapes for distinguished names\n\n| Character                   | Escape |\n|-----------------------------|--------|\n| `,`                         | `\\,`   |\n| `\\`                         | `\\\\`   |\n| `#`                         | `\\#`   |\n| `+`                         | `\\+`   |\n| `\u003c`                         | `\\\u003c`   |\n| `\u003e`                         | `\\\u003e`   |\n| `;`                         | `\\;`   |\n| `\"`                         | `\\\"`   |\n| `=`                         | `\\=`   |\n| `SPC` (leading or trailing) | `\\ `   |\n\n## Template Literal Tag Functions\n\n### ldapEscape.filter\n\nEscapes input for use as an LDAP filter.\n\n### ldapEscape.dn\n\nEscapes input for use as an LDAP distinguished name.\n\n## Examples\n\n### Escape a Search Filter\n\n    \"use strict\";\n\n    const ldapEscape = require('ldap-escape');\n\n    const uid = 1337;\n\n    console.log(ldapEscape.filter`uid=${uid}`); // -\u003e 'uid=1337'\n\n### Escape a DN\n\n    \"use strict\";\n\n    const ldapEscape = require('ldap-escape');\n\n    const cn = 'alice';\n\n    console.log(ldapEscape.dn`cn=${cn},dc=test`); // -\u003e 'cn=alice,dc=test'\n\n## Testing\n\n    npm test\n\n## License\n\nSee [LICENSE.md](https://github.com/tcort/ldap-escape/blob/master/LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcort%2Fldap-escape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftcort%2Fldap-escape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcort%2Fldap-escape/lists"}