Skip to content

fix(admin): reject retyping a component into an internal provider via update - #54501

Open
Angel-Tornero wants to merge 2 commits into
keycloak:mainfrom
Angel-Tornero:fix/component-retype-privilege-escalation
Open

Angel-Tornero wants to merge 2 commits into
keycloak:mainfrom
Angel-Tornero:fix/component-retype-privilege-escalation

Conversation

@Angel-Tornero

@Angel-Tornero Angel-Tornero commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

ComponentResource.updateComponent only validated the stored component's provider type, letting a component be retyped into an internal provider (such as WorkflowProvider) through a PUT, bypassing the restriction already enforced on create.

The fix validates the incoming payload's effective providerType/providerId (payload value if present, otherwise the stored one), alongside the existing check on the stored component. The payload-side check also covers partial payloads, though that path currently can't be reached in practice due to an unrelated bug (partial updates return 500), filed separately as #54504.

AI assisted locating the relevant code and proposing the fix approach; I implemented, reviewed and verified it.

Closes #54415

… update

ComponentResource.updateComponent only validated the stored component's
provider type, letting a component be retyped into an internal provider
(such as WorkflowProvider) through a PUT, bypassing the restriction
already enforced on create.

Closes keycloak#54415

Signed-off-by: Angel-Tornero <angeltornerohdez@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 22:09
@Angel-Tornero
Angel-Tornero requested a review from a team as a code owner October 30, 2026 22:09

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.

🟢 Approval recommended

No active review issues were identified for the provider-validation update.

No open issues 🎉

What changed in this PR

This PR closes the Component API update bypass described in #54415 by validating the requested provider type and ID, preventing allowed components from being retyped into internal providers.

Changes:

  • Validates incoming provider values before updating, falling back to stored values when fields are omitted.
  • Adds a regression test confirming that retyping a key provider into a workflow provider is forbidden and leaves the stored provider values unchanged.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​workflow/​WorkflowManagementTest.java Tests rejection of retyping into an internal provider and preservation of stored values.
services/​src/​main/​java/​org/​keycloak/​services/​resources/​admin/​ComponentResource.java Checks the requested provider type and ID against internal-provider restrictions.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 20, 2026 23:14

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.

🟢 Approval recommended

No active review issues are recorded for the component-update validation change.

No open issues 🎉

Review effort: Balanced

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.adapter.servlet.SAMLClockSkewAdapterTest#testTokenTimeIsValid

Keycloak CI - Adapter IT

org.jboss.arquillian.graphene.enricher.exception.PageObjectInitializationException: 
Can not instantiate Page Object 
class org.keycloak.testsuite.adapter.page.SalesPostClockSkewServlet
 declared in: 
org.keycloak.testsuite.adapter.servlet.SAMLClockSkewAdapterTest
...

Report flaky test

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

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.

[Security] Privilege escalation: manage-realm -> realm-admin by retyping a component into a Workflow via the Component API

2 participants