Skip to content

Enforce organization groups not accessible from SCIM API - #50311

Merged
ahus1 merged 1 commit into
keycloak:mainfrom
pedroigor:issue-50310
Jun 24, 2026
Merged

Enforce organization groups not accessible from SCIM API#50311
ahus1 merged 1 commit into
keycloak:mainfrom
pedroigor:issue-50310

Conversation

@pedroigor

Copy link
Copy Markdown
Contributor

Closes #50310

@pedroigor
pedroigor requested a review from a team as a code owner June 24, 2026 13:45
Copilot AI review requested due to automatic review settings June 24, 2026 13:45

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

This PR aligns SCIM Groups behavior with the Admin Groups API by preventing organization-related groups (including those reachable only by ID) from being accessed or managed via the SCIM API, addressing the gap described in #50310.

Changes:

  • Hide non-REALM (GroupModel.Type != REALM) groups from SCIM direct lookups by ID (thereby blocking update/patch/delete paths too).
  • Extend SCIM TCK coverage to assert organization groups/subgroups are not retrievable or mutable via SCIM, and that SCIM user groups excludes org groups.
  • Treat unsupported PATCH operations as validation errors (ModelValidationException) instead of generic runtime failures.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
scim/tests/base/src/test/java/org/keycloak/tests/scim/tck/GroupTest.java Adds/updates tests to ensure org groups (and org subgroups) are not accessible/manipulable via SCIM and are excluded from SCIM user groups.
scim/model/src/main/java/org/keycloak/scim/model/group/GroupResourceTypeProvider.java Filters getModel(id) to return null for non-REALM groups so SCIM treats org groups as not found.
scim/core/src/main/java/org/keycloak/scim/resource/spi/AbstractScimResourceTypeProvider.java Replaces a RuntimeException with ModelValidationException for unsupported PATCH ops to return a proper client error.

Comment on lines +529 to +531
// child of org group should be excluded from listing
ListResponse<Group> groups = client.groups().getAll("displayName pr");
assertTrue(groups.getResources().stream().noneMatch(g -> child.getId().equals(g.getId())));
Closes keycloak#50310

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
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.

Enforce organization groups not accessible from SCIM API

4 participants