8000 7FFF Prevent Vault secret resolution and injection in DCR client secrets by jimmychakkalakal · Pull Request #54463 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Prevent Vault secret resolution and injection in DCR client secrets - #54463

Merged
mposolda merged 4 commits into
keycloak:mainfrom
jimmychakkalakal:issues/54382-dcr-vault-reference-protection
Nov 9, 2026
Merged

mposolda merged 4 commits into
keycloak:mainfrom
jimmychakkalakal:issues/54382-dcr-vault-reference-protection

Conversation

@jimmychakkalakal
Copy link
Copy Markdown
Contributor

Prevent Vault secret resolution and injection in DCR client secrets

  • Reject Vault expressions in client registration (DCR) requests from non-admin callers
  • Return raw Vault expressions instead of resolved values in client authenticator adapter configs
  • Add integration tests covering DCR Vault injection and adapter installation serialization

Closes #54382

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 rotated-secret attribute validation path lacks a RAT-authenticated update test verifying that Vault expressions are rejected with HTTP 400 and no persisted changes.

1 open issue
What changed in this PR

This PR addresses #54382 by blocking Vault-expression injection through non-admin Dynamic Client Registration (DCR) requests and preventing installation configurations from exposing resolved Vault secrets.

Changes:

  • Reject Vault expressions in client secrets and attributes submitted by non-admin DCR callers.
  • Return raw secrets in adapter configurations for both secret-based client authenticators.
  • Add integration tests for DCR rejection and adapter serialization.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​client/​DcrVaultSecretDisclosureTest.java Adds Vault-backed DCR and adapter configuration tests.
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​admin/​ClientVaultTest.java Makes the existing test class public.
services/​src/​main/​java/​org/​keycloak/​services/​clientregistration/​AbstractClientRegistrationProvider.java Validates untrusted secrets and attributes during registration and updates.
services/​src/​main/​java/​org/​keycloak/​authentication/​authenticators/​client/​JWTClientSecretAuthenticator.java Stops resolving Vault secrets in JWT adapter configurations.
services/​src/​main/​java/​org/​keycloak/​authentication/​authenticators/​client/​ClientIdAndSecretAuthenticator.java Stops resolving Vault secrets in client-secret adapter configurations.

Review effort: Balanced

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 reported for the DCR Vault-expression restrictions and adapter secret-export changes.

1 open issue

Review effort: Balanced

@jimmychakkalakal
jimmychakkalakal force-pushed the issues/54382-dcr-vault-reference-protection branch from 3d59980 to bdb5c3d Compare October 30, 2026 09:20
@jimmychakkalakal
jimmychakkalakal marked this pull request as ready for review October 30, 2026 10:23
Copilot AI balanced review requested due to automatic review settings October 30, 2026 10:23
@jimmychakkalakal
jimmychakkalakal requested a review from a team as a code owner October 30, 2026 10:23
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 changes addressing DCR Vault-expression injection and adapter secret disclosure.

1 open issue

Review effort: Balanced

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

@jimmychakkalakal
Allowing the same reference in the same field grants no new Vault access, provided adapter export never resolves it. It does not establish who originally set the reference, but rejecting an unchanged value would not remove previously injected references either.

Remaining gaps: non-admin creation rejection and moving a reference to a different attribute key.

Copilot AI balanced review requested due to automatic review settings October 30, 2026 13:55
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

Human assessment is needed because the update-rejection tests would still pass if the creation-time Vault-expression guard were removed.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 30, 2026 14:37
@jimmychakkalakal
jimmychakkalakal force-pushed the issues/54382-dcr-vault-reference-protection branch from 9451214 to 0e15a65 Compare October 30, 2026 14:37
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 remain for the DCR Vault-reference restrictions and adapter secret-disclosure protections.

1 open issue

Review effort: Balanced

@mposolda mposolda self-assigned this Nov 2, 2026
@mposolda mposolda 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.

@jimmychakkalakal Thanks for the PR!

One general remark: Are they similar issues possible by other ways? If yes, we will likely receive follow-up CVE reports as usual...

I am concerned about those questions:

AFAIK Vault feature has support to store secrets of identity providers and user storage providers (like LDAP secrets). If user has permission to manage identity providers, does it allow him to set the vault secret of the IDP same as some client secret of specific client foo ? Does it then allow him to obtain the secret of the client foo? If yes, then it might be a problem as user with the role manage-identity-providers should not be allowed to obtain client secrets as he may have permissions to CRUD identity providers, but not to CRUD clients. I am not 100% sure if this is a real issue, but can you please check it?

