Amazon Ergo 1.0 · 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 Opus 5.5.
- Gold bugs found
- 3 of 15
- Comments published
- 5
- Comments matching a bug
- 3
- Comments not matching
- 2
- Cost of this PR
- $4.816
Published comments (5)
All-clients permission resource is returned as a client ID — `AvailableRoleMappingResource.getRoleIdsWithPermissions` looks up every returned value as a client, so `getClientById("Clients")` returns null and the endpoint fails with an NPE. Handle the all-clients resource separately in `getClientsWithPermission`, expanding it to real client IDs instead of adding `resource.getName()`.
ClientPermissionsV2.setPermissionsEnabled breaks client removal in FGAP v2 — The `AdminPermissions` removal listener calls `setPermissionsEnabled(client, false)` on every `ClientRemovedEvent`, so this unconditional throw makes client removal fail in FGAP v2. Implement the V2 cleanup, or make disable a safe no-op when no per-client permission state exists.
All-clients permissions ignored when a per-client resource exists — A per-client resource for any scope suppresses all-clients permissions for every scope, so `canManage` or `canConfigure` can deny access despite an all-clients grant. If the per-client resource has no permission for the requested scope, also evaluate the all-clients resource while preserving negative-policy semantics.
Map-role test grants CONFIGURE, masking broken map-scope checks — `CONFIGURE` also grants client access, so both operations can pass even if their `MAP_ROLES` or `MAP_ROLES_COMPOSITE` checks are broken. Test each scope separately with `VIEW`, and add a `VIEW`-only negative case asserting the unsupported operation is forbidden.
Client removal cleanup is skipped when only fine-grained authz V2 is enabled — `ADMIN_FINE_GRAINED_AUTHZ_V2` does not enable `ADMIN_FINE_GRAINED_AUTHZ`, so V2-only realms never run the removal listener and leave the deleted client's permission resource and policies in the admin-permissions client. Include `ADMIN_FINE_GRAINED_AUTHZ_V2` in the condition, or check whether realm admin permissions are enabled.