Repository navigation
Fix LDAP group resolution for users with limited admin permissions - #54074
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The shared authorization behavior change warrants human security review and integration-test validation before approval.
0 open findings
What changed in this PR
Fixes #54054 by separating internal LDAP group resolution from administrative permission filtering, preventing login failures for users with limited admin roles.
Changes:
- Removes authorization filtering from group-name lookups and bypasses it during inherited LDAP group resolution and automatic synchronization.
- Adds regression tests for authentication, tokens, cache states, and restricted administrative access.
- Documents callers’ responsibility to enforce administrative permissions.
| File | Description |
|---|---|
| tests/base/src/test/java/org/keycloak/tests/suites/Base2TestSuite.java | Includes federation tests in the suite. |
| tests/base/src/test/java/org/keycloak/tests/federation/ldap/LDAPGroupMapperFgapTest.java | Adds LDAP group-resolution regression tests. |
| tests/base/pom.xml | Adds the embedded LDAP test dependency. |
| server-spi/src/main/java/org/keycloak/storage/group/GroupLookupProvider.java | Clarifies lookup authorization responsibilities. |
| server-spi-private/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java | Documents group-path lookup permission requirements. |
| model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java | Removes administrative filtering from group-name resolution. |
| federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/membership/group/GroupLDAPStorageMapper.java | Bypasses filtering for inherited resolution and automatic synchronization. |
| docs/documentation/upgrading/topics/changes/changes-27_0_0.adoc | Explains the authorization behavior change for extensions. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
pedroigor
left a comment
There was a problem hiding this comment.
@martin-kanis I think the main problem here is that the request is going though FGAP but it should not as we are not in a request to the Admin API.
We should only run FGAP filters when processing requests to the Admin API.
It should be safer to do this and better isolate admin authz checks from other non-admin code paths.
5fb4bd6 to
41a1bd7
Compare
|
@pedroigor Thanks, I tried to implement your suggestion in the second commit. Please let me know what do you think. |
41a1bd7 to
ac38641
Compare
|
@martin-kanis Can you please check the last commit:
|
ac38641 to
614dfd5
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Changes to FGAP authorization boundaries, unfiltered lazy user operations, and session-wide policy-evaluation suppression require maintainer validation of delegated-admin and cross-realm isolation across LDAP, Admin REST, and SCIM.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
|
@pedroigor Your design change makes sense to me. However, there might be two issues that should be considered for fixing:
|
614dfd5 to
e878c1f
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The changed FGAP boundaries and unfiltered user proxies require human review and integration validation of cross-realm authorization isolation, unauthorized list queries, and LDAP cold-cache behavior.
No open issues 🎉
Review effort: Balanced
Closes keycloak#54054 Signed-off-by: Martin Kanis <mkanis@ibm.com>
Closes keycloak#54054 Signed-off-by: Martin Kanis <mkanis@ibm.com>
…lookups Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
e878c1f to
a8acf56
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Changes to FGAP activation across Admin REST and SCIM, including filtering suppression during lazy stream consumption, require human security review and LDAP/SCIM regression testing to validate delegated-admin isolation.
No open issues 🎉
Review effort: Balanced
…kups Backport all three commits from PR keycloak#54074 for keycloak#54054 to release/26.8. Bind automatic FGAP query filtering to the authenticated Admin or SCIM identity. Keep internal role, group and policy lookups unfiltered to avoid LDAP group resolution failures and recursive authorization evaluation. Include LDAP login, token and delegated-admin regression coverage. Adapt the group visibility test to the 26.8 admin client using a local REST proxy while preserving the flat-list assertions. Closes keycloak#54054 (cherry picked from commit 8ae1053) (cherry picked from commit c612179) (cherry picked from commit 244ec89) Signed-off-by: Martin Kanis <mkanis@ibm.com> Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
…kups Backport all three commits from PR keycloak#54074 for keycloak#54054 to release/26.8. Bind automatic FGAP query filtering to the authenticated Admin or SCIM identity. Keep internal role, group and policy lookups unfiltered to avoid LDAP group resolution failures and recursive authorization evaluation. Include LDAP login, token and delegated-admin regression coverage. Adapt the group visibility test to the 26.8 admin client using a local REST proxy while preserving the flat-list assertions. Closes keycloak#54054 (cherry picked from commit 8ae1053) (cherry picked from commit c612179) (cherry picked from commit 244ec89) Signed-off-by: Martin Kanis <mkanis@ibm.com> Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
…kups Backport all three commits from PR keycloak#54074 for keycloak#54054 to release/26.8. Bind automatic FGAP query filtering to the authenticated Admin or SCIM identity. Keep internal role, group and policy lookups unfiltered to avoid LDAP group resolution failures and recursive authorization evaluation. Include LDAP login, token and delegated-admin regression coverage. Adapt the group visibility test to the 26.8 admin client using a local REST proxy while preserving the flat-list assertions. Closes keycloak#54054 (cherry picked from commit 8ae1053) (cherry picked from commit c612179) (cherry picked from commit 244ec89) Signed-off-by: Martin Kanis <mkanis@ibm.com> Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
…kups Backport all three commits from PR keycloak#54074 for keycloak#54054 to release/26.8. Bind automatic FGAP query filtering to the authenticated Admin or SCIM identity. Keep internal role, group and policy lookups unfiltered to avoid LDAP group resolution failures and recursive authorization evaluation. Include LDAP login, token and delegated-admin regression coverage. Adapt the group visibility test to the 26.8 admin client using a local REST proxy while preserving the flat-list assertions. Closes keycloak#54054 (cherry picked from commit 8ae1053) (cherry picked from commit c612179) (cherry picked from commit 244ec89) Signed-off-by: Martin Kanis <mkanis@ibm.com> Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
…kups Backport all three commits from PR keycloak#54074 for keycloak#54054 to release/26.8. Bind automatic FGAP query filtering to the authenticated Admin or SCIM identity. Keep internal role, group and policy lookups unfiltered to avoid LDAP group resolution failures and recursive authorization evaluation. Include LDAP login, token and delegated-admin regression coverage. Adapt the group visibility test to the 26.8 admin client using a local REST proxy while preserving the flat-list assertions. Closes keycloak#54054 (cherry picked from commit 8ae1053) (cherry picked from commit c612179) (cherry picked from commit 244ec89) Signed-off-by: Martin Kanis <mkanis@ibm.com> Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
…kups Backport all three commits from PR #54074 for #54054 to release/26.8. Bind automatic FGAP query filtering to the authenticated Admin or SCIM identity. Keep internal role, group and policy lookups unfiltered to avoid LDAP group resolution failures and recursive authorization evaluation. Include LDAP login, token and delegated-admin regression coverage. Adapt the group visibility test to the 26.8 admin client using a local REST proxy while preserving the flat-list assertions. Closes #54054 (cherry picked from commit 8ae1053) (cherry picked from commit c612179) (cherry picked from commit 244ec89) Signed-off-by: Martin Kanis <mkanis@ibm.com> Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>

Closes #54054
The fix also covers inherited LDAP groups, automatic synchronization of newly discovered groups, and hardcoded group mappers. These paths could cause duplicate-group errors, missing group-derived roles in tokens, or a stack overflow. Regression tests cover login, token issuance and refresh with cold and populated group caches, while verifying that administrative group access remains restricted.