GLM-5.3 · Heavy

implement-access-token-context-encoding-framework-keycloak

Keycloak · Java · L · 300–799 lines · 6 files

The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.

Gold bugs found
0 of 0
Comments published
5
Comments matching a bug
0
Comments not matching
5
Cost of this PR
$3.951

Published comments (5)

mediumbugtestsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AssertEvents.java:483

Inverted grant-type comparison in isAccessTokenId accepts wrong grant types — Wrong or missing grant types encoded in token IDs pass undetected, since the check returns false only on a match. Negate the `equals` in `isAccessTokenId` so mismatched segments are rejected.

mediumbugservices/src/main/java/org/keycloak/protocol/oidc/grants/PermissionGrantTypeFactory.java:38-41

UMA grant shortcut "pg" never used: RPT token creation never sets GRANT_TYPE attribute — RPTs encode "na" and report no grant info because `AuthorizationTokenService` builds them without `Constants.GRANT_TYPE`. Set the attribute on the clientSessionCtx in the UMA path before token creation.

mediumbugservices/src/main/java/org/keycloak/protocol/oidc/grants/ClientCredentialsGrantTypeFactory.java:38-41

`ClientCredentialsGrantType` never sets `Constants.GRANT_TYPE` — Set the attribute on the clientSessionCtx before `generateAccessToken()`, mirroring `ResourceOwnerPasswordCredentialsGrantType`. **Also found in:** - `services/src/main/java/org/keycloak/protocol/oidc/tokenexchange/StandardTokenExchangeProvider.java:236-240`

mediumbugservices/src/main/java/org/keycloak/protocol/oidc/encode/DefaultTokenContextEncoderProviderFactory.java:70-85

Grant type shortcuts are not validated for the 2-char, no-':' format — A custom `OAuth2GrantTypeFactory` following its own javadoc can register a 3-char or ':'-containing shortcut, producing token IDs the decoder in `DefaultTokenContextEncoderProvider` rejects or misparses. Validate length and content at registration and fix the `getShortcut()` javadoc. **Also found in:** - `services/src/main/java/org/keycloak/protocol/oidc/encode/DefaultTokenContextEncoderProvider.java:100-118` - `server-spi-private/src/main/java/org/keycloak/protocol/oidc/grants/OAuth2GrantTypeFactory.java:29-33`

mediumbugservices/src/test/java/org/keycloak/protocol/oidc/encode/DefaultTokenContextEncoderProviderTest.java:77-85

testIncorrectGrantType passes via swallowed NPE instead of validation error — The test never reaches the unknown-grant validation it is named for: `before()` skips `postInit`, so `getGrantTypeByShortcut` throws a null-sessionFactory NPE that the broad `catch (RuntimeException)` swallows. Catch `IllegalArgumentException` specifically and initialize the factory.

Gold bugs found (0)

None.

Gold bugs missed (0)

None.