Skip to content

feat: add grant groups command for Entra ID group membership elevation - #19

Merged
aaearon merged 9 commits into
mainfrom
feat/entra-groups-poc
Feb 19, 2026
Merged

feat: add grant groups command for Entra ID group membership elevation#19
aaearon merged 9 commits into
mainfrom
feat/entra-groups-poc

Conversation

@aaearon

@aaearon aaearon commented Feb 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds grant groups command for requesting temporary Entra ID group membership via SCA, supporting interactive, direct (--group), and favorite (--favorite) modes
  • Extends favorites system with --type groups support so group favorites can be saved and recalled via grant groups --favorite <name> or redirected from grant --favorite
  • Adds session model support for group sessions (SessionTarget, IsGroupSession()) with separate display in grant status and proper handling in grant revoke
  • Wires new SCA API endpoints (/eligibility/groups, /elevate/groups) through SCAAccessService

Test plan

  • go test ./... — full suite passes (cmd, config, sca, sca/models, ui)
  • Table-driven tests for all three grant groups modes (interactive, direct, favorite)
  • Favorite DirectoryID filtering verified — correct group selected when duplicate names exist across directories
  • grant status resolves directory names for group sessions via buildDirectoryNameMap
  • grant revoke handles group sessions (existing tests extended)
  • Favorites add/list with --type groups tested
  • Group selector UI functions tested (format, build options, find by display, duplicate collisions)
  • SCA service groups elevation/eligibility tested with httptest.NewServer
  • Manual integration testing with live SCA environment

Live API exploration revealed the POST /api/access/elevate/groups
response IS wrapped in a "response" key (contrary to initial spec).
Also documents group session shape from GET /api/access/sessions
including the target field with type "groups".
Add Target field to SessionInfo for distinguishing group sessions from
cloud sessions. Group sessions have target.type "groups" with target.id
containing the group UUID.
Group sessions are now shown under a "Groups sessions:" header
instead of being mixed with cloud sessions. FormatSessionOption
uses IsGroupSession() to format them as "Group: <id> in <dir>".
Add group favorite support to config with backward compatibility.
Legacy configs without type field default to "cloud" via
ResolvedType(). New fields use omitempty for clean YAML output.
Add test cases confirming revoke works with group sessions in direct,
--all, and interactive modes. No code changes needed — revoke is
session-type agnostic by design.
favorites add now supports --type groups with --group flag for direct
mode and interactive group selection. favorites list shows group
favorites as "name: groups/group-name". Flag validation prevents
mixing cloud and group flags.
When the root command's --favorite resolves to a groups-type favorite,
return a helpful error directing to 'grant groups --favorite <name>'.
Implements Entra ID group membership elevation via three modes:
interactive selection, direct (--group), and favorite (--favorite).
Includes models, service methods, UI selector, interfaces, mocks,
and comprehensive tests for all modes.
- Verify favorite DirectoryID during group matching to prevent
  wrong-group elevation across directories
- Sort groups copy in SelectGroup so display-collision lookups
  search the same ordered slice the user sees
- Resolve directory names for group sessions in grant status
- Remove SilenceErrors/SilenceUsage from groups subcommand
- Consolidate test constructors into single NewGroupsCommandWithDeps
- Guard buildDirectoryNameMap against nil eligibility response
@aaearon
aaearon merged commit ee50f80 into main Feb 19, 2026
1 check passed
@aaearon
aaearon deleted the feat/entra-groups-poc branch February 19, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant