Skip to content

PS-9704 [8.0]: Escape all RFC 4515 special chars in LDAP filter substitutions#5928

Open
VarunNagaraju wants to merge 1 commit into
percona:8.0from
VarunNagaraju:PS-9704-8.0
Open

PS-9704 [8.0]: Escape all RFC 4515 special chars in LDAP filter substitutions#5928
VarunNagaraju wants to merge 1 commit into
percona:8.0from
VarunNagaraju:PS-9704-8.0

Conversation

@VarunNagaraju
Copy link
Copy Markdown
Contributor

@VarunNagaraju VarunNagaraju commented Apr 28, 2026

https://perconadev.atlassian.net/browse/PS-9704

User-supplied values (user_name, user_dn) substituted into LDAP search
filters via {UA} and {UD} were not properly escaped. Only double-quote
received a partial treatment; parentheses, asterisk, backslash, and NUL
were passed through verbatim, producing malformed filters that silently
broke group lookups.

Add ldap_filter_escape() which applies the mandatory RFC 4515 \XX
hex encoding for NUL (\00), ( (\28), ) (\29), * (\2a), and \ (\5c).
Apply it to all three substitution sites: search_dn() for user_name,
and search_groups() for both {UA} (user_name) and {UD} (user_dn).
MTR test exercises DN containing a double-quote, parentheses, an
asterisk, and a backslash — all expected to receive their group role.

@VarunNagaraju VarunNagaraju changed the title PS-9704 (8.0) Fix auth_ldap bug with unescaped parentheses in user DN PS-9704 [8.0: Fix auth_ldap bug with unescaped parentheses in user DN May 7, 2026
@VarunNagaraju VarunNagaraju marked this pull request as ready for review May 7, 2026 10:55
@VarunNagaraju VarunNagaraju changed the title PS-9704 [8.0: Fix auth_ldap bug with unescaped parentheses in user DN PS-9704 [8.0]: Escape all RFC 4515 special chars in LDAP filter substitutions May 7, 2026
…itutions

https://perconadev.atlassian.net/browse/PS-9704

User-supplied values (user_name, user_dn) substituted into LDAP search
filters via {UA} and {UD} were not properly escaped.  Only double-quote
received a partial treatment; parentheses, asterisk, backslash, and NUL
were passed through verbatim, producing malformed filters that silently
broke group lookups.

Add ldap_filter_escape() which applies the mandatory RFC 4515 \XX
hex encoding for NUL (\00), ( (\28), ) (\29), * (\2a), and \ (\5c).
Apply it to all three substitution sites: search_dn() for user_name,
and search_groups() for both {UA} (user_name) and {UD} (user_dn).
MTR test exercises DN containing a double-quote, parentheses, an
asterisk, and a backslash — all expected to receive their group role.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant