Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Test configuration
run: npm test

- name: Verify Workspace SSO GitHub IDs
- name: Verify GitHub IDs
env:
GH_TOKEN: ${{ github.token }}
run: npm run check-github-ids
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,13 @@ People sign in to their `@modelcontextprotocol.io` account with GitHub. Cloudfla

In a reviewed pull request, change their entry in [`users.ts`](src/config/users.ts):

1. Confirm their numeric GitHub ID with them and set `githubUserId`. CI checks that it matches their login.
1. Confirm their numeric GitHub ID with them and set `githubUserId`. CI checks every recorded GitHub ID against its configured login.
2. Add `ROLE_IDS.WORKSPACE_SSO` to their `memberOf`. They also need a role that gives them a Workspace account.

The deploy moves their account into the `/Model Context Protocol/GitHub SSO` organizational unit, including accounts marked `existingGWSUser`. If an admin moves it out by hand, the next deploy moves it back. A refresh does too. Removing the role returns the account to the unit it came from.

If a person has multiple GitHub accounts, keep a separate roster entry and numeric ID for each login. Put the Workspace email prefix and the SSO role on the one entry the person uses to sign in. The other entries retain their own GitHub roles. For example, `localden` signs in to `den@modelcontextprotocol.io`; `dend` has its own GitHub ID and team memberships. To switch sign-in accounts, move the Workspace identity and SSO role together in one reviewed change and check the Google group memberships in the preview.

> [!CAUTION]
> Keep Workspace admin accounts out of this unit.

Expand Down
8 changes: 4 additions & 4 deletions scripts/check-github-ids.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* Live check (needs `gh` auth): each Workspace SSO member's numeric githubUserId
* Live check (needs `gh` auth): each recorded 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))) {
for (const m of MEMBERS) {
if (m.githubUserId === undefined) continue;
const login = execFileSync('gh', ['api', `/user/${m.githubUserId}`, '--jq', '.login'], {
encoding: 'utf8',
}).trim();
Expand All @@ -18,4 +18,4 @@ for (const m of MEMBERS.filter((member) => member.memberOf.includes(ROLE_IDS.WOR
}
}
if (failed) process.exit(1);
console.log('All Workspace SSO GitHub IDs match their logins.');
console.log('All recorded GitHub IDs match their logins.');
11 changes: 11 additions & 0 deletions scripts/test-workspace-sso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ test('the pilot team requires a GitHub identity and a current provisioning role'
assert.throws(() => getWorkspaceSsoTable([pilot, { ...pilot, googleEmailPrefix: 'cat' }]));
});

test('only the designated GitHub login can sign in to a shared Workspace identity', async () => {
const secondary: Member = { github: 'octo-work', githubUserId: 84, memberOf: [ROLE_IDS.GO_SDK] };
const transform = jsonata(buildNameIdTransform(getWorkspaceSsoTable([pilot, secondary])));
const claims = { ...identity, email };
assert.equal(await transform.evaluate({ ...claims, id: pilot.githubUserId }), email);
assert.equal(
await transform.evaluate({ ...claims, id: secondary.githubUserId }),
UNMAPPED_NAME_ID
);
});

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);
Expand Down
Loading
Loading