Repository navigation
[CIMD]: unauthenticated creation of service-account clients from the fetched metadata document - #55214
[CIMD]: unauthenticated creation of service-account clients from the fetched metadata document#55214tnorimat wants to merge 1 commit into
Conversation
|
Previously, the The Grants that are not allowed are removed instead of rejected, consistent with the existing Accept Public Client with Confidential-only Grant Types option, so clients that declare extra grants (e.g. Claude Desktop) keep working. New tests in |
There was a problem hiding this comment.
🟡 Changes recommended
Critical grant restrictions remain bypassable because refreshes can retain disallowed service accounts and response-type conversion can enable flows excluded by the allow list.
2 open issues
What changed in this PR
This PR addresses #55106 by adding a configurable grant-type allow list to CIMD client registration and refresh, limiting capabilities enabled by unauthenticated metadata documents.
Changes:
- Default allowed grants to
authorization_codeandrefresh_token, filtering other requested grants. - Add tests for default restrictions, metadata refresh, service-account denial, and explicit administrator overrides.
- Document the configuration and risks of allowing additional grants.
| File | Description |
|---|---|
| tests/base/src/test/java/org/keycloak/tests/client/policies/ClientIdMetadataDocumentTest.java | Tests default restrictions and configured grant allowances. |
| services/src/main/java/org/keycloak/protocol/oauth2/cimd/clientpolicy/executor/AbstractClientIdMetadataDocumentExecutorFactory.java | Exposes the allowed-grant-types configuration and help text. |
| services/src/main/java/org/keycloak/protocol/oauth2/cimd/clientpolicy/executor/AbstractClientIdMetadataDocumentExecutor.java | Adds allow-list configuration and metadata grant filtering. |
| docs/guides/securing-apps/mcp-authz-server.adoc | Documents defaults and cautions for additional grants. |
Review effort: Balanced
8201d90 to
0b26594
Compare
There was a problem hiding this comment.
🟡 Changes recommended
A 304 refresh can let existing clients retain disallowed grants indefinitely, and re-allowing UMA does not restore authorization services without re-registering the client.
2 open issues
2 resolved since last review
Review effort: Balanced
0b26594 to
e5890fc
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Existing CIMD service-account clients can still obtain tokens directly after client_credentials is disallowed because token requests do not enforce the current allow list, and rejected metadata refreshes can bypass cleanup.
1 open issue
2 resolved since last review
Review effort: Balanced
Unreported flaky test detectedIf 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.cluster.ClientInvalidationClusterTest#crudWithoutFailoverorg.keycloak.testsuite.cluster.ClientInvalidationClusterTest#crudWithFailover |
…fetched metadata document closes keycloak#55106 Signed-off-by: Takashi Norimatsu <takashi.norimatsu.ws@hitachi.com>
e5890fc to
0b6fb8f
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Critical enforcement gaps allow CIMD clients to obtain UMA tokens outside the grant allow list and complete in-flight implicit/hybrid logins after implicit grants are disallowed.
2 open issues
1 resolved since last review
Review effort: Balanced
| case DEVICE_AUTHORIZATION_REQUEST: | ||
| case DEVICE_TOKEN_REQUEST: | ||
| enforceAllowedGrantType(context); |
| case BACKCHANNEL_AUTHENTICATION_REQUEST: | ||
| case BACKCHANNEL_TOKEN_REQUEST: | ||
| case DEVICE_AUTHORIZATION_REQUEST: | ||
| case DEVICE_TOKEN_REQUEST: | ||
| enforceAllowedGrantType(context); |


closes #55106