8000 Follow-up to #54382 and #54463 - Require manage-realm to set vault expressions in identity provider configuration by jimmychakkalakal · Pull Request #55102 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
8000

Follow-up to #54382 and #54463 - Require manage-realm to set vault expressions in identity provider configuration - #55102

Draft
jimmychakkalakal wants to merge 1 commit into
keycloak:mainfrom
jimmychakkalakal:issues/54979-Require-manage-realm-to-set-vault-expressions-in-identity-provider-configuration
Draft

jimmychakkalakal wants to merge 1 commit into
keycloak:mainfrom
jimmychakkalakal:issues/54979-Require-manage-realm-to-set-vault-expressions-in-identity-provider-configuration

Conversation

@jimmychakkalakal
Copy link
Copy Markdown
Contributor

Problem

A ${vault.} expression resolves to the same secret in every vault-enabled field of a realm, whichever component the secret was provisioned for. A user holding only manage-identity-providers could therefore set an identity provider's clientSecret to the vault expression used by a client they cannot manage, and Keycloak would send the resolved value to the identity provider's token URL.

Changes

  1. IdentityProvidersResource#create and IdentityProviderResource#update return 403 when a non-manage-realm caller submits a vault expression in the identity provider configuration that is new or different from the stored value.
  2. The check uses the same expression pattern that the vault transcriber resolves.
  3. Existing identity providers with a stored vault expression are unaffected unless that value is changed.

Other paths that can reference vault keys already require manage-realm: components (LDAP bind credential, key providers), authenticator configuration, realm settings (SMTP) and partial import.

…nfiguration

Vault keys are shared by all components of a realm. A user with only
manage-identity-providers could set an identity provider client secret to the
vault expression of a client and make Keycloak send the resolved secret to a
token URL controlled by that user.

Creating an identity provider, or changing an existing vault expression in its
configuration, now requires the manage-realm role. Unchanged vault expressions
on existing identity providers are still accepted, so existing configurations
keep working.

Closes keycloak#54979

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
@jimmychakkalakal jimmychakkalakal changed the title Follow-up to #54382 and #54463, as agreed in the discussion on #54463. Follow-up to #54382 and #54463 - Require manage-realm to set vault expressions in identity provider configuration Nov 12, 2026
@jimmychakkalakal
jimmychakkalakal requested a balanced review from Copilot November 12, 2026 13:21
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

A critical authorization gap lets an IdP manager without manage-realm retain a vault-backed client secret while changing tokenUrl, causing login to send the resolved secret to an attacker-controlled endpoint.

1 open issue
What changed in this PR

This follow-up to #54382 and #54463 restricts vault expressions in identity provider configuration to reduce cross-component secret disclosure by delegated administrators.

Changes:

  • Requires manage-realm to introduce or change vault expressions during identity provider creation and updates.
  • Preserves unchanged stored vault expressions.
  • Adds integration tests for delegated-admin restrictions and realm-admin access.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​vault/​VaultCrossComponentSecretDisclosureTest.java Adds permission and secret-disclosure regression tests with a file-backed vault.
services/​src/​main/​java/​org/​keycloak/​services/​resources/​admin/​IdentityProvidersResource.java Applies vault-expression authorization during creation.
services/​src/​main/​java/​org/​keycloak/​services/​resources/​admin/​IdentityProviderResource.java Defines the shared authorization check and applies it during updates.

Review effort: Balanced

}
}

requireManageRealmForVaultExpressions(auth, providerRep.getConfig(), identityProviderModel.getConfig());
@mposolda mposolda self-assigned this Nov 12, 2026
@mposolda
mposolda marked this pull request as ready for review November 12, 2026 15:46
@mposolda
mposolda requested a review from a team as a code owner November 12, 2026 15:46
@mposolda mposolda removed their assignment Nov 12, 2026
@jimmychakkalakal
jimmychakkalakal marked this pull request as draft November 12, 2026 15:53
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.

3 participants

0