Claude Opus 5.5 · Heavy
add-client-resource-type-and-scopes-to-authorization-schema-keycloak
Keycloak · Java · L · 300–799 lines · 5 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
- 3 of 8
- Comments published
- 5
- Comments matching a bug
- 3
- Comments not matching
- 2
- Cost of this PR
- $6.047
Published comments (5)
Per-client VIEW deny is bypassed by an all-clients VIEW grant — `canView()` checks only the all-clients `Clients` resource, so a NEGATIVE permission on one client can't override an all-clients VIEW grant, unlike users V2. Short-circuit only on `canViewClientDefault()` and let `hasPermission(client, VIEW)` decide.
Client permission check accepts scopes from permissions on other resources — A grant on another resource, such as the all-clients type resource, can satisfy this client's check and bypass a per-client deny. Skip any `Permission` whose `getResourceId()` differs from `resource.getId()`, as `UserPermissionsV2.hasPermission` does.
canExchangeTo throws in V2, so token exchange fails with HTTP 500 — Return a defined result such as `false`, or update that caller to handle V2.
canView(client) runs up to four separate policy evaluations per client — Client listing calls this per client, so each listing costs up to four `root.evaluatePermission` runs per client. Evaluate the client resource once and match the returned scopes against MANAGE, CONFIGURE and VIEW together.
Forbidden check for removing default client scope never reaches removal — `clientResource.getDefaultClientScopes()` already throws `ForbiddenException`, so `removeDefaultClientScope` is never reached and the test passes even if removal were allowed. Fetch the scope id via `realm.admin()`, then call `removeDefaultClientScope` through `realmAdminClient` and assert it's forbidden.