Skip to content

PS-9704 [8.4]: Escape RFC 4515 special chars in LDAP filter substitut… - #6120

Draft
VarunNagaraju wants to merge 1 commit into
percona:8.4from
VarunNagaraju:PS-9704-8.4
Draft

PS-9704 [8.4]: Escape RFC 4515 special chars in LDAP filter substitut…#6120
VarunNagaraju wants to merge 1 commit into
percona:8.4from
VarunNagaraju:PS-9704-8.4

Conversation

@VarunNagaraju

Copy link
Copy Markdown
Contributor

…ions

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, and backslash were passed through verbatim, producing malformed filters that silently broke group lookups for users whose DN contained those characters.

Add ldap_filter_escape() which applies the mandatory RFC 4515 §3 \XX hex encoding for LPAREN (\28), RPAREN (\29), ASTERISK (\2a), and ESC (\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 authenticate and receive their group role via the dn_test_group groupOfNames entry.

…ions

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, and backslash were
passed through verbatim, producing malformed filters that silently broke
group lookups for users whose DN contained those characters.

Add ldap_filter_escape() which applies the mandatory RFC 4515 §3 \XX
hex encoding for LPAREN (\28), RPAREN (\29), ASTERISK (\2a), and
ESC (\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 authenticate and receive
their group role via the dn_test_group groupOfNames entry.

@percona-ysorokin percona-ysorokin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

2 participants