8000 Deleted required client scope is removed from mixed client-scope poli… by martin-kanis · Pull Request #54033 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Deleted required client scope is removed from mixed client-scope poli… - #54033

Merged
pedroigor merged 1 commit into
keycloak:mainfrom
martin-kanis:issue-51248
Oct 19, 2026
Merged

pedroigor merged 1 commit into
keycloak:mainfrom
martin-kanis:issue-51248

Conversation

@martin-kanis
Copy link
Copy Markdown
Member

…cies

Closes #51248

Screenshot From 2026-10-15 16-02-09

Copilot AI balanced review requested due to automatic review settings October 15, 2026 14:05
@martin-kanis
martin-kanis requested review from a team as code owners October 15, 2026 14:05
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

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.

Copilot AI balanced review requested due to automatic review settings October 16, 2026 07:48
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.

🔵 Needs a closer look

Unresolved security concerns and cross-cutting authorization changes require corrections and final human review.

2 open findings
2 resolved since last review

🧠 Review effort: Balanced

…cies

Closes keycloak#51248

Signed-off-by: Martin Kanis <mkanis@ibm.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 08:32
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 direct-reference regression test retains an invalid aggregate, masking failures in direct-policy validation.

3 open findings

🧠 Review effort: Balanced

@pedroigor pedroigor 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.

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?

@martin-kanis
Copy link
Copy Markdown
Member Author

@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.

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.

Deleted required client scope is removed from mixed client-scope policies

3 participants

0