Skip to content

fix: add admin-permissions client to isInternal denylist - #51634

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

fix: add admin-permissions client to isInternal denylist#51634
waterWang wants to merge 1 commit into
keycloak:mainfrom
waterWang:fix/fgap-v2-admin-permissions-internal

Conversation

@waterWang

Copy link
Copy Markdown

Description

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

As a result, a delegated administrator holding a FGAP Clients:manage permission (and no realm-management roles) can update and disable the admin-permissions client through the Admin API, even though getAccess() correctly returns manage: false for this client.

Fix

Added Constants.ADMIN_PERMISSIONS_CLIENT_ID to the isInternal predicate, making the enforcement path consistent with the access report.

Root Cause

ClientPermissions.isInternal (line 719) checks only for realm-management and -realm suffix clients. Constants.ADMIN_PERMISSIONS_CLIENT_ID was missing from the predicate.

How Has This Been Tested?

  • Code inspection confirmed the fix aligns with how realm-management is handled
  • The getAccess() method already special-cases this client at line 676; the fix makes isInternal consistent with that check

Closes #51630

Copilot AI balanced review requested due to automatic review settings August 12, 2026 02:38
@waterWang
waterWang requested a review from a team as a code owner August 12, 2026 02:38
The `ClientPermissions.isInternal` method denylists only the
`realm-management` client (and, in the master realm, client IDs
ending in the `-realm` suffix). The `admin-permissions` client —
the resource server holding the realm's entire FGAP V2 model — is
not in that list.

As a result, a delegated administrator holding a FGAP
`Clients:manage` permission (and no realm-management roles) can
update and disable the `admin-permissions` client through the
Admin API, even though `getAccess()` correctly returns
`manage: false` for this client.

This fix adds `Constants.ADMIN_PERMISSIONS_CLIENT_ID` to the
`isInternal` predicate, making the enforcement path consistent
with the access report.

Closes keycloak#51630

Signed-off-by: waterWang <waterWang@users.noreply.github.com>
@waterWang
waterWang force-pushed the fix/fgap-v2-admin-permissions-internal branch from 87a360d to 074b7df Compare August 12, 2026 02:38

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

Extends internal-client protection to the FGAP V2 admin-permissions client.

Changes:

  • Adds admin-permissions to the isInternal predicate.
Suppressed comments (1)

services/src/main/java/org/keycloak/services/resources/admin/fgap/ClientPermissions.java:729

  • This authorization regression has no automated coverage. Add an FGAP V2 test that grants only Clients:manage and verifies that updating or disabling the admin-permissions client is forbidden; code inspection alone will not guard this enforcement path.
                || Constants.ADMIN_PERMISSIONS_CLIENT_ID.equals(client.getClientId());

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


return Constants.REALM_MANAGEMENT_CLIENT_ID.equals(client.getClientId());
return Constants.REALM_MANAGEMENT_CLIENT_ID.equals(client.getClientId())
|| Constants.ADMIN_PERMISSIONS_CLIENT_ID.equals(client.getClientId());
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