8000 Deny FGAP permission checks when resource type resource is missing by akasakariko · Pull Request #55825 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Deny FGAP permission checks when resource type resource is missing - #55825

Open
akasakariko wants to merge 1 commit into
keycloak:mainfrom
akasakariko:fix/55690-fgap-missing-resource-type
Open

akasakariko wants to merge 1 commit into
keycloak:mainfrom
akasakariko:fix/55690-fgap-missing-resource-type

Conversation

@akasakariko
Copy link
Copy Markdown
Contributor

Closes #55690

Return false in FineGrainedAdminPermissionEvaluator when AdminPermissionsSchema returns a null resource for the requested resource type so delegated admin requests receive 403 Forbidden instead of failing with a NullPointerException when a realm is missing a schema resource such as Users

Return false from FineGrainedAdminPermissionEvaluator when the schema resource for the requested resource type does not exist instead of dereferencing null and failing with an NPE

Closes keycloak#55690

Signed-off-by: Asuka <148060537+akasakariko@users.noreply.github.com>
@akasakariko
akasakariko requested a review from a team as a code owner December 5, 2026 09:02
Copilot AI balanced review requested due to automatic review settings December 5, 2026 09:02
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

The regression test lacks @DatabaseTest, leaving the missing-resource behavior untested by the cross-database suite.

1 open issue
What changed in this PR

Fixes #55690 by denying fine-grained admin permission checks when a resource-type resource is missing, avoiding a NullPointerException.

Changes:

  • Return false when the resource-type lookup returns null.
  • Add a regression test expecting HTTP 403 when the Users resource is missing.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​admin/​authz/​fgap/​UserResourceTypeEvaluationTest.java Adds missing-resource denial coverage.
services/​src/​main/​java/​org/​keycloak/​services/​resources/​admin/​fgap/​FineGrainedAdminPermissionEvaluator.java Adds a null guard before permission evaluation.

Review effort: Balanced

}

@Test
public void testViewUserDeniedWhenUsersResourceTypeResourceMissing() {
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.

NPE in FineGrainedAdminPermissionEvaluator.hasPermission when the Users resource type resource is missing

2 participants

0