8000 Check ownership of every resource of a user-managed permission by sguilhen · Pull Request #55537 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Check ownership of every resource of a user-managed permission - #55537

Open
sguilhen wants to merge 1 commit into
keycloak:mainfrom
sguilhen:55388-uma-multi-resource-ownership
Open

sguilhen wants to merge 1 commit into
keycloak:mainfrom
sguilhen:55388-uma-multi-resource-ownership

Conversation

@sguilhen
Copy link
Copy Markdown
Contributor
  • 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 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 #55388

@sguilhen
sguilhen requested review from a team as code owners November 25, 2026 17:26
Copilot AI balanced review requested due to automatic review settings November 25, 2026 17: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

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
sguilhen force-pushed the 55388-uma-multi-resource-ownership branch from f908c20 to c2b9e62 Compare November 25, 2026 18:07
Copilot AI balanced review requested due to automatic review settings November 25, 2026 18:07
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

Ownership filtering occurs after pagination, potentially returning empty or short pages that cause clients to miss accessible permissions.

1 open issue
1 resolved since last review

Review effort: Balanced

// 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());
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.

Incomplete fix for CVE-2025-14778: UserManagedPermissionService.delete() still trusts only the first resource of a multi-resource UMA policy

2 participants

0