Enforce organization groups not accessible from SCIM API - #50311
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
groupsexcludes 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()))); |
sguilhen
approved these changes
Jun 24, 2026
Closes keycloak#50310 Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
ahus1
approved these changes
Jun 24, 2026
This was referenced Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #50310