KNOX-3417: KnoxLdapRealm builds the LDAP search filter from the clien… - #1348
Merged
Conversation
…t username without RFC-4515 escaping
hanicz
requested review from
bonampak,
lmccay,
moresandeep,
pzampino and
smolnar82
August 13, 2026 08:28
Test Results40 tests 40 ✅ 5s ⏱️ Results for commit 3c1f754. |
smolnar82
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…t username without RFC-4515 escaping
KNOX-3417 - A short description of the change
What changes were proposed in this pull request?
In search-then-bind LDAP mode, Knox dropped the login username straight into an LDAP search filter with no escaping. Typing username
*)(uid=adminturned the intended filter(&(objectclass=person)(uid=<user>))into(&(objectclass=person)(uid=*)(uid=admin)).The fix (
KnoxLdapRealm.java):escapeLdapSearchFilterValue()— RFC 4515 escaping (* ( ) \ NUL → \2a \28 \29 \5c \00).expandTemplate(..., escapeForLdapFilter)overload (escapes the value + Matcher.quoteReplacement), switched on at the two filter sites.*)(uid=adminbecomes inert literaluid=\2a\29\28uid=admin— no longer alters the query.New unit tests
How was this patch tested?
Unit tests, manually tested
Log level to
DEBUGNew topology:
Before:
After:
Before:
After:
Integration Tests
N/A
UI changes
N/A