8000 FGAP v2: allow delegated admins to access users who also belong to groups delegated to other admins (parity with v1) by vramik · Pull Request #55622 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

FGAP v2: allow delegated admins to access users who also belong to groups delegated to other admins (parity with v1) - #55622

Open
vramik wants to merge 1 commit into
keycloak:mainfrom
vramik:54405-group-member-denial
Open

vramik wants to merge 1 commit into
keycloak:mainfrom
vramik:54405-group-member-denial

Conversation

@vramik
@vramik vramik commented Nov 27, 2026 •
Copy link
Copy Markdown
Contributor

Closes #54405

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical partial-evaluation flaws mishandle user-specific denials and unresolved negative UNANIMOUS aggregates, allowing protected users into query and count results despite access denials.

2 open issues
What changed in this PR

This PR brings fine-grained admin permissions v2 closer to v1 by allowing independent delegations to grant access to users shared across groups, while retaining explicit-denial protections.

Changes:

  • Distinguishes unmatched grants from explicit denials across runtime checks, query filtering, and group inheritance.
  • Exposes member-scope decisions through the evaluation API and Admin UI.
  • Adds regression coverage and updates administration and upgrade guidance.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​admin/​authz/​fgap/​UserResourceTypeFilteringTest.java Tests filtering, unsupported policies, and inherited grants.
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​admin/​authz/​fgap/​UserResourceTypeEvaluationTest.java Tests shared-user delegation and restrictions.
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​admin/​authz/​fgap/​UserResourceTypeEvaluationSpecTest.java Covers member scopes and aggregate decisions.
services/​src/​main/​java/​org/​keycloak/​authorization/​admin/​representation/​FGAPPolicyEvaluationResponseBuilder.java Adds member decisions to evaluation responses.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​policy/​evaluation/​DefaultPolicyEvaluator.java Adds a decision-aware evaluation hook.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​permission/​ResourcePermission.java Tracks explicit aggregate denials.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​partial/​UserResourceTypePolicyEvaluator.java Collects membership paths and ancestor policies.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​partial/​PartialEvaluator.java Revises user and member permission filtering.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​partial/​PartialEvaluationPolicyProvider.java Adds member-specific evaluation outcomes.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​partial/​PartialEvaluationContext.java Stores granted, ungranted, and denied groups.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​GroupMemberPermissions.java Resolves decisions across memberships and ancestors.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​GroupMemberDecision.java Defines member-decision states and combination rules.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​FGAPPolicyEvaluator.java Connects membership collection to evaluation.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​FGAPEvaluation.java Applies resolved membership grants and denials.
server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​FGAPDecision.java Collects member decisions during evaluation.
model/​jpa/​src/​main/​java/​org/​keycloak/​models/​jpa/​JpaUserPartialEvaluationProvider.java Updates database filters for effective memberships.
js/​libs/​keycloak-admin-client/​src/​defs/​policyResultRepresentation.ts Types member-scope evaluation results.
js/​apps/​admin-ui/​src/​permissions-configuration/​permission-evaluation/​PermissionEvaluationResult.tsx Displays member-scope decisions.
js/​apps/​admin-ui/​maven-resources/​theme/​keycloak.v2/​admin/​messages/​messages_en.properties Adds decision labels.
docs/​documentation/​upgrading/​topics/​changes/​changes-27_0_0.adoc Adds migration guidance for delegated permissions.
docs/​documentation/​server_admin/​topics/​admin-console-permissions/​fine-grain-v2.adoc Explains delegation, denial, and search semantics.
core/​src/​main/​java/​org/​keycloak/​representations/​idm/​authorization/​PolicyEvaluationResponse.java Adds the member-scope decision response field.
authz/​policy/​common/​src/​main/​java/​org/​keycloak/​authorization/​policy/​provider/​group/​GroupPolicyProvider.java Adds member-specific group-policy evaluation.
authz/​policy/​common/​src/​main/​java/​org/​keycloak/​authorization/​policy/​provider/​aggregated/​AggregatePolicyProvider.java Propagates explicit denials through aggregates.

Review effort: Balanced

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical partial-evaluation flaws in negative aggregates, UNANIMOUS permissions, and Group conditions can cause user search and count to expose protected users despite direct authorization denying access.

2 open issues
2 resolved since last review

