Repository navigation
Deny FGAP permission checks when resource type resource is missing - #55825
Open
akasakariko wants to merge 1 commit into
Open
akasakariko wants to merge 1 commit into
akasakariko wants to merge 1 commit into
Conversation
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>
Contributor
There was a problem hiding this comment.
🟡 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
falsewhen the resource-type lookup returnsnull. - Add a regression test expecting HTTP 403 when the
Usersresource 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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #55690
Return false in
FineGrainedAdminPermissionEvaluatorwhenAdminPermissionsSchemareturns 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 asUsers