← Back to Pull requests

[MINOR] Apply proper RFC 4515 / RFC 4514 escaping in LDAP realms #5226

Closed
unknown closed this pull request without merging on May 14, 2026 04:54 UTC
View on GitHub
unknown unknown commented on May 06, 2026 10:09 UTC
Author

What is this PR for?

LdapRealm and ActiveDirectoryGroupRealm build LDAP search filters and DNs by interpolating user-controlled values into format strings. The existing escape utility in LdapRealm implements RFC 4514 (Distinguished Name) escaping, which leaves the filter metacharacters (, ) and unchanged. ActiveDirectoryGroupRealm uses String.format with 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.escapeFilterValue implementing RFC 4515 § 3 (\\, (, ), , NUL).
[x] Add expandFilterTemplate helper in LdapRealm that escapes values before substituting into a filter template.
[x] Add expandDnTemplate helper that uses the existing escapeAttributeValue (RFC 4514) for DN substitutions.
[x] Route LdapRealm filter substitution sites through expandFilterTemplate.
[x] Route LdapRealm DN substitution sites through expandDnTemplate.
[x] Apply LdapFilterEncoder.escapeFilterValue at the two String.format filter sites in ActiveDirectoryGroupRealm.
[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?

./mvnw test -pl zeppelin-server \
  -Dtest='LdapFilterEncoderTest,LdapFilterEncoderFuzzTest,LdapRealmFilterInjectionTest,LdapRealmDnInjectionTest,ActiveDirectoryGroupRealmFilterInjectionTest,LdapRealmTest,RoleMappingLdapRealmTest' \
  -DfailIfNoTests=false

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

Diff: 270 lines (+202 / -68) across 3 files Reviewer: ParkGyeongTae Review duration: 11205m
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
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.4% (MEDIUM) · Higher = larger blast radius
39.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.6% · Safe to merge
15.6%