← Back to Pull requests

[ZEPPELIN-6171] Resolve nested LDAP groups on FreeIPA via memberOf #5505

Closed
unknown closed this pull request without merging on Oct 05, 2026 13:55 UTC
View on GitHub
unknown unknown commented on Sep 26, 2026 14:46 UTC
Author

What is this PR for?

LdapRealm resolves a user's groups in one of two ways today: the Active Directory LDAP_MATCHING_RULE_IN_CHAIN operator, or a group search over the member attribute. Neither works for nested groups on FreeIPA / 389 Directory Server — the AD matching rule isn't supported there, and the plain member search only sees direct members. So if a user is in dev and dev is a member of eng, the user's eng membership (and any role mapped to it) silently disappears.

This adds a third path. When ldapRealm.groupSearchEnableMemberOf = true, the realm reads the user entry's own memberOf attribute instead of walking the group tree. FreeIPA/389 DS already flattens direct and nested membership onto memberOf, so a single lookup of the user entry gives you the full set, nested groups included.

While adding it I split rolesFor() into three small per-strategy methods (matching-rule / group-membership / memberOf) so each path is readable on its own. The two existing paths are moved as-is, no behavior change.

New settings:

# resolve nested groups via the user's memberOf attribute (e.g. FreeIPA / 389 DS)
ldapRealm.groupSearchEnableMemberOf = true
ldapRealm.memberOfAttribute = memberOf

A few decisions worth calling out:

  • Precedence when both are on. If groupSearchEnableMatchingRuleInChain and groupSearchEnableMemberOf are both set, the matching-rule path wins and we log a one-time warning, rather than refusing to start. This keeps existing AD setups behaving exactly as before; the cost is that a contradictory config isn't hard-rejected, just warned.

  • Group name comes from the leaf RDN only. A memberOf value is a full group DN, and we take the group name from its leaf RDN without scanning ancestors. On FreeIPA a container on the path (cn=groups,cn=accounts,...) has the same cn= type as the group itself, so scanning would pick the wrong one. A malformed DN is skipped (and logged) instead of failing the login.

  • No behavior change for the existing paths. The matching-rule branch still doesn't populate the session group-name set the way the default branch does — that's pre-existing and I left it alone on purpose rather than "fixing" it in a refactor.
  • One prerequisite (documented in shiro_authentication.md): memberOf is only returned to an authenticated bind, which Zeppelin already does via systemUsername/systemPassword. Deployments that split groups and members across separate backends may also need server-side memberOf scope configuration.

    What type of PR is it?


    Improvement

    Todos


    [x] memberOf-based group resolution path
    [x] split rolesFor() into per-strategy methods
    [x] unit tests
    [x] docs

    What is the Jira issue?


    ZEPPELIN-6171

    How should this be tested?

    LdapRealmTest (11 tests, mock-based) covers the memberOf path: nested resolution, matching-rule precedence, leaf-RDN fallback, and the empty / missing memberOf cases. The existing tests pass unchanged, which is what pins down that the two old paths still behave the same.

    I also ran it end-to-end against a real 389 Directory Server (FreeIPA's LDAP engine) with a nested setup — alice ∈ dev, and dev ∈ eng:

    # alice's memberOf at the directory level (server-flattened, ground truth)
    $ ldapsearch ... -b 'uid=alice,ou=people,dc=example,dc=com' -s base memberOf
    dn: uid=alice,ou=people,dc=example,dc=com
    memberOf: cn=dev,ou=groups,dc=example,dc=com
    memberOf: cn=eng,ou=groups,dc=example,dc=com
    
    # LdapRealm.rolesFor(alice) against that server, only the new flag differs:
    case A  groupSearchEnableMemberOf=false  ->  [dev]        # nested cn=eng missing
    case B  groupSearchEnableMemberOf=true   ->  [dev, eng]   # nested cn=eng resolved
    

    So the nested group is recovered only with the new flag on.

    Questions:


    Does the license files need to update? No
    Is there breaking changes for older versions? No
  • Does this needs documentation? Yes — docs/setup/security/shiro_authentication.md is updated.
  • Diff: 510 lines (+382 / -128) across 6 files Reviewer: tbonelee Review duration: 12908m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 510 lines diff across 6 files
    0.48
    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.373
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5505"
    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: 47.6% (MEDIUM) · Higher = larger blast radius
    47.6%
    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: 18.8% · Safe to merge
    18.8%