GLM-5.3 · Balanced
implement-access-token-context-encoding-framework-keycloak
Keycloak · Java · L · 300–799 lines · 6 files
The normal review, with one generalist agent. Judge: Claude Haiku 5.5.
- Gold bugs found
- 0 of 0
- Comments published
- 3
- Comments matching a bug
- 0
- Comments not matching
- 3
- Cost of this PR
- $1.565
Published comments (3)
isAccessTokenId slices wrong chars and inverts grant-shortcut comparison — The grant check in `matchesSafely` never fires, so `expectRefresh` and sibling matchers degrade to a bare UUID check that accepts any grant, and short prefixes throw `StringIndexOutOfBoundsException`. Slice the grant segment with `substring(4, 6)` per `DefaultTokenContextEncoderProvider` and return false only when it differs from `expectedGrantShortcut`.
Grant-type token ID encoding always emits "na" for client-credentials, UMA and token-exchange tokens — The registered "cc" and "pg" shortcuts stay dead because client-credentials, UMA, and token-exchange issuance (check `ClientCredentialsGrantType`, `AuthorizationTokenService`, `AbstractTokenExchangeProvider`) never set `Constants.GRANT_TYPE` on `clientSessionCtx`, defeating the introspection and admin optimizations. Set the attribute in those paths or derive the grant centrally in `initToken`.
Constructor re-checks grantType instead of rawTokenId, leaving null rawTokenId unchecked — A null `rawTokenId` slips through, and `encodeTokenId` would later concatenate it into a token ID ending in ":null". Pass `rawTokenId` to the final `Objects.requireNonNull` call.
Gold bugs found (0)
None.
Gold bugs missed (0)
None.