Skip to content

Move Workspace SSO members in and out of the GitHub SSO OU - #270

Merged
dend merged 2 commits into
mainfrom
sso-ou-membership
Dec 1, 2026
Merged

dend merged 2 commits into
mainfrom
sso-ou-membership

Conversation

@dend

@dend dend commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes OU membership follow the Workspace SSO role in both directions, for every member.

  • Adding the role moves the member's account into /Model Context Protocol/GitHub SSO. This now includes existingGWSUser accounts, which the googleworkspace provider doesn't manage and which had to be moved by hand.
  • Removing the role moves the account back to the OU it was in before. Until now it stayed in the SSO OU and couldn't sign in until an admin moved it.
  • If an admin moves a member's account out of the OU by hand, the next deploy moves it back in.

How

A new dynamic resource, WorkspaceUserOrgUnit, exists for each member with the role. It calls the Admin SDK Directory API with the service account key the googleworkspace provider already uses (googleworkspace:credentials), with the admin.directory.user scope.

  • Create: records the account's current OU, then moves it into the SSO OU. If the account is already there, it records /Model Context Protocol as the OU to restore to.
  • Delete: moves the account back to the recorded OU, unless the account is gone or an admin has already moved it elsewhere.

gworkspace.User goes back to ignoring orgUnitPath for everyone, so there is one place that moves accounts.

Effect on deploy

  • Creates gws-user-ou-sambhav and gws-user-ou-den. sambhav@ is already in the OU, so nothing moves. den@ is moved into it unless it's already there.
  • No change expected on gws-user-sambhav.

Not verified

The calls to Google haven't been run against the real API. If the service account can't get a token for the admin.directory.user scope without impersonation, or lacks permission to update users, the deploy fails on the two new resources and nothing is moved.

Verification

  • New tests cover the service account assertion and the move/restore logic against a fake Directory API.
  • The provider serializes with pulumi.runtime.serializeFunction, and the serialized copy runs a create and a delete against the fake API.
  • npm run validate, npm test and Prettier pass locally. Typecheck runs in CI.

Adding the Workspace SSO role moves the member's account into the GitHub SSO OU, including existingGWSUser accounts the googleworkspace provider doesn't manage. Removing the role moves the account back to the OU it came from.
@dend
dend requested a review from a team as a code owner December 1, 2026 02:01
@dend
dend deployed to preview December 1, 2026 02:01 — with GitHub Actions Active
Comment thread scripts/test-workspace-sso.ts Fixed
@dend
dend deployed to preview December 1, 2026 02:03 — with GitHub Actions Active
@dend
dend merged commit 24655d8 into main Dec 1, 2026
5 checks passed
@dend
dend deleted the sso-ou-membership branch December 1, 2026 02:06

This branch was successfully deployed

1 active deployment
preview — f81ed158 Deployed Dec 1, 2026 by dend via Preview Changes #475
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.

2 participants