Skip to content

Commit ebf61a3

Browse files
PederHPclaude
andcommitted
Merge branch 'main' into servers-least-privilege
Resolve conflicts with #258, which removed the steering-committee grant on servers. Keep it removed instead of re-adding it as triage; the teams listed on servers stay at triage. Update the servers comment and the README inheritance note to match, and keep main's auth-contributors addition. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MqPQYSMU1JmTaeseASXFPL
2 parents eb981ee + 70daac9 commit ebf61a3

12 files changed

Lines changed: 954 additions & 2006 deletions

File tree

‎.github/workflows/preview.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ jobs:
1818
runs-on: ubuntu-latest
1919
# Skip preview for fork PRs and Dependabot - they don't have access to Actions secrets
2020
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
21-
environment: production
21+
# `production` only deploys from main, so it rejects pull request refs.
22+
# `preview` accepts them and holds its own credentials. See README.md
23+
# "Required GitHub Secrets (for CI/CD)".
24+
environment: preview
2225
steps:
2326
- name: Checkout code
2427
uses: actions/checkout@v4

‎README.md‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ The [contributor ladder](https://modelcontextprotocol.io/community/contributor-l
7878

7979
Things to know when reading the config against the ladder:
8080

81-
- **GitHub child teams inherit their parent's repository access.** WG, IG, and SDK teams nest under `steering-committee` (via `working-groups`, `interest-groups`, and `sdk-maintainers`). Their members therefore get `steering-committee`'s grants, which include `triage` on `modelcontextprotocol`, `.github`, `inspector`, `quickstart-resources`, and `servers`, and `push` on the archived `docs` repository. Write access on those repositories comes from the team that owns each one: `inspector-maintainers` on `inspector`, `reference-servers-maintainers` on `servers`, and `docs-maintainers` on `quickstart-resources`. This is independent of ladder rank. Roles that must not inherit these grants (`members`, `maintainers`, `security-team`) have no parent.
82-
- **Some roles have no ladder counterpart.** These are functional or operational roles: `security-managers`, `security-team`, CODEOWNERS teams (`*-auth`, `conformance-auth`), collaborator teams (`registry-collaborators`, `typescript-sdk-collaborators`), `csharp-sdk-admin`, Discord-only `administrators` and `community-managers`, and Google email groups.
81+
- **GitHub child teams inherit their parent's repository access.** WG, IG, and SDK teams nest under `steering-committee` (via `working-groups`, `interest-groups`, and `sdk-maintainers`). Their members therefore get `steering-committee`'s grants, which include `triage` on `modelcontextprotocol`, `.github`, `inspector`, and `quickstart-resources`, and `push` on the archived `docs` repository. `steering-committee` deliberately has no grant on `servers`, so the teams listed there each have their own `triage` grant. Write access on `inspector`, `servers`, and `quickstart-resources` comes from the team that owns each one: `inspector-maintainers` on `inspector`, `reference-servers-maintainers` on `servers`, and `docs-maintainers` on `quickstart-resources`. This is independent of ladder rank. Roles that must not inherit these grants (`members`, `maintainers`, `security-team`) have no parent.
82+
- **Some roles have no ladder counterpart.** These are functional or operational roles: `security-managers`, `security-team`, CODEOWNERS teams (`*-auth`, `conformance-auth`), collaborator teams (`registry-collaborators`, `typescript-sdk-collaborators`), `auth-contributors` (`push` on `ext-auth` only, no parent team), `csharp-sdk-admin`, Discord-only `administrators` and `community-managers`, and Google email groups.
8383
- **Per-user grants** in `repoAccess.ts` (the `users` lists) are not tied to any ladder role.
8484
- **`security-ig` has `admin` on six repositories** (`docs`, `.github`, `inspector`, `modelcontextprotocol`, `quickstart-resources`, `servers`). This was carried over unchanged from `security-wg` in #170, and reviewing it is tracked as a separate workstream.
8585

@@ -102,7 +102,8 @@ Channels listed in [`src/config/channels.ts`](src/config/channels.ts) are manage
102102
},
103103
```
104104

105-
- **Thread-only channels are a channel type, not a setting.** Discord has no "require threads" switch; thread-only behaviour exists only as `forum` and `media` channels, and the API cannot convert a text channel into one. To make an existing channel thread-only, declare a new `forum`/`media` channel (without `id`) and retire the old channel by hand. Declaring `type: 'forum'` on the `id` of a text channel fails the deploy with an error saying so.
105+
- **Thread-only channels are a channel type or a permission policy, not a setting.** Discord has no "require threads" switch. `forum` and `media` channels are thread-only by type, but the API cannot convert a text channel into one: declaring `type: 'forum'` on the `id` of a text channel fails the deploy with an error saying so. To make an existing text channel thread-only in place, keeping its ID and history, adopt it by `id` and declare `permissionOverwrites` that deny `SEND_MESSAGES` to `DISCORD_EVERYONE_ROLE` and allow `CREATE_PUBLIC_THREADS` and `SEND_MESSAGES_IN_THREADS`; members can then only start threads and reply in them. Add an overwrite allowing `SEND_MESSAGES` for any role that should still post at the top level (`#general` does this for moderators and community managers).
106+
- **Permission overwrites are managed per permission.** Each `permissionOverwrites` entry names a role from `roles.ts` (or `DISCORD_EVERYONE_ROLE`) and the permissions to `allow` and `deny`, limited to the allowlist in [`discordPermissions.ts`](src/config/discordPermissions.ts). Pulumi owns only the listed permissions: other permissions on the same overwrite, and overwrites for other roles or members, stay as they are on Discord. Removing a permission or an entry clears just those bits on the next deploy. The bot needs **Manage Roles** to write overwrites, and Discord only lets it allow or deny permissions it holds itself. Administrators bypass overwrites.
106107
- **Channels are never deleted.** Removing an entry only drops the resource from Pulumi state; the channel and its history stay on Discord. Changing an entry's `id` or `type` likewise adopts/creates the new channel and leaves the old one alone.
107108
- Only declared settings are managed. `name` is required when creating a channel and optional when adopting one by `id`; declare it only if you want it enforced. Validation (`npm run check`) rejects a missing name on a new channel, names outside 1-100 characters, topics over Discord's limit (1024 for text, 4096 for forum/media), malformed snowflakes, duplicate entries, more than 20 tags, `requireTag` with no tags to pick from, and forum/media settings on text channels (`defaultForumLayout` is forum-only). It prints a `WARNING:` without failing for names with uppercase letters or spaces (Discord normalizes those, so the declared name would never match) and for `requireTag` on an adopted channel that declares no `availableTags` (it relies on the tags already on Discord; the deploy fails if there are none).
108109
- `position` is applied on creation only. Discord renumbers positions whenever channels move, so it is not checked or re-applied afterwards; reorder channels in Discord.
@@ -120,7 +121,7 @@ Channels listed in [`src/config/channels.ts`](src/config/channels.ts) are manage
120121
### One-time setup
121122

