Gemini 3.8 Flash · 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
0 of 8
Comments published
2
Comments matching a bug
0
Comments not matching
2
Cost of this PR
$0.970

Published comments (2)

highbugservices/src/main/java/org/keycloak/services/resources/admin/permissions/AdminPermissions.java:89-96

Client removal fails with UnsupportedOperationException under V2 authz — `ClientPermissionsV2.setPermissionsEnabled()` unconditionally throws `UnsupportedOperationException`, aborting client deletion when V2 fine-grained authorization is enabled. Guard this call by checking whether `Profile.Feature.ADMIN_FINE_GRAINED_AUTHZ_V2` is disabled.

highbugservices/src/main/java/org/keycloak/services/resources/admin/permissions/ClientPermissionsV2.java:65-69

canManage(ClientModel) checks role directly instead of calling canManage() — Callers granted permission to manage all clients are denied managing individual clients that have a dedicated resource in `resourceStore`. Replace the `root.hasOneAdminRole(AdminRoles.MANAGE_CLIENTS)` check with a call to `canManage()`.

Gold bugs found (0)

None.

Gold bugs missed (8)

mediumClaims the removal-cleanup listener is guarded by the V1 fine-grained flag, so client/role/group permissions are orphaned when V1 is disabled or only V2 is enabled.
highgetClientsWithPermission in ClientPermissionsV2 only finds the type-level 'Clients' resource and returns its name, never actual client ids, so callers that resolve the returned values as client ids get wrong results or null clients.
mediumClaims getResourceTypeResource can return null in ClientPermissionsV2.hasPermission, causing a NullPointerException in findByResource.
mediumClientPermissionsV2.canView() ignores a global MANAGE permission, so admins with only global manage take the unpaginated, per-client evaluated listing path.
highcanView(client) short-circuits on the global all-clients VIEW permission, so a client-specific permission denying an admin is never evaluated and the client is still viewable.
mediumThe negative check for removing a default client scope expects ForbiddenException, but it can come from the preceding getDefaultClientScopes() call, so the test passes even without a permission check on removal.
highIn ClientPermissionsV2.hasPermission, an admin granted a permission on all clients is denied on any client that also has its own per-client permission resource, because only the per-client resource is evaluated.
highClientPermissionsV2.canExchangeTo throws UnsupportedOperationException, but AbstractTokenExchangeProvider still calls clients().canExchangeTo for client-to-client exchange, so with token exchange and FGAP V2 enabled the request fails with a server error instead of a permission decision.