DeepSeek V4.1 Flash · 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
- 9
- Comments matching a bug
- 0
- Comments not matching
- 9
- Cost of this PR
- $0.395
Published comments (9)
Non-default getShortcut() and missing validation break grant factories — A third-party grant factory predating this change aborts startup with `AbstractMethodError`, a null shortcut throws `NullPointerException` from `ConcurrentHashMap.put`, and a wrong-length shortcut makes every id it encodes unparsable. Validate `grantShortcut` for non-null and length 2 in `postInit`, and make `getShortcut()` a default method so existing implementations keep working.
testIncorrectGrantType passes on NPE and never asserts IllegalArgumentException — The fixture leaves `factory.sessionFactory` null, so the broad `catch (RuntimeException)` swallows a `NullPointerException` and the test passes without exercising the unknown-grant validation. Set a `sessionFactory` on the fixture and assert `IllegalArgumentException` specifically instead of catching `RuntimeException`.
Grant-shortcut check in isAccessTokenId is inverted — The comparison rejects ids that have the expected grant and accepts ones that do not, so every caller such as `expectCodeToToken` and `expectRefresh` fails on correct tokens and passes on wrong-grant tokens. Negate it and use `substring(4, 6)`, since the shortcut starts at index 4.
Inverted grant-type shortcut check in isAccessTokenId matcher — The inverted guard rejects a match and accepts a mismatch, so for `ac`, `dg`, `rt` and `ci` the check never triggers and `isAccessTokenId` degenerates into a UUID check. Negate it and slice `substring(4, 6)`.
isAccessTokenId matcher rejects matching grant shortcut instead of mismatching one — The matcher rejects a matching shortcut and accepts a mismatching one, so `expectCodeToToken`, `expectDeviceCodeToToken`, `expectRefresh` and `expectAuthReqIdToToken` pass for any grant value. Negate the condition and extract via `substring(4, 6)`.
Inverted access token grant-shortcut comparison in isAccessTokenId — The inverted comparison rejects a correct token and accepts any wrong grant, so the `isAccessTokenId` callers would pass even if the grant type were wrong. Negate it and use `substring(4, 6)`.
Inverted grant shortcut check in isAccessTokenId rejects correct tokens — The matcher rejects the token exactly when the encoded shortcut matches, so `isAccessTokenId(RefreshTokenGrantTypeFactory.GRANT_SHORTCUT)` and the other new expectations fail on correct tokens. Negate the condition.
isAccessTokenId extracts grant shortcut at wrong offset — The offset is off by one: the grant shortcut occupies indices 4..6, so `substring(3, 5)` yields `ta` instead of `ac` for `onrtac:…`. Slice `substring(4, 6)`.
Null check validates grantType instead of rawTokenId — Require `rawTokenId` here instead.
Gold bugs found (0)
None.
Gold bugs missed (0)
None.