Fix grant source for group-based vs direct app assignments#162
Fix grant source for group-based vs direct app assignments#162c1-dev-bot[bot] wants to merge 1 commit into
Conversation
Group-to-app grants now include a GrantExpandable annotation pointing to the group's membership entitlement, enabling the SDK expansion algorithm to create user-level grants with correct source tracking. Direct user-to-app grants now filter out users whose Scope is "GROUP" (assigned through a group), since those users will receive properly attributed grants via the expansion mechanism instead. This follows the same pattern used for role group grants in role.go. Fixes: CXH-1394
|
Claude finished @c1-dev-bot[bot]'s task in 1m 30s —— View job PR Review: Fix grant source for group-based vs direct app assignments
Overall: This PR looks correct and follows the established pattern. The changes are small, focused, and address the root cause described in the PR body. Two minor observations below. What's good
Minor observations
VerdictApprove-worthy. The implementation is clean, follows established patterns, and the two-pronged approach (expandable annotation + scope filter) is the correct way to fix grant source attribution. The test plan in the PR body covers the right scenarios. |
Summary
GrantExpandableannotation to group→app grants so the SDK expansion creates user-level grants with correct source tracking (pointing back to the originating group membership)listAppUsersGrants()to skip users withScope == "GROUP", since those users will receive properly attributed grants via the expansion mechanismrole.go(roleGroupGrant)Root Cause
The Okta connector was emitting all app user grants as direct grants regardless of whether the user was assigned directly or through a group. The Okta
AppUser.Scopefield (USERvsGROUP) was not being used to differentiate, and group→app grants lacked theGrantExpandableannotation needed for the SDK to properly track grant sources through permission hierarchy expansion.Changes
pkg/connector/app.go:listAppGroupGrants(): AddedGrantExpandableannotation withEntitlementIdspointing togroup:{groupID}:memberandShallow: true, matching the role grant expansion patternlistAppUsersGrants(): Added filter to skip app users withScope == "GROUP"— these users get their grants through the expansion mechanism with proper source attributionTest plan
Fixes: CXH-1394
Automated PR Notice
This PR was automatically created by c1-dev-bot as a potential implementation.
This code requires: