Skip to content

fix: add admin-permissions client to isInternal denylist (FGAP V2) [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH] - #51631

Open
waterWang wants to merge 1 commit into
keycloak:mainfrom
waterWang:fix/fgap-isinternal-admin-permissions
Open

fix: add admin-permissions client to isInternal denylist (FGAP V2) [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH]#51631
waterWang wants to merge 1 commit into
keycloak:mainfrom
waterWang:fix/fgap-isinternal-admin-permissions

Conversation

@waterWang

Copy link
Copy Markdown

Summary

ClientPermissions.isInternal only denylisted the realm-management client (and, in the master realm, client IDs ending in -realm). The admin-permissions client — the resource server holding the realm's entire FGAP V2 model — was not in that list.

Fix

Added a Constants.ADMIN_PERMISSIONS_CLIENT_ID check before the existing realm-specific branches so admin-permissions is treated as internal in all realms (both admin/master and non-admin).

Why this works

  • isInternal is called from canManage(ClientModel) and canConfigure(ClientModel) — both return false for internal clients, preventing FGAP Clients:manage from overriding the block.
  • The getAccess method already special-cases admin-permissions (returns manage: false), but canManage did not agree — this fix aligns enforcement with the access report.

Testing

  • Existing PermissionRESTTest already validates that users with manage-clients cannot create permissions on admin-permissions client.
  • This is a minimal one-line-add change (4 lines with guard) matching the pattern already used for REALM_MANAGEMENT_CLIENT_ID.

Closes #51630

…aaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH]

Closes keycloak#51630

ClientPermissions.isInternal only denylisted realm-management and -realm
suffix clients. The admin-permissions client (the resource server holding
the realm's FGAP V2 model) was not in that list, allowing a delegated
admin with Clients:manage FGAP permission to update and disable it.

Added a Constants.ADMIN_PERMISSIONS_CLIENT_ID check before the existing
realm-specific checks so it's treated as internal in all realms.
Copilot AI balanced review requested due to automatic review settings August 11, 2026 21:11
@waterWang
waterWang requested a review from a team as a code owner August 11, 2026 21:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Protects Keycloak’s FGAP V2 admin-permissions client from delegated client-management operations.

Changes:

  • Classifies admin-permissions as an internal client.
  • Blocks canManage and canConfigure authorization paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

return false;
}

if (Constants.ADMIN_PERMISSIONS_CLIENT_ID.equals(client.getClientId())) {
Comment on lines +724 to +726
if (Constants.ADMIN_PERMISSIONS_CLIENT_ID.equals(client.getClientId())) {
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FGAP V2: isInternal denylist missing admin-permissions client allows delegated admin to update it

2 participants