Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The collection find() endpoint lacks the resource-ownership restriction applied to findById(), allowing users to retrieve mixed-owner policies through an alternate read path.
1 open issue
What changed in this PR
This PR addresses #55388 by strengthening resource-ownership checks for user-managed permissions in the UMA Protection API.
Changes:
- Checks ownership of every associated resource before read-by-ID, update, and delete operations.
- Rejects policies without associated resources.
- Adds regression tests for mixed-owner, same-owner multi-resource, and resource-less policies.
| File | Description |
|---|---|
| testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/UserManagedPermissionServiceTest.java | Adds ownership and resource-less policy regression tests. |
| services/src/main/java/org/keycloak/authorization/protection/policy/UserManagedPermissionService.java | Centralizes checks across all resources associated with a policy. |
Review effort: Balanced
All operations (read, update, delete) now verify that the caller owns every resource the policy governs. A policy associated with no resource at all, such as an admin-managed policy or one bound to a resource type, is rejected rather than accepted, since there is no resource owner to check the caller against. Creation is unchanged, as it always attaches the single resource the caller owns. Closes keycloak#55388 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
sguilhen
force-pushed
the
55388-uma-multi-resource-ownership
branch
from
November 25, 2026 18:07
f908c20 to
c2b9e62
Compare
| // owns every resource the policy governs if it was wired up to span multiple resources directly | ||
| // through the authorization model | ||
| List<?> policies = (List<?>) response.getEntity(); | ||
| List<?> owned = policies.stream().filter(this::ownsAllResources).collect(Collectors.toList()); |
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 #55388