[MINOR] Apply proper RFC 4515 / RFC 4514 escaping in LDAP realms #5226
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 270 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.335
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5226"
general
weight: 0.35
ParkGyeongTae
What is this PR for?
LdapRealmandActiveDirectoryGroupRealmbuild LDAP search filters and DNs by interpolating user-controlled values into format strings. The existing escape utility inLdapRealmimplements RFC 4514 (Distinguished Name) escaping, which leaves the filter metacharacters(,)andunchanged.ActiveDirectoryGroupRealmusesString.formatwith no escape at all. The two contexts need different rules: filter values follow RFC 4515 § 3 and DN values follow RFC 4514.This PR separates the two escape contexts so each substitution site uses the right one.
What type of PR is it?
Improvement
Todos
[x] Add
LdapFilterEncoder.escapeFilterValueimplementing RFC 4515 § 3 (\\,(,),, NUL).[x] Add
expandFilterTemplatehelper inLdapRealmthat escapes values before substituting into a filter template.[x] Add
expandDnTemplatehelper that uses the existingescapeAttributeValue(RFC 4514) for DN substitutions.[x] Route
LdapRealmfilter substitution sites throughexpandFilterTemplate.[x] Route
LdapRealmDN substitution sites throughexpandDnTemplate.[x] Apply
LdapFilterEncoder.escapeFilterValueat the twoString.formatfilter sites inActiveDirectoryGroupRealm.[x] Wrap admin-configured object class / attribute name values through the same escape utility for defense in depth.
[x] Unit tests for
LdapFilterEncoder(14).[x] 1000-iteration deterministic fuzz test (1005 tests total).
[x] Realm-level injection tests with mocked
LdapContext(20 tests).[x] DN substitution regression tests including Korean username (22 tests).
What is the Jira issue?
N/A —
[MINOR]change.How should this be tested?
All 1068 tests pass locally.
Questions
Does the license files need to update? No
Is there breaking changes for older versions? No
Does this needs documentation? No