Release 1.3.0: adopt shared @simpleworkjs/* packages; fix LDAP filter injection
Rewire onto the shared @simpleworkjs/oidc-client, /ldap, and /app-stack
packages (deleting the byte-identical local forks of the same code), close the
LDAP filter-injection in User.get by routing the username through escapeFilter
(RFC 4515), align model-redis ^1.6.0 and ldapts ^8.1.8, and unify build_info to
{buildVersion, buildHash, buildYear}. package-lock regenerated from the npm
registry (no file:/link:), so npm ci is clean in docker builds.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const { Client, Attribute, Change } = require('ldapts');
|
||||
const {Token} = require('./token');
|
||||
const conf = require('@simpleworkjs/conf').ldap;
|
||||
const { escapeFilter } = require('@simpleworkjs/ldap');
|
||||
|
||||
// tlsOptions is optional and forwarded to ldapts so the proxy can bind to
|
||||
// ldaps:// with a self-signed or internal-CA cert. Set via conf/secrets.js or
|
||||
@@ -107,7 +107,9 @@ User.get = async function(data){
|
||||
|
||||
await client.bind(conf.bindDN, conf.bindPassword);
|
||||
|
||||
let filter = `(&${conf.userFilter}(${conf.userNameAttribute}=${data.username}))`;
|
||||
// Escape the interpolated username (RFC 4515) — previously raw, which
|
||||
// let `*`/`(`/`)`/`\`/NUL in a username break or broaden the filter.
|
||||
let filter = `(&${conf.userFilter}(${conf.userNameAttribute}=${escapeFilter(data.username)}))`;
|
||||
|
||||
const res = await client.search(conf.searchBase, {
|
||||
scope: 'sub',
|
||||
|
||||
Reference in New Issue
Block a user