Review effort: Balanced

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.adapter.servlet.SAMLClockSkewAdapterTest#testTokenTimeIsValid

Keycloak CI - Adapter IT

org.jboss.arquillian.graphene.enricher.exception.PageObjectInitializationException: 
Can not instantiate Page Object 
class org.keycloak.testsuite.adapter.page.SalesPostClockSkewServlet
 declared in: 
org.keycloak.testsuite.adapter.servlet.SAMLClockSkewAdapterTest
...

Report flaky test

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Partial evaluation diverges from runtime authorization for type-level permissions and aggregate policies, allowing search/count to expose denied users or omit authorized users.

1 open issue
3 previously missed issues

In code that hasn't changed since last review

High severity Preserve denial uncertainty from unsupported aggregate children

authz/​policy/​common/​src/​main/​java/​org/​keycloak/​authorization/​policy/​provider/​aggregated/​AggregatePolicyProvider.java:195

This guard misses an unsupported negative child because explicitDenial is only set for children with partial evaluators. For a positive UNANIMOUS aggregate containing a matching User policy and a matching negative Time policy, partial evaluation returns DENY, which becomes NO_GRANT and allows an independent group's grant; runtime instead propagates the Time child's explicit denial and forbids access. Preserve an indeterminate outcome for unresolved children that could introduce an explicit denial, including through nested aggregates.

High severity Align runtime admin permission checks with type-level semantics

server-spi-private/​src/​main/​java/​org/​keycloak/​authorization/​fgap/​evaluation/​partial/​PartialEvaluator.java:267

With separate all-users VIEW permissions for admins A and B, this branch now lets A list/count every user, but direct lookup still denies: FGAPEvaluation.isDenied() treats B's failed Users permission as a denial, and DecisionPermissionCollector retains that denial. Please implement the matching type-level semantics in runtime evaluation as well and extend testOtherAdminTypeLevelPermissionDoesNotDenyCurrentAdmin with a direct GET assertion so queries cannot expose users that runtime authorization rejects.

Medium severity Apply aggregate strategy before forcing indeterminate results

authz/​policy/​common/​src/​main/​java/​org/​keycloak/​authorization/​policy/​provider/​aggregated/​AggregatePolicyProvider.java:196

For a positive AFFIRMATIVE aggregate containing a matching allow, a matching negative deny, and an unsupported Time policy, this returns FORCE_DENY even though the allow guarantees a grant regardless of Time. This hides authorized members from search/count while direct access succeeds; apply the decision strategy before forcing an indeterminate result, including when CONSENSUS already has a guaranteed majority.

1 resolved since last review

Review effort: Balanced

@vramik
vramik force-pushed the 54405-group-member-denial branch from e9acec1 to 56e9aa8 Compare December 1, 2026 10:02
@vramik
vramik marked this pull request as ready for review December 1, 2026 10:02
@vramik
vramik requested review from a team as code owners December 1, 2026 10:03
Copilot AI balanced review requested due to automatic review settings December 1, 2026 10:03
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Aggregate partial evaluation mishandles unresolved child policies, causing search/count results to expose users denied at runtime or exclude users whose grants are already guaranteed.

2 open issues
1 resolved since last review

Review effort: Balanced

@vramik
vramik force-pushed the 54405-group-member-denial branch from 56e9aa8 to 518cde0 Compare December 1, 2026 11:26
Copilot AI balanced review requested due to automatic review settings December 1, 2026 11:26
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Nested aggregates lose the FORCE_DENY signal, allowing independent membership grants to expose users in search and count results despite explicit runtime denial.

1 open issue
2 resolved since last review

Review effort: Balanced

…gated to other admins (parity with v1)

Closes keycloak#54405

Signed-off-by: vramik <vramik@redhat.com>
@vramik
vramik force-pushed the 54405-group-member-denial branch from 518cde0 to 2ea431b Compare December 1, 2026 11:50
Copilot AI balanced review requested due to automatic review settings December 1, 2026 11:50
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Nested aggregates lose FORCE_DENY outcomes, allowing independent membership grants to expose protected users in search/count despite explicit denial during direct lookup.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@vramik
vramik requested a review from pedroigor December 1, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FGAP v2: allow delegated admins to access users who also belong to groups delegated to other admins (parity with v1)

2 participants

0