From 1c778fe779d14692faf7281bcd26ae6b7dc1edaf Mon Sep 17 00:00:00 2001 From: Sambhav Kothari Date: Sun, 29 Nov 2026 03:02:26 +0000 Subject: [PATCH] Pilot GitHub sign-in for Google Workspace through Cloudflare Access Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 8 ++++ README.md | 13 +++++- package-lock.json | 11 +++++ package.json | 4 +- scripts/check-github-ids.ts | 21 +++++++++ scripts/test-workspace-sso.ts | 87 +++++++++++++++++++++++++++++++++++ scripts/validate-config.ts | 9 ++++ src/cloudflare.ts | 56 ++++++++++++++++++++++ src/config/roleIds.ts | 1 + src/config/roles.ts | 5 ++ src/config/users.ts | 2 + src/config/utils.ts | 16 +++++++ src/config/workspaceSso.ts | 74 +++++++++++++++++++++++++++++ src/google.ts | 13 +----- 14 files changed, 307 insertions(+), 13 deletions(-) create mode 100644 scripts/check-github-ids.ts create mode 100644 scripts/test-workspace-sso.ts create mode 100644 src/config/workspaceSso.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65ea36ea..9ce2afd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,5 +47,13 @@ jobs: - name: Validate config run: npm run validate + - name: Test configuration + run: npm test + + - name: Verify Workspace SSO GitHub IDs + env: + GH_TOKEN: ${{ github.token }} + run: npm run check-github-ids + - name: Check formatting run: npm run format:check diff --git a/README.md b/README.md index d0255af7..f473d431 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Infrastructure as Code for managing access to MCP community resources using Pulu - **Google Workspace Groups**: Automatically syncs group memberships for @modelcontextprotocol.io email accounts - **Email Groups**: Groups with `isEmailGroup: true` accept emails from anyone (including external users) and notify all members. External posts are moderated for security. - **Google Workspace User Accounts**: Provisions @modelcontextprotocol.io accounts for members of roles with `provisionUser: true` (directly, or via a role nested under one through `github.parent` — e.g. SDK teams under `sdk-maintainers`, working groups under `working-groups`) +- **GitHub sign-in for Google Workspace**: Cloudflare Access is the SAML identity provider for Google Workspace, so allowlisted maintainers sign in to their `@modelcontextprotocol.io` account with GitHub. The allowlist and account mapping come from [`src/config/workspaceSso.ts`](src/config/workspaceSso.ts) and `users.ts`. See [GitHub sign-in for Google Workspace](#github-sign-in-for-google-workspace) below. - **Discord**: Syncs the Discord roles declared in [`src/config/roles.ts`](src/config/roles.ts) to the members' Discord IDs in `users.ts`, and manages the settings of the channels declared in [`src/config/channels.ts`](src/config/channels.ts), including thread-only forum/media channels. See [Discord channels](#discord-channels) below. - **Cloudflare Access (security-room)**: Syncs the Cloudflare Zero Trust Access policy that decides who can sign in to `securityroom.modelcontextprotocol.io` from the roles declared in [`src/config/accessPolicies.ts`](src/config/accessPolicies.ts). See [Cloudflare Access (security-room)](#cloudflare-access-security-room) below. - **npm & PyPI Package Publishing Access** (declared, not applied): Expected registry access is declared in [`src/config/packageAccess.ts`](src/config/packageAccess.ts) and drift against the live npm registry is detected by CI — but changes are applied manually by a maintainer. See [npm & PyPI Package Publishing Access](#npm--pypi-package-publishing-access) below for why and how. @@ -127,6 +128,16 @@ Channels listed in [`src/config/channels.ts`](src/config/channels.ts) are manage - With `cloudflare:importExistingPolicies: "true"` in `Pulumi.prod.yaml`, the first deploy imports the existing `Maintainers` policy (by its `cloudflarePolicyId`) as-is, ignoring its rule lists. - Then set the flag to `"false"` in a follow-up PR; its preview shows exactly the include-rule changes that the next deploy applies. Leave the flag off from then on. +## GitHub sign-in for Google Workspace + +Cloudflare Access acts as the SAML identity provider for Google Workspace. The `workspace-sso` GitHub team's direct membership and the numeric GitHub ID → Workspace email mapping both come from `users.ts`. To enable someone, confirm their `githubUserId` and add `ROLE_IDS.WORKSPACE_SSO` in a reviewed PR. They also need a current Google provisioning role. CI verifies each enabled ID against the configured GitHub login. + +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. + +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. + +**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. + ## npm & PyPI Package Publishing Access Publishing access to the `modelcontextprotocol` npm organization and to the MCP PyPI projects is **config-as-code with human-applied changes** — deliberately outside the Pulumi resource graph: @@ -233,7 +244,7 @@ The following secrets must be configured in GitHub Actions for automated deploym - Keep this secure - if lost, you cannot decrypt your Pulumi state - **`CLOUDFLARE_ROLE_MANAGEMENT_TOKEN`** (optional, `production` and `preview` environments): Cloudflare token dedicated to Access policy role management, scoped only to **Account → Access: Apps and Policies → Edit** on the MCP Domain Account (not a general-purpose API token) - - Used to manage the Cloudflare Access policy for `securityroom.modelcontextprotocol.io` (see [Cloudflare Access (security-room)](#cloudflare-access-security-room)) + - Used to manage the Cloudflare Access policy for `securityroom.modelcontextprotocol.io` (see [Cloudflare Access (security-room)](#cloudflare-access-security-room)) and the Google Workspace sign-in application (see [GitHub sign-in for Google Workspace](#github-sign-in-for-google-workspace)) ## Initial Setup diff --git a/package-lock.json b/package-lock.json index 291fae3d..b808d201 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ }, "devDependencies": { "@types/node": "^22.18.6", + "jsonata": "^2.2.1", "prettier": "^3.7.2", "ts-node": "^10.9.2", "typescript": "^5.9.2" @@ -1142,6 +1143,16 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsonata": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/jsonata/-/jsonata-2.3.0.tgz", + "integrity": "sha512-M2oCpvM32+f70iXmunUmrkASEfSuLkcr/CIZ2VTUOw4+ONSD7Pm9ecw8rocRlX2f/ev/sGgPLjInCZFop7Lhng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, "node_modules/lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", diff --git a/package.json b/package.json index f65c58b7..39350d30 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "build": "tsc", "validate": "npx ts-node scripts/validate-config.ts", - "test": "npx ts-node scripts/test-config.ts", + "test": "npx ts-node scripts/test-config.ts && npx ts-node scripts/test-workspace-sso.ts", + "check-github-ids": "npx ts-node scripts/check-github-ids.ts", "check-package-drift": "npx ts-node scripts/check-package-drift.ts", "check": "npm run format:check && npm run validate && npm run test", "format": "prettier --write .", @@ -22,6 +23,7 @@ }, "devDependencies": { "@types/node": "^22.18.6", + "jsonata": "^2.2.1", "prettier": "^3.7.2", "ts-node": "^10.9.2", "typescript": "^5.9.2" diff --git a/scripts/check-github-ids.ts b/scripts/check-github-ids.ts new file mode 100644 index 00000000..8f5c977e --- /dev/null +++ b/scripts/check-github-ids.ts @@ -0,0 +1,21 @@ +/** + * Live check (needs `gh` auth): each Workspace SSO member's numeric githubUserId + * resolves to their configured GitHub login, so a typo can't map someone else's + * GitHub account to a Workspace mailbox. + */ +import { execFileSync } from 'node:child_process'; +import { ROLE_IDS } from '../src/config/roleIds'; +import { MEMBERS } from '../src/config/users'; + +let failed = false; +for (const m of MEMBERS.filter((member) => member.memberOf.includes(ROLE_IDS.WORKSPACE_SSO))) { + const login = execFileSync('gh', ['api', `/user/${m.githubUserId}`, '--jq', '.login'], { + encoding: 'utf8', + }).trim(); + if (login.toLowerCase() !== m.github?.toLowerCase()) { + console.error(`ERROR: GitHub user ID ${m.githubUserId} resolves to ${login}, not ${m.github}`); + failed = true; + } +} +if (failed) process.exit(1); +console.log('All Workspace SSO GitHub IDs match their logins.'); diff --git a/scripts/test-workspace-sso.ts b/scripts/test-workspace-sso.ts new file mode 100644 index 00000000..7d8c7c2a --- /dev/null +++ b/scripts/test-workspace-sso.ts @@ -0,0 +1,87 @@ +import assert from 'node:assert/strict'; +import { test } from 'node:test'; +import jsonata from 'jsonata'; +import { ROLE_IDS } from '../src/config/roleIds'; +import type { Member } from '../src/config/utils'; +import { + buildNameIdTransform, + getWorkspaceSsoTable, + googleSamlProfile, + SAML_ATTRIBUTE_TRANSFORM, + UNMAPPED_NAME_ID, +} from '../src/config/workspaceSso'; + +const pilot: Member = { + github: 'octo', + githubUserId: 42, + firstName: 'Octo', + lastName: 'Cat', + googleEmailPrefix: 'octo', + memberOf: [ROLE_IDS.WORKSPACE_SSO, ROLE_IDS.GO_SDK], +}; +const email = 'octo@modelcontextprotocol.io'; +// Shape of the input Cloudflare passes to the NameID transform, captured from a live assertion. +const identity = { + id: 42, + name: 'Octo Cat', + email: 'octo@example.com', + groups: [{ id: 1, name: 'modelcontextprotocol', teams: [{ name: 'maintainers' }] }], +}; + +test('the pilot team requires a GitHub identity and a current provisioning role', () => { + assert.deepEqual(getWorkspaceSsoTable([pilot, { ...pilot, memberOf: [] }]), { 42: email }); + for (const change of [ + { github: undefined }, + { githubUserId: undefined }, + { githubUserId: -1 }, + { googleEmailPrefix: 'x@evil.com' }, + { googleEmailPrefix: undefined }, + { firstName: undefined }, + { existingGWSUser: true, memberOf: [ROLE_IDS.WORKSPACE_SSO] }, + { skipGoogleUserProvisioning: true }, + ]) + assert.throws(() => getWorkspaceSsoTable([{ ...pilot, ...change }])); + assert.throws(() => getWorkspaceSsoTable([pilot, { ...pilot, googleEmailPrefix: 'cat' }])); +}); + +test('NameID uses the numeric ID and org', async () => { + const transform = jsonata(buildNameIdTransform({ 42: email })); + for (const id of [42, '42']) assert.equal(await transform.evaluate({ ...identity, id }), email); + for (const change of [ + { id: 43 }, + { id: undefined }, + { id: [42] }, + { id: '__proto__' }, + { groups: undefined }, + { groups: [{ name: 'other' }] }, + ]) + assert.equal(await transform.evaluate({ ...identity, ...change }), UNMAPPED_NAME_ID); + assert.equal(await jsonata(buildNameIdTransform({})).evaluate(identity), UNMAPPED_NAME_ID); +}); + +test('Google requires both profile values after inert bootstrap', () => { + const issuer = 'https://accounts.google.com/samlrp/metadata?rpid=example'; + const acs = 'https://accounts.google.com/samlrp/example/acs'; + assert.deepEqual(googleSamlProfile(), { + spEntityId: 'https://access.invalid/sp', + consumerServiceUrl: 'https://access.invalid/acs', + }); + assert.deepEqual(googleSamlProfile(issuer, acs), { spEntityId: issuer, consumerServiceUrl: acs }); + for (const id of [undefined, '', 'google.com', 'google.com/a/example.org']) + assert.throws(() => googleSamlProfile(id, acs)); + for (const url of [ + undefined, + 'https://accounts.google.com/a/example.org/acs', + 'https://www.google.com/a/example.org/acs', + ]) + assert.throws(() => googleSamlProfile(issuer, url)); +}); + +test('the attribute transform sends one constant attribute', async () => { + assert.deepEqual( + { ...(await jsonata(SAML_ATTRIBUTE_TRANSFORM).evaluate(identity)) }, + { + source: 'cloudflare-access', + } + ); +}); diff --git a/scripts/validate-config.ts b/scripts/validate-config.ts index e75ccad6..bbe9bb24 100644 --- a/scripts/validate-config.ts +++ b/scripts/validate-config.ts @@ -19,6 +19,7 @@ import { DISCORD_CHANNELS, validateDiscordChannels } from '../src/config/channel import { getDiscordRolePermissionErrors } from '../src/config/discordPermissions'; import { hasProvisionUserRole, resolveGoogleMemberEmail } from '../src/config/utils'; import type { RoleId } from '../src/config/roleIds'; +import { getWorkspaceSsoTable } from '../src/config/workspaceSso'; const roleLookup = buildRoleLookup(); @@ -445,6 +446,14 @@ for (const role of ROLES) { } } +console.log('Validating Workspace SSO members...'); +try { + getWorkspaceSsoTable(); +} catch (e) { + console.error(`ERROR: ${(e as Error).message}`); + hasErrors = true; +} + if (hasErrors) { console.error('\nValidation failed! Please fix the errors above.'); process.exit(1); diff --git a/src/cloudflare.ts b/src/cloudflare.ts index 08c4c64e..57771ee1 100644 --- a/src/cloudflare.ts +++ b/src/cloudflare.ts @@ -1,6 +1,14 @@ import * as pulumi from '@pulumi/pulumi'; import * as cloudflare from '@pulumi/cloudflare'; import { ACCESS_POLICIES, GITHUB_ORG, getAccessPolicyTeams } from './config/accessPolicies'; +import { githubTeams } from './github'; +import { ROLE_IDS } from './config/roleIds'; +import { + buildNameIdTransform, + getWorkspaceSsoTable, + googleSamlProfile, + SAML_ATTRIBUTE_TRANSFORM, +} from './config/workspaceSso'; const config = new pulumi.Config('cloudflare'); // Cloudflare integration is optional - only enabled if roleManagementToken is configured, @@ -65,6 +73,54 @@ if (CLOUDFLARE_ENABLED) { } ); }); + + // GitHub sign-in for Google Workspace: Access is the SAML IdP for Google's SSO + // profile. Workspace SSO team only, GitHub only; the NameID transform picks the account. + const workspaceSsoPolicy = new cloudflare.ZeroTrustAccessPolicy( + 'access-policy-workspace-sso', + { + accountId, + name: 'Google Workspace sign-in', + decision: 'allow', + sessionDuration: '1h', + includes: [ + { + githubOrganization: { + identityProviderId: githubIdentityProviderId, + name: GITHUB_ORG, + team: githubTeams[ROLE_IDS.WORKSPACE_SSO].slug, + }, + }, + ], + // allowedIdps only limits which providers the login page offers; require the + // session itself to come from GitHub (e.g. not a one-time PIN from another app). + requires: [{ loginMethod: { id: githubIdentityProviderId } }], + }, + { provider, ignoreChanges: ['connectionRules'] } + ); + new cloudflare.ZeroTrustAccessApplication( + 'access-app-workspace-sso', + { + accountId, + name: 'Google Workspace', + type: 'saas', + allowedIdps: [githubIdentityProviderId], + allowAuthenticateViaWarp: false, + autoRedirectToIdentity: true, + appLauncherVisible: false, + sessionDuration: '1h', + policies: [{ id: workspaceSsoPolicy.id, precedence: 1 }], + saasApp: { + authType: 'saml', + ...googleSamlProfile(config.get('googleSamlEntityId'), config.get('googleSamlAcsUrl')), + nameIdFormat: 'email', + samlAttributeTransformJsonata: SAML_ATTRIBUTE_TRANSFORM, + // The policy's login-method rule enforces GitHub; the transform input has no IdP field. + nameIdTransformJsonata: buildNameIdTransform(getWorkspaceSsoTable()), + }, + }, + { provider } + ); } export const cloudflareAccessPolicyIds = Object.fromEntries( diff --git a/src/config/roleIds.ts b/src/config/roleIds.ts index 0be8ace9..12d98924 100644 --- a/src/config/roleIds.ts +++ b/src/config/roleIds.ts @@ -13,6 +13,7 @@ export const ROLE_IDS = { MODERATORS: 'moderators', SECURITY_MANAGERS: 'security-managers', // GitHub (org security_manager role) and the security@ email group SECURITY_TEAM: 'security-team', // GitHub only (MCP Security Team; Cloudflare Access to securityroom.modelcontextprotocol.io) + WORKSPACE_SSO: 'workspace-sso', ADMINISTRATORS: 'administrators', // Discord only COMMUNITY_MANAGERS: 'community-managers', // Discord only RELEASE_MANAGERS: 'release-managers', // Discord only diff --git a/src/config/roles.ts b/src/config/roles.ts index ecf7f3cf..4cd53ed2 100644 --- a/src/config/roles.ts +++ b/src/config/roles.ts @@ -82,6 +82,11 @@ export const ROLES: readonly Role[] = [ github: { team: 'steering-committee' }, // No discord - this is a GitHub-only organizational container }, + { + id: ROLE_IDS.WORKSPACE_SSO, + description: 'Members enabled for Google Workspace SAML sign-in', + github: { team: ROLE_IDS.WORKSPACE_SSO }, + }, { id: ROLE_IDS.ADMINISTRATORS, description: 'Discord server administrators', diff --git a/src/config/users.ts b/src/config/users.ts index d9f72381..9bf32185 100644 --- a/src/config/users.ts +++ b/src/config/users.ts @@ -980,12 +980,14 @@ export const MEMBERS: readonly Member[] = [ }, { github: 'sambhav', + githubUserId: 16130816, email: 'sambhavs.email@gmail.com', firstName: 'Sambhav', lastName: 'Kothari', googleEmailPrefix: 'sambhav', discord: '840109459212206090', memberOf: [ + ROLE_IDS.WORKSPACE_SSO, ROLE_IDS.MAINTAINERS, ROLE_IDS.FILESYSTEMS_WG, ROLE_IDS.FILESYSTEMS_WG_LEADS, diff --git a/src/config/utils.ts b/src/config/utils.ts index 41784273..24935659 100644 --- a/src/config/utils.ts +++ b/src/config/utils.ts @@ -9,6 +9,8 @@ import type { Role } from './roles'; export interface Member { /** GitHub username */ github?: string; + /** Numeric GitHub user ID, confirmed with the member (required for the workspace-sso team) */ + githubUserId?: number; /** Email address (for Google Workspace) */ email?: string; /** Discord user ID (snowflake) */ @@ -54,6 +56,20 @@ export function resolveGoogleMemberEmail(member: Member): string | undefined { : member.email; } +/** + * Whether src/google.ts provisions (or, for existingGWSUser, would provision) a + * Google Workspace account for this member. + */ +export function isProvisionedGoogleUser(member: Member, roleLookup: Map): boolean { + return ( + !!member.firstName && + !!member.lastName && + !!member.googleEmailPrefix && + !member.skipGoogleUserProvisioning && + hasProvisionUserRole(member.memberOf, roleLookup) + ); +} + /** * Whether a member with the given roles is eligible for a Google Workspace * user account. A member qualifies when any of their roles — or any role diff --git a/src/config/workspaceSso.ts b/src/config/workspaceSso.ts new file mode 100644 index 00000000..8a202cb5 --- /dev/null +++ b/src/config/workspaceSso.ts @@ -0,0 +1,74 @@ +// GitHub sign-in for Google Workspace via a Cloudflare Access SAML app (src/cloudflare.ts). +// See README "GitHub sign-in for Google Workspace". +import { GITHUB_ORG } from './accessPolicies'; +import { ROLE_IDS } from './roleIds'; +import { buildRoleLookup } from './roles'; +import { MEMBERS } from './users'; +import { isProvisionedGoogleUser, resolveGoogleMemberEmail, type Member } from './utils'; + +/** NameID for anyone not mapped; `.invalid` (RFC 2606) is never a Workspace account. */ +export const UNMAPPED_NAME_ID = 'unmapped@access.invalid'; + +/** + * Replaces Access's default attributes (every GitHub group, which can exceed Google's + * 2 kB limit). Google uses the NameID alone, but the SAML schema requires an + * AttributeStatement to hold at least one attribute, so send one constant. + */ +export const SAML_ATTRIBUTE_TRANSFORM = '{"source": "cloudflare-access"}'; + +/** `githubUserId -> Workspace email` for members of the Workspace SSO team; throws on bad config. */ +export function getWorkspaceSsoTable(members: readonly Member[] = MEMBERS): Record { + const table: Record = {}; + const roles = buildRoleLookup(); + for (const m of members.filter((m) => m.memberOf.includes(ROLE_IDS.WORKSPACE_SSO))) { + const who = `Workspace SSO: "${m.github ?? m.googleEmailPrefix}"`; + if (!m.github || !isProvisionedGoogleUser(m, roles)) { + throw new Error(`${who} needs a GitHub login and a provisioned Google account`); + } + const id = m.githubUserId ?? 0; + if (!Number.isSafeInteger(id) || id <= 0 || String(id) in table) { + throw new Error(`${who} needs a unique positive githubUserId`); + } + if (!/^[a-z0-9][a-z0-9._-]*$/.test(m.googleEmailPrefix!)) { + throw new Error(`${who} has an invalid googleEmailPrefix`); + } + table[String(id)] = resolveGoogleMemberEmail(m)!; + } + return table; +} + +/** + * JSONata NameID transform. Cloudflare evaluates it against `{id, name, email, groups}` + * only: `id` is the numeric GitHub user ID and `groups[].name` the GitHub orgs. The + * input has no `idp` field (verified live), so the Access policy's login-method rule enforces GitHub. + * Unmapped inputs evaluate to UNMAPPED_NAME_ID. Literals are JSON-encoded, so config can't inject JSONata. + */ +export function buildNameIdTransform(table: Record): string { + return `( + $allowed := ${JSON.stringify(GITHUB_ORG)} in groups.name and $type(id) in ["number", "string"]; + $email := $allowed ? $lookup(${JSON.stringify(table)}, $string(id)); + $type($email) = "string" ? $email : ${JSON.stringify(UNMAPPED_NAME_ID)} +)`; +} + +/** Bootstrap without a Google destination until the modern profile supplies both SP values. */ +export function googleSamlProfile(spEntityId?: string, consumerServiceUrl?: string) { + if (spEntityId === undefined && consumerServiceUrl === undefined) { + return { + spEntityId: 'https://access.invalid/sp', + consumerServiceUrl: 'https://access.invalid/acs', + }; + } + const entityId = spEntityId?.trim(); + const acs = consumerServiceUrl && new URL(consumerServiceUrl); + if ( + !entityId || + /^google\.com(?:\/|$)/i.test(entityId) || + !acs || + acs.origin !== 'https://accounts.google.com' || + !acs.pathname.startsWith('/samlrp/') + ) { + throw new Error('Set both SP values from the modern Google SAML profile in the Admin console'); + } + return { spEntityId, consumerServiceUrl: acs.href }; +} diff --git a/src/google.ts b/src/google.ts index 3bee1cc3..318e576f 100644 --- a/src/google.ts +++ b/src/google.ts @@ -5,7 +5,7 @@ import * as random from '@pulumi/random'; import { ROLES, type Role, buildRoleLookup } from './config/roles'; import { MEMBERS } from './config/users'; import type { RoleId } from './config/roleIds'; -import { hasProvisionUserRole, resolveGoogleMemberEmail } from './config/utils'; +import { isProvisionedGoogleUser, resolveGoogleMemberEmail } from './config/utils'; const roleLookup = buildRoleLookup(); // Groups keyed by Google group name @@ -78,16 +78,7 @@ const provisionedUsersByEmail: Record = {}; const newUserPasswords: Record> = {}; MEMBERS.forEach((member) => { - if ( - !member.firstName || - !member.lastName || - !member.googleEmailPrefix || - member.skipGoogleUserProvisioning - ) - return; - - const needsUser = hasProvisionUserRole(member.memberOf, roleLookup); - if (!needsUser) return; + if (!isProvisionedGoogleUser(member, roleLookup)) return; const primaryEmail = `${member.googleEmailPrefix}@modelcontextprotocol.io`;