Skip to content

User partial filters ignore ancestor group membership denies#51184

Open
vramik wants to merge 1 commit into
keycloak:mainfrom
vramik:cve-888
Open

User partial filters ignore ancestor group membership denies#51184
vramik wants to merge 1 commit into
keycloak:mainfrom
vramik:cve-888

Conversation

@vramik

@vramik vramik commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Closes #51158

Closes keycloak#51158

Signed-off-by: vramik <vramik@redhat.com>
Copilot AI review requested due to automatic review settings July 27, 2026 09:25
@vramik
vramik requested a review from a team as a code owner July 27, 2026 09:25

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

Fixes FGAP user filtering so parent-group permissions apply to descendant-group members.

Changes:

  • Expands allowed and denied groups to descendant IDs.
  • Adds a batched child-group query.
  • Adds search, count, and direct-read denial regression coverage.

Reviewed changes

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

File Description
JpaUserPartialEvaluationProvider.java Expands group authorization filters to descendants.
GroupEntity.java Adds the child-group lookup query.
UserResourceTypeFilteringTest.java Tests denial inherited from a parent group.
Comments suppressed due to low confidence (1)

model/jpa/src/main/java/org/keycloak/models/jpa/JpaUserPartialEvaluationProvider.java:187

  • This traversal only reads GroupEntity, so it misses descendants supplied by a GroupStorageProvider. Local JPA users can persist memberships to arbitrary provider group IDs, while direct authorization walks GroupModel.getParent(); consequently, denying an external parent still leaves members of its external child visible to search/count. Please traverse the provider-backed group hierarchy as well and cover that case.
            List<String> children = em.createNamedQuery("getChildGroupIdsByParentIds", String.class)
                    .setParameter("realm", realmId)
                    .setParameter("parentIds", currentLevel)
                    .getResultList();

}

return cb.exists(createUserMembershipSubquery(context, root -> root.get("groupId").in(allowedGroups)));
return cb.exists(createUserMembershipSubquery(context, root -> root.get("groupId").in(expandGroupsToDescendants(allowedGroups))));
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.

User partial filters ignore ancestor group membership denies

2 participants