One additional though: Maybe this should be also partially handled as the issue to improve the documentation? For example if client administrator of the client foo creates client secret with the key ${foo.secret} , then the administrator of the IDP (or administrator of the other client bar) may have easier task as he can guess the vault key ${foo.secret} , which may allow him to see the secret of the client foo (if my concern from the previous paragraph is correct). In that case, it might be good if the documentation of the vault is improved, so that it contains some hints that the key itself should not be easy to guess. But again, not 100% sure if this is real issue?

Copilot AI balanced review requested due to automatic review settings November 6, 2026 13:58
Closes keycloak#54382

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
Closes keycloak#54382

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
Closes keycloak#54382

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
Closes keycloak#54382

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
@jimmychakkalakal
jimmychakkalakal force-pushed the issues/54382-dcr-vault-reference-protection branch from 6ce7c0b to 17ecae6 Compare November 6, 2026 13:58
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 reported for the DCR Vault-reference restrictions and adapter secret-disclosure protections.

1 open issue

Review effort: Balanced

@jimmychakkalakal
Copy link
Copy Markdown
Contributor Author

@jimmychakkalakal Thanks for the PR!

One general remark: Are they similar issues possible by other ways? If yes, we will likely receive follow-up CVE reports as usual...

I am concerned about those questions:

AFAIK Vault feature has support to store secrets of identity providers and user storage providers (like LDAP secrets). If user has permission to manage identity providers, does it allow him to set the vault secret of the IDP same as some client secret of specific client foo ? Does it then allow him to obtain the secret of the client foo? If yes, then it might be a problem as user with the role manage-identity-providers should not be allowed to obtain client secrets as he may have permissions to CRUD identity providers, but not to CRUD clients. I am not 100% sure if this is a real issue, but can you please check it?

One additional though: Maybe this should be also partially handled as the issue to improve the documentation? For example if client administrator of the client foo creates client secret with the key ${foo.secret} , then the administrator of the IDP (or administrator of the other client bar) may have easier task as he can guess the vault key ${foo.secret} , which may allow him to see the secret of the client foo (if my concern from the previous paragraph is correct). In that case, it might be good if the documentation of the vault is improved, so that it contains some hints that the key itself should not be easy to guess. But again, not 100% sure if this is real issue?

@mposolda Thanks, the concern about IdP secrets is valid. I was able to reproduce it locally with an integration test.
A user with only manage-identity-providers can set an IdP clientSecret to the same ${vault.} as a client and set tokenUrl to an endpoint they control. Keycloak then sends that client's resolved secret to that endpoint.

As this is a separate authorization gap and limited to Vault scope.
I like to keep this PR scoped to DCR and adapter export, and handle the vault case separately. WDYT?

I added a note to the Vault docs about guessable keys and sharing keys across components, as you suggested.

@mjatin2007
Copy link
Copy Markdown
Contributor

Hi @jimmychakkalakal and @mposolda,

I saw the follow-up discussion on the analogous Vault paths and @jimmychakkalakal’s plan to handle it separately, so I don’t want to duplicate anything. If regression tests or review would be useful, I’d be glad to help. Otherwise, no worries.

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

@jimmychakkalakal Sounds good, Thanks!

@mposolda
mposolda merged commit df2914e into keycloak:main Nov 9, 2026
95 of 96 checks passed
jimmychakkalakal added a commit to jimmychakkalakal/keycloak that referenced this pull request Nov 10, 2026
…eycloak#54463)

Closes keycloak#54382

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
(cherry picked from commit df2914e)
Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
mposolda pushed a commit that referenced this pull request Nov 10, 2026
…54463)

Closes #54382

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
(cherry picked from commit df2914e)
jimmychakkalakal added a commit to jimmychakkalakal/keycloak that referenced this pull request Nov 10, 2026
…eycloak#54463)

Closes keycloak#54382

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
(cherry picked from commit df2914e)
Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
mposolda pushed a commit that referenced this pull request Nov 11, 2026
…54463)

Closes #54382

Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
(cherry picked from commit df2914e)
Signed-off-by: Jimmy Chakkalakal <jimmy.chakkalakal@ibm.com>
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.

[CVE-2026-117688] [Security] Incomplete fix: DCR RAT-controlled Vault reference exposes plaintext secrets

5 participants

0