Skip to content

Commit 8ad58ef

Browse files
sambhavclaude
andauthored
Move Workspace SSO members into the GitHub SSO OU (#267)
* Manage the Workspace SSO organizational unit Create Model Context Protocol/Workspace SSO and keep Pulumi-managed members with the Workspace SSO role in it, so the Google SAML profile can be assigned to one OU. Other users' OU stays with admins. Members with existingGWSUser are not managed, so the deploy warns to move them by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Name the OU GitHub SSO, matching the one created in the Admin console Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Allow adopting an existing GitHub SSO OU Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Let the Workspace admin own the GitHub SSO OU Pulumi now only moves Workspace SSO members into the OU by path, so the OU created in the Admin console doesn't need to be imported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9016b96 commit 8ad58ef

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ Cloudflare Access acts as the SAML identity provider for Google Workspace. The `
134134

135135
Use a modern Google Workspace SAML profile and keep legacy SSO disabled. Configure the profile with the Cloudflare Access SSO URL, entity ID and signing certificate. Set `cloudflare:googleSamlEntityId` and `cloudflare:googleSamlAcsUrl` together using the values from that profile. With both values unset, the app uses placeholders under the reserved `.invalid` domain. The Access edit token can change which Workspace identity Cloudflare signs.
136136

137-
For accounts assigned to the profile, confirm that post-SSO verification applies, 2-Step Verification is enforced, and each user is enrolled. Keep Workspace admin accounts outside the assigned organizational unit.
137+
A Workspace admin owns the `/Model Context Protocol/GitHub SSO` organizational unit and assigns the SAML profile to it in the Admin console. Removing the assignment is the rollback. Pulumi moves every Pulumi-managed member with the Workspace SSO role into that OU. Members with `existingGWSUser` aren't managed by Pulumi, so a Workspace admin moves them by hand (the deploy logs a warning). Removing the role doesn't move the account back: Pulumi stops managing its OU, and until an admin moves it out, the account can't sign in.
138+
139+
For accounts in that OU, confirm that post-SSO verification applies, 2-Step Verification is enforced, and each user is enrolled. Keep Workspace admin accounts out of the OU.
138140

139141
**Offboarding:** suspend the Workspace account, reset its sign-in cookies and revoke OAuth grants and app passwords as applicable. Revoke the user's Cloudflare Access sessions, remove the Workspace SSO role in `users.ts`, and deploy. The Access app and policy each use one hour. Cloudflare can reuse stored GitHub membership until the global session expires (check the tenant setting), and Google manages its own sessions.
140142

‎src/google.ts‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as gworkspace from '@pulumi/googleworkspace';
44
import * as random from '@pulumi/random';
55
import { ROLES, type Role, buildRoleLookup } from './config/roles';
66
import { MEMBERS } from './config/users';
7-
import type { RoleId } from './config/roleIds';
7+
import { ROLE_IDS, type RoleId } from './config/roleIds';
88
import { isProvisionedGoogleUser, resolveGoogleMemberEmail } from './config/utils';
99

1010
const roleLookup = buildRoleLookup();
@@ -73,6 +73,11 @@ const mcpOrgUnit = new gworkspace.OrgUnit(
7373
{ ignoreChanges: ['description'] }
7474
);
7575

76+
// Workspace SSO members are moved here. A Workspace admin owns the OU and assigns the
77+
// Google SAML profile to it in the Admin console; removing that assignment is the rollback.
78+
// See README "GitHub sign-in for Google Workspace".
79+
const WORKSPACE_SSO_ORG_UNIT_PATH = '/Model Context Protocol/GitHub SSO';
80+
7681
// Provision Google Workspace user accounts for members in roles with provisionUser
7782
const provisionedUsersByEmail: Record<string, gworkspace.User> = {};
7883
const newUserPasswords: Record<string, pulumi.Output<string>> = {};
@@ -81,8 +86,14 @@ MEMBERS.forEach((member) => {
8186
if (!isProvisionedGoogleUser(member, roleLookup)) return;
8287

8388
const primaryEmail = `${member.googleEmailPrefix}@modelcontextprotocol.io`;
89+
const usesWorkspaceSso = member.memberOf.includes(ROLE_IDS.WORKSPACE_SSO);
8490

8591
if (member.existingGWSUser) {
92+
if (usesWorkspaceSso) {
93+
pulumi.log.warn(
94+
`${primaryEmail} is a Workspace SSO member but not managed by Pulumi; move it to the GitHub SSO OU in the Admin console`
95+
);
96+
}
8697
// Existing GWS users are not managed by Pulumi — the GWS provider's import
8798
// validation rejects empty email types that GWS itself sets on primary/alias
8899
// emails, and there's no way to fix this at the provider level.
@@ -107,7 +118,8 @@ MEMBERS.forEach((member) => {
107118
password: hashedPassword,
108119
hashFunction: 'SHA-1',
109120
changePasswordAtNextLogin: true,
110-
orgUnitPath: mcpOrgUnit.orgUnitPath,
121+
// Workspace SSO members are kept in the SSO OU; other users' OU is left to admins.
122+
orgUnitPath: usesWorkspaceSso ? WORKSPACE_SSO_ORG_UNIT_PATH : mcpOrgUnit.orgUnitPath,
111123
},
112124
{
113125
dependsOn: [mcpOrgUnit],
@@ -117,7 +129,7 @@ MEMBERS.forEach((member) => {
117129
'password',
118130
'hashFunction',
119131
'changePasswordAtNextLogin',
120-
'orgUnitPath',
132+
...(usesWorkspaceSso ? [] : ['orgUnitPath']),
121133
'archived',
122134
'suspended',
123135
'isAdmin',

0 commit comments

Comments
 (0)