#503 Security hardening: build the LDAP filter without string-replacement patterns
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#503
- issue
- state:closed
**LDAP filter built with `replaceAll` and a string replacement** - **Severity:** Informational (hardening; I found no exploit). - **Location:** `server/ldap.mjs:92`. `config.filter.replaceAll('{username}', escapeFilter(username))` interprets `` $` ``, `$'` and `$&` in the escaped username, splicing pieces of the operator's filter into the value. - **Evidence** (`ldap-test.mjs`): username `` $` `` with the default filter produces `(&(objectClass=user)(sAMAccountName=(&(objectClass=user)(sAMAccountName=))`. ldapts refuses every such variant ("Illegal unescaped character: (" or "Unbalanced parens"), and the bind still needs the matched entry's password. The result is a 502 rather than a bypass. - **Suggested fix:** `replaceAll('{username}', () => escapeFilter(username))`. --- From the security review of 2026-11-06 (commit 6776c44), finding I-2: hardening or information, filed publicly because it describes no way in. The exploitable findings are private security advisories. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/openchronology/timeline-app/issues/503