Repository navigation
Deleted required client scope is removed from mixed client-scope poli… - #54033
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Export/import collisions and parent-policy negation can still restore access after a required scope is deleted.
2 open findings
What changed in this PR
Addresses #51248 by retaining deleted required client-scope references so authorization policies deny access until repaired.
Changes:
- Preserves missing requirements during deletion and export/import.
- Adds an admin-console warning and documents recovery.
- Adds regression tests for denial, import, and reconfiguration.
| File | Description |
|---|---|
| testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/ClientScopePolicyTest.java | Tests deletion, import, and policy repair. |
| js/apps/admin-ui/src/clients/authorization/policy/ClientScope.tsx | Displays missing-scope warnings. |
| js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties | Adds warning text. |
| docs/documentation/upgrading/topics/changes/changes-27_0_0.adoc | Explains upgrade behavior. |
| docs/documentation/authorization_services/topics/policy-client-scope-policy-required-client-scope.adoc | Documents denial and recovery. |
| authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/clientscope/ClientScopePolicyProviderFactory.java | Retains and transfers unresolved requirements. |
| authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/clientscope/ClientScopePolicyProvider.java | Denies policies with missing required scopes. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
2c8d3a2 to
b2fa3fa
Compare
…cies Closes keycloak#51248 Signed-off-by: Martin Kanis <mkanis@ibm.com>
b2fa3fa to
23eae41
Compare
There was a problem hiding this comment.
I like this approach.
IIRC, other policy providers work differently, where an invalid reference (e.g.: user, role, client) will not invalidate the policy but will remove the invalid reference when fetching the policy.
Shall we also be updating other policy types?
|
@pedroigor yes exactly. If this approach is accepted, we should apply it on other types. Some examples would be policies with "Required roles", "Negative role/group" policies and "Last optional client scope". I would do it as a follow-up though. |


…cies
Closes #51248