122123
1. In the Cloudflare dashboard for the **MCP Domain Account**, create a token dedicated to Access policy role management. Give it a descriptive name so it does not read as a generic API token, e.g. `mcp-access: Access policy role management`, and scope it to only **Account → Access: Apps and Policies → Edit** on the MCP Domain Account. Do not reuse this token for anything else.
123-
2. Add it as the GitHub Actions secret `CLOUDFLARE_ROLE_MANAGEMENT_TOKEN` in the `production` environment (repository settings → Environments → production). The deploy workflow passes it to Pulumi as `cloudflare:roleManagementToken`. Until the secret exists, the Cloudflare module logs "Cloudflare integration disabled: roleManagementToken not configured" and creates nothing, so previews stay green.
124+
2. Add it as the GitHub Actions secret `CLOUDFLARE_ROLE_MANAGEMENT_TOKEN` in the `production` and `preview` environments (repository settings → Environments). The deploy workflow passes it to Pulumi as `cloudflare:roleManagementToken`. Until the secret exists, the Cloudflare module logs "Cloudflare integration disabled: roleManagementToken not configured" and creates nothing, so previews stay green.
124125
3. The account ID and GitHub identity-provider ID are non-secret and live in [`Pulumi.prod.yaml`](Pulumi.prod.yaml).
125126
4. **Adopting the existing policy.** Pulumi's `import` resource option only succeeds when the program's inputs match the live resource, so adoption is two deploys:
126127
- 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.
@@ -199,15 +200,26 @@ The private key is equivalent to organization admin. Store it as an environment
199200
gh secret set DEPLOY_APP_PRIVATE_KEY --env production -R modelcontextprotocol/access < key.pem
200201
```
201202

203+
Preview runs in the `preview` environment and reads `DEPLOY_APP_CLIENT_ID` and `DEPLOY_APP_PRIVATE_KEY` from there. That environment accepts pull request branches, so give it the credentials of a separate App that has only **Metadata: read** and **Custom organization roles: read**, not the deploy App's. The token Preview requests is limited to those two permissions, but the private key behind it is not.
204+
202205
Do not use a refresh (`make refresh`, `pulumi preview --refresh`) as a read-only check: the Discord member sync corrects role drift during `read()`, so any refresh can change live Discord roles.
203206

204207
### Required GitHub Secrets (for CI/CD)
205208

206-
The following secrets must be configured in GitHub Actions for automated deployments:
209+
The workflows run in two GitHub environments (repository settings → Environments):
210+
211+
| Environment | Used by | Deployment branches |
212+
| ------------ | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
213+
| `production` | [`deploy.yml`](.github/workflows/deploy.yml) on `main` | `main` only |
214+
| `preview` | [`preview.yml`](.github/workflows/preview.yml) on pull requests | No restriction. Pull request runs use `refs/pull/<number>/merge`, which a `main`-only rule rejects. |
215+
216+
A secret or variable stored in an environment is visible only to jobs that declare that environment. One stored at repository level is visible to both. Anyone who can push a branch to this repository can run a workflow in `preview`, so keep the deploy App's private key out of it.
217+
218+
The following secrets must be configured in GitHub Actions for automated deployments. Both workflows read all of them. Apart from the App credentials, Preview needs the same values as Deploy: it fails without the billing email, and it shows the Discord and Cloudflare resources as deletes when their values are missing.
207219

208-
- **`DEPLOY_APP_PRIVATE_KEY`** (secret, `production` environment): private key of the deploy GitHub App
220+
- **`DEPLOY_APP_PRIVATE_KEY`** (secret, set in each environment): private key of the deploy GitHub App in `production`, and of the read-only preview App in `preview`
209221

210-
- **`DEPLOY_APP_CLIENT_ID`** (a **variable**, not a secret, `production` environment): client ID of the deploy GitHub App
222+
- **`DEPLOY_APP_CLIENT_ID`** (a **variable**, not a secret, set in each environment): client ID of the App whose private key that environment holds
211223

212224
- **`ORG_BILLING_EMAIL`**, **`DISCORD_BOT_TOKEN`**, **`DISCORD_GUILD_ID`**: passed to Pulumi config by the workflows
213225

@@ -220,7 +232,7 @@ The following secrets must be configured in GitHub Actions for automated deploym
220232
- Used to decrypt encrypted values in Pulumi stack configuration
221233
- Keep this secure - if lost, you cannot decrypt your Pulumi state
222234

223-
- **`CLOUDFLARE_ROLE_MANAGEMENT_TOKEN`** (optional, `production` environment): 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)
235+
- **`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)
224236
- Used to manage the Cloudflare Access policy for `securityroom.modelcontextprotocol.io` (see [Cloudflare Access (security-room)](#cloudflare-access-security-room))
225237

226238
## Initial Setup
@@ -284,4 +296,4 @@ Add the CI/CD secrets to GitHub Actions (repository settings → Secrets and var
284296

285297
- `GCP_PROD_SERVICE_ACCOUNT_KEY`: Content of `sa-key.json`
286298
- `PULUMI_PROD_PASSPHRASE`: The passphrase you set above
287-
- `DEPLOY_APP_CLIENT_ID` and `DEPLOY_APP_PRIVATE_KEY` (in the `production` environment, not at repository level): see [Deploy GitHub App](#deploy-github-app)
299+
- `DEPLOY_APP_CLIENT_ID` and `DEPLOY_APP_PRIVATE_KEY` (in the `production` and `preview` environments, not at repository level): see [Deploy GitHub App](#deploy-github-app)

0 commit comments

Comments
 (0)