GLM-5.3 Flash · Balanced
add-client-resource-type-and-scopes-to-authorization-schema-keycloak
Keycloak · Java · L · 300–799 lines · 5 files
The normal review, with one generalist agent. Judge: Claude Opus 5.5.
- Gold bugs found
- 2 of 15
- Comments published
- 4
- Comments matching a bug
- 2
- Comments not matching
- 2
- Cost of this PR
- $0.150
Published comments (4)
getClientsWithPermission returns the all-clients type resource as a client id — Delegated admins holding an all-clients map-roles-composite permission get a 500 because the caller `getRoleIdsWithPermissions` dereferences the bogus id via `realm.getClientById` without a null check. Skip resources whose name equals `CLIENTS_RESOURCE_TYPE` in `getClientsWithPermission`.
canExchangeTo throws UnsupportedOperationException, breaking token exchange — With `ADMIN_FINE_GRAINED_AUTHZ_V2` enabled, every cross-client token exchange fails with an unhandled 500 because `AbstractTokenExchangeProvider` calls this method unconditionally. Evaluate the permission as V1 does instead of throwing `UnsupportedOperationException`.
Cleanup listener gates on V1 flag but management() dispatches to throwing V2 implementation — Both flags can be active at once — `Profile` auto-enables the V1 flag for the token-exchange V2 features — so `ClientRemovedEvent` reaches `ClientPermissionsV2.setPermissionsEnabled` and every client deletion rolls back. Also require that `ADMIN_FINE_GRAINED_AUTHZ_V2` is disabled.
getClientsWithPermission misses per-client grants and returns bogus id — Per-client grants like map-roles stay invisible because resources from `AdminPermissionsSchema.getOrCreateResource` carry no type attribute, so `findByType` matches only the all-clients resource. Look up per-client resources by name instead of via `findByType`.