diff --git a/docs/proposals/self-service/README.md b/docs/proposals/self-service/README.md new file mode 100644 index 0000000..c6506e7 --- /dev/null +++ b/docs/proposals/self-service/README.md @@ -0,0 +1,373 @@ +# Self-service access and infrastructure management + +Let maintainers, working group leads and other authorised contributors **create and manage the infrastructure they are responsible for** through GitHub PRs, without waiting for a central administrator for every change. This includes membership, new experimental and extension repositories, GitHub Pages, package publishing access, and ongoing resource management. + +**YAML describes desired state. Protected TypeScript decides what is allowed. Pulumi applies authorised changes where supported; registry changes that require manual execution follow an approved runbook.** Formal voting is optional and only used where governance requires consensus. + +The aim is self-service across the resource lifecycle: request → create → delegate ownership → manage → retire, with approvals appropriate to the operation and its risk. + +Proposal for discussion; no changes to existing access or governance are made by this document. + +## 1. Target architecture + +![Target architecture: users, roles, resources and owners in YAML; protected TypeScript and Pulumi manage infrastructure.](target-architecture.svg) + +| Concept | Purpose | +| --- | --- | +| User | Verified identity across providers | +| Role | Direct user membership and provider-specific configuration | +| Resource | Infrastructure settings and access grants | +| Owner | Existing user or role eligible to approve changes | +| Policy | Protected rules defining allowed operations and approval requirements | + +Ownership does not itself grant membership or infrastructure permissions. + +## 2. Repository structure + +Most contributors only need to edit files under `config/`. + +```text +access/ +├── config/ # Declarative YAML +│ ├── users/ +│ │ └── example-user.yaml +│ ├── roles/ +│ │ ├── infrastructure-wg/ +│ │ │ ├── role.yaml +│ │ │ ├── members.yaml +│ │ │ └── owners.yaml +│ │ ├── infrastructure-wg-leads/ +│ │ └── … +│ └── resources/ +│ ├── github/repositories/ +│ │ └── experimental-ext-example/ +│ │ ├── resource.yaml +│ │ ├── access.yaml +│ │ └── owners.yaml +│ ├── discord/channels/ +│ ├── google/groups/ +│ ├── cloudflare/applications/ +│ ├── npm/packages/ +│ └── pypi/projects/ +├── src/ # Protected TypeScript +│ ├── schemas/ +│ ├── config/ +│ ├── policies/ +│ ├── effective-access/ +│ ├── authorization/ +│ └── … # Existing Pulumi/provider code +├── .github/ # Protected workflows and CODEOWNERS +├── Pulumi.yaml +└── … +``` + +Illustrative target structure; start with GitHub repository creation and management, then add Pages and other provider resources incrementally. Package registry declarations use the same configuration pattern even where execution is manual. + +## 3. Configuration by example + +### Users + +One stable identifier per user; provider identities can change without renaming the file. + +`config/users/example-user.yaml` + +```yaml +github: example-user +githubUserId: 12345678 +discord: "123456789012345678" +firstName: Example +lastName: User +``` + +### Roles and membership + +Keep the existing role definition, including GitHub team hierarchy. + +`config/roles/infrastructure-wg/role.yaml` + +```yaml +description: Infrastructure Working Group +github: + team: infrastructure-wg + parent: working-groups +discord: + role: infrastructure working group (synced) +``` + +`config/roles/infrastructure-wg/members.yaml` + +```yaml +- example-user +``` + +Membership is just a list of user IDs. GitHub team nesting uses `github.parent`; where needed, retain the existing `discordImplies` list in `role.yaml` for Discord-specific implied roles. No generic nested-role or platform-filter schema. + +Preserve existing provider semantics, including Workspace provisioning eligibility through GitHub parent teams and direct-only grants. Discord implications must not grant GitHub access. + +### Resources: create, own and manage + +A facilitator or maintainer can propose a new experimental repository, its initial permissions and its owners in one PR. The same files are used for later changes. Example target schema: + +`config/resources/github/repositories/experimental-ext-example/resource.yaml` + +```yaml +description: Experimental MCP extension +topics: + - mcp +pages: + branch: main + path: /docs +``` + +Each resource type exposes a small, typed allowlist of the settings supported by our Pulumi implementation, not the entire provider API. Reuse the existing `RepositorySettings` interface and adapter in [src/config/repoAccess.ts](../../../src/config/repoAccess.ts) and [src/github.ts](../../../src/github.ts). + +| YAML | Existing Pulumi mapping | +| --- | --- | +| Directory name | `github.Repository.name` and existing logical resource names | +| `description` | `description` (required) | +| `visibility` | `visibility` (defaults to public; policy restricts changes) | +| `homepage` | `homepageUrl` | +| `topics` | `topics` | +| `template` | `template.repository` (creation only; organisation fixed) | +| `access.yaml` | `github.RepositoryCollaborators` (resolve role IDs to team IDs and user IDs to GitHub usernames) | +| `owners.yaml` | Access authorisation only; not a Pulumi provider argument | + +`pages` above is a proposed addition: add explicit Pulumi support, a typed schema and policy before exposing it. It can be set at creation or later, subject to source availability; omission must not silently disable an existing site. + +Keep `REPOSITORY_DEFAULTS`, organisation security settings, provider credentials and lifecycle options in protected TypeScript. Do not allow arbitrary provider arguments, generic overrides or raw Pulumi options in YAML. Reject unknown fields. Apply the same allowlist-and-adapter pattern to each other resource type as it is implemented. + +A repository with `resource.yaml` is managed; one with only access configuration is access-only. Adoption, removal and retirement still require explicit lifecycle handling; adding or removing a file alone must not silently adopt or archive infrastructure. + +`config/resources/github/repositories/experimental-ext-example/access.yaml` + +```yaml +roles: + infrastructure-wg: maintain + moderators: maintain + members: triage +``` + +`config/resources/github/repositories/experimental-ext-example/owners.yaml` + +```yaml +roles: + - infrastructure-wg-leads +``` + +The creation policy validates the namespace (e.g. `experimental-ext-*`), required settings, initial grants and eligible owners using existing authority in the trusted base. A new resource cannot authorise its own creation through its proposed owners. Once created, its approved owners can request subsequent settings, Pages and access changes within policy. + +Keep security defaults, naming rules and lifecycle protections in TypeScript. Preserve existing direct-user grants where necessary. Repository ownership in Access is not equivalent to GitHub admin permission. + +### Package registry access + +Use the same pattern for package resources. For example, a maintainer requests publishing access or configures trusted publishing for an experimental package: + +`config/resources/npm/packages/experimental-ext-example/access.yaml` + +```yaml +roles: + infrastructure-wg: publish +trustedPublisher: + repository: modelcontextprotocol/experimental-ext-example + workflow: .github/workflows/release.yml +``` + +The package directory identifies the package within the configured registry namespace. Resolve verified registry identities from roles and enforce centrally maintained baseline maintainers and trusted-publishing policy. Changing a publisher repository or workflow is a sensitive operation, not a routine grant. + +npm and PyPI already have declared publishing access in `src/config/packageAccess.ts`. The current implementation documents interactive npm 2FA for mutations and no PyPI management API. For these providers, self-service means a reviewed, authorised request and declarative desired state, followed by manual execution by an authorised registry administrator and verification/drift reporting where supported. A merged PR alone must not claim that registry access was applied. Preserve unverified roster caveats and do not treat unknown access as absent. + +### Owners + +The same ownership format applies to a role or a resource. List existing user IDs under `users` and/or existing role IDs under `roles`; omit unused keys. The example lead role is illustrative and must exist before it can be assigned. + +`config/roles/infrastructure-wg/owners.yaml` + +```yaml +roles: + - infrastructure-wg-leads +``` + +An existing lead may approve changes to an owned role or resource if policy allows it. Owners are resolved from the trusted base, using direct role membership by default. Empty or missing ownership means central administration only. + +## 4. Delegation and policies + +![Ownership defines eligible approvers; policies define permitted operations; the authorisation engine evaluates both.](ownership-and-policies.svg) + +| What changes? | Who can manage it? | +| --- | --- | +| User identities | Verified onboarding / identity admins | +| Role definitions | Central maintainers | +| Ordinary role membership | Role owners, within policy | +| New experimental / extension repositories | Eligible facilitators or maintainers under creation policy | +| Existing resources and Pages | Resource owners, within policy | +| Package publishing access / trusted publishers | Package owners and designated publishing approvers, within policy | +| Ownership and administrative authority | Central maintainers | +| Schemas, policies, workflows, defaults | Protected TypeScript / central review | + +Policies should maximise delegation where it is safe, without allowing contributors to change their own guardrails. + +Illustrative TypeScript policy primitives: + +```ts +// Ordinary membership +minApprovals(1, roleOwners(roleId)); + +// Repository creation in an allowed namespace +// Illustrative: resolve authority from the trusted base +minApprovals(1, authorisedFacilitators); + +// Higher-risk changes +allOf( + minApprovals(2, CORE_MAINTAINERS), + minApprovals(1, LEAD_MAINTAINERS), +); +``` + +**Proposed approval requirements** (for review, not new governance rules): + +| Operation | Requirement | +| --- | --- | +| Explicitly permitted low-risk changes | Automatic authorisation | +| Ordinary membership | One eligible role owner | +| Compliant experimental repository creation | Eligible facilitator approval; validated namespace, initial grants and owners | +| Other repository creation / official designation | Applicable project and governance policy | +| Routine resource access/settings | Resource owner, within limits | +| GitHub Pages creation or update | Resource owner, within approved publishing constraints | +| Package publishing access | Package owner plus designated publishing approval where required | +| Trusted publisher or release workflow changes | Elevated approval; verify repository/workflow binding | +| Resource retirement, transfer or destructive changes | Explicit central approval; no implicit destruction | +| Privileged identity or repository admin grant | Two Core Maintainers | +| Inheritance or ownership changes | Central approval | +| Organisation-wide security changes | Core and Lead approval | +| Formal governance decisions | Applicable consensus policy | + +Support role-specific minimum approvals, combined requirements, and majority, supermajority or unanimity when applicable. Define the electorate, denominator and whether one person can satisfy multiple requirements. Mandatory security defaults apply regardless of approver; unknown operations fail closed. + +## 5. What a contributor sees + +A PR creating the experimental repository above shows the desired infrastructure, initial grants and required approvals together. + +**Infrastructure preview** + +```diff ++ GitHub repository: experimental-ext-example ++ GitHub Pages: main:/docs ++ GitHub repository grant: infrastructure-wg (maintain) +``` + +**Effective access and approval** + +```text ++ Infrastructure WG: maintain repository ++ Infrastructure WG leads: eligible resource owners +Required: eligible facilitator approval +Checks: namespace, settings, initial grants, owners +Authorisation: PASS (after required approval) +Voting: not required +``` + +A later PR can change settings, add a team grant or enable Pages using the same workflow, with approval from existing resource owners within policy. A membership change also shows any indirect permission gains; higher-risk grants cannot bypass approval merely because they originate in a membership edit. + +Calculate effective managed access for GitHub (teams, repos, organisation roles), Discord (roles and channels), Workspace (groups, provisioning and SSO), Cloudflare (app access), and declared npm/PyPI publishing grants. Explain inheritance paths, overlapping grants and identity remapping. Mark unmanaged or unknown access explicitly. + +The mock preview is advisory: it compares desired resources, not live state or replacement risk. It is not an authorisation check or a complete live permissions audit. + +## 6. Authorisation and deployment + +![Self-service request, policy evaluation, GitHub approvals or formal consensus, trusted verification and deployment.](authorization-workflow.svg) + +Use a trusted required GitHub check. Evaluate the proposed change against protected base configuration and code, including effective access and administrative authority. Apply automated changes only from protected main. For manual-only providers, track execution and verification separately from authorisation. + +| Guardrail | Enforcement | +| --- | --- | +| No privilege escalation | Evaluate indirect access and changes to owner-bearing roles; no self-approval or newly appointed owners approving their own change. | +| Trusted identity | Verified numeric GitHub IDs mapped to stable people; multiple accounts cannot supply multiple approvals. | +| Valid approval evidence | Reject withdrawn, conflicting or stale reviews; bind evidence to the candidate or verified semantic change. Revalidate the final merge candidate and changes to the base. | +| Protected execution | Untrusted PR code never receives production credentials or state. Policies, schemas, dependencies and workflows cannot be replaced by the PR they authorise. | +| Safe infrastructure lifecycle | Never implicitly adopt, rename, transfer, archive or delete resources; preserve Pulumi identities and lifecycle options. | +| Creation authority | Evaluate the requester, approvers, namespace, initial ownership and grants against trusted base policy. | +| Publishing boundaries | Validate Pages sources, visibility, domains and trusted publisher bindings; protect release and deployment permissions. | +| Central safeguards | Required checks, separate central review for protected code, merge controls and audited, narrowly restricted emergency bypass. | + +Repository protection and any required GitHub App permissions must be configured before delegation is enabled. + +### Optional formal consensus + +Reuse [MCP Voting](https://voting.modelcontextprotocol.io/) only for changes explicitly requiring formal consensus. Ordinary membership and resource management continue independently. + +```ts +requireConsensus({ + electorate: CORE_MAINTAINERS, + threshold: 'absolute-majority', + confidentiality: 'confidential-ballot', + duration: '7d', +}); +``` + +Example only; the actual electorate, threshold, duration, mechanism, confidentiality and veto rules follow applicable governance. Consensus is not necessarily unanimity, and sealed results alone do not guarantee anonymous ballots. + +Create or reuse a poll bound to the repository, PR, immutable change digest and policy. Post the link and leave the required check pending. Authenticated notifications plus periodic reconciliation retrieve the outcome without keeping a CI runner alive. + +Verify structured evidence (electorate, mechanism, affirmative count, threshold, closure, veto and supersession), not a displayed winner or submitted URL. Distinguish turnout quorum, plurality and absolute majority; preserve ballot confidentiality. Material changes invalidate evidence; reject stale, unrelated, rejected, incomplete or superseded results. If Voting is unavailable, only consensus-required changes remain pending. Votes never provision privileges directly. + +## 7. Implementation plan + +Deliver each stage independently, retaining existing access and approval rules until the authorisation check is ready. Steps 1–6 are sufficient for self-service; step 7 is optional. + +| Step | Deliverable | Depends on | +| --- | --- | --- | +| 1 | [Credential-free previews](#1-credential-free-previews) · #292 | — | +| 2 | [Declarative users and roles](#2-declarative-users-and-roles) · #291 | 1 | +| 3 | [Declarative resources](#3-declarative-resources) | 2 | +| 4 | [Effective access](#4-effective-access) | 2, 3 | +| 5 | [Ownership and policies](#5-ownership-and-policies) | 4 | +| 6 | [Secure self-service](#6-secure-self-service) | 5 | +| 7 | [Optional consensus integration](#7-optional-consensus-integration) | 5, 6 | + +### 1. Credential-free previews + +Existing PR: [#292](https://github.com/modelcontextprotocol/access/pull/292). + +- Run the actual Pulumi program with SDK mocks and synthetic provider configuration for both base and proposed merge revisions, in network-disabled containers. +- Compare deterministic resource identifiers, inputs, explicit dependencies and supported lifecycle options. Publish bounded advisory results through a separate default-branch workflow that never executes PR code; treat artifacts as untrusted and bind them to the revisions. +- **Done when:** all managed integrations are represented, addition/removal/modification tests pass, repeated runs are deterministic, fork PR comments are verified after rollout, and existing live preview/deploy remain unchanged. + +### 2. Declarative users and roles + +Existing PR: [#291](https://github.com/modelcontextprotocol/access/pull/291), revise to YAML. + +- Discover files automatically with TypeScript runtime schemas (Zod) and inferred types; retain compatible `MEMBERS` and `ROLES` interfaces, existing provider-specific role fields and a plain user-ID membership list. +- Bound parser inputs; reject duplicate keys, aliases, custom tags, unknown fields, unexpected files and unsafe paths/symlinks. Validate unique normalized identities, generated Workspace addresses, references, provider identifiers, GitHub parent and Discord implication cycles; preserve intentionally separate accounts. +- **Done when:** original and migrated identities, provisioning fields, role definitions, direct membership and inheritance match semantically; mock preview has no unintended changes; invalid inputs have regression tests. Coordinate roster changes such as [#252](https://github.com/modelcontextprotocol/access/pull/252). + +### 3. Declarative resources + +- Migrate existing GitHub repository settings and grants to separate files, exposing only a typed subset of the existing Pulumi adapter. Add Pages to the protected implementation before exposing its schema. Extend the same pattern to other providers and declared npm/PyPI publishing access; preserve the manual execution/drift workflow for registries. Keep provider defaults and security requirements in TypeScript. +- Distinguish new managed resources, access-only management and explicit adoption, rename/transfer and archival/deletion. Validate names, references and permission levels. +- **Done when:** existing settings/grants are preserved, experimental repositories and their initial access/ownership can be defined through validated YAML, Pages can be enabled under policy, package declarations retain existing publishing safeguards, and semantic/mock comparison plus lifecycle review confirm no unintended replacement or archival. + +### 4. Effective access + +- Calculate deterministic base-versus-proposed managed permissions and identity changes, including transitive memberships and overlapping grants. +- **Done when:** machine-readable and human-readable diffs explain gains/losses and their sources; tests cover provider-specific inheritance, overlapping grants and identity remapping; policy evaluation sees indirect escalation and unmanaged/unknown access. + +### 5. Ownership and policies + +- Introduce the shared ownership schema and typed approval requirements, including automatic authorisation for explicitly permitted changes. Resolve creation authority and existing ownership from the trusted base; define operation-specific thresholds for creation, subsequent management, publishing and retirement. +- **Done when:** ownership remains separate from access; eligible approvers and requirements are computed per operation; tests cover owner-bearing roles, inheritance, overlapping requirements and escalation. Existing approval rules remain in force. + +### 6. Secure self-service + +- Enable the trusted required check and repository protections. Start with compliant experimental repository creation, initial ownership and grants, subsequent resource management (including Pages), verified onboarding and membership. Add package access requests with manual execution evidence where required. +- **Done when:** policy-compliant creation and ongoing management can proceed without unnecessary central approval or Voting; manual-only operations distinguish authorisation from execution; unauthorised changes cannot pass; regression tests cover identity substitution, self-appointment, nested grants, duplicate accounts, stale reviews, concurrent PRs and lifecycle/security bypass. Final candidates are revalidated and production credentials remain protected. + +### 7. Optional consensus integration + +- Coordinate authenticated poll creation, notifications, reconciliation and evidence verification with [modelcontextprotocol/voting](https://github.com/modelcontextprotocol/voting). +- **Done when:** a policy can create a single poll and await a verified decision asynchronously; tests cover replay, changed PRs, missed events, threshold failures and vetoes. Routine self-service remains independent of Voting. + +## Out of scope + +A new configuration database, custom policy language, voting platform or frontend; roster synchronisation; changes to live preview and deployment as part of the credential-free preview refactor. + +Success means authorised contributors can create, own and manage resources throughout their lifecycle, with no unnecessary central bottleneck and without weakening infrastructure security or governance. diff --git a/docs/proposals/self-service/authorization-workflow.svg b/docs/proposals/self-service/authorization-workflow.svg new file mode 100644 index 0000000..08563b1 --- /dev/null +++ b/docs/proposals/self-service/authorization-workflow.svg @@ -0,0 +1 @@ +Self-service authorisation workflowPolicies determine required approval evidence. Routine changes use GitHub approval or explicit automatic authorization. MCP Voting is optional and used only when formal consensus is required. A trusted check verifies all required evidence before merge and deployment.Self-service requestGitHub PR · configuration changeOwnership + TypeScript policiesDetermine required approvalsGitHub approvalsOwners / Core / LeadDefault path · auto if permittedMCP VotingFormal consensusOnly when requiredVerify authorisationAll required evidence · trusted baseRevalidate final merge candidateReject stale or changed evidenceMerge and Pulumi deploy diff --git a/docs/proposals/self-service/ownership-and-policies.svg b/docs/proposals/self-service/ownership-and-policies.svg new file mode 100644 index 0000000..04f43bf --- /dev/null +++ b/docs/proposals/self-service/ownership-and-policies.svg @@ -0,0 +1 @@ +Ownership and policiesOwnership identifies eligible approvers; TypeScript policies determine what they may approve. The authorization engine evaluates both and the effective permission impact against trusted base configuration.OwnershipYAMLWho can manage it?PoliciesTypeScriptWhat can they do?Authorisation engineEvaluate ownership, policy and effective accessagainst trusted base configurationAuthorisedDenied / pending diff --git a/docs/proposals/self-service/target-architecture.svg b/docs/proposals/self-service/target-architecture.svg new file mode 100644 index 0000000..d7937d5 --- /dev/null +++ b/docs/proposals/self-service/target-architecture.svg @@ -0,0 +1 @@ +MCP Access — target architectureDeclarative YAML defines users, roles, resource grants and ownership. Protected TypeScript validates and authorizes changes against trusted configuration. Pulumi reconciles protected main to providers.DECLARATIVE CONFIGURATION · YAMLMembershipAccess grantsGitHubparent teamUsersIdentity detailsRolesRole config + user listResourcesSettings + access grantsOwnersUsers or rolesOwnership delegates approval; it does not grant access.PROTECTED CODE · TYPESCRIPTSchema validationEffective accessSecurity policiesAuthorisationPulumi reconciliationAuthorised changes only · protected mainGitHubDiscordGoogleCloudflare