From af80b90ed200d694ad6941f4e5db81144ab418ba Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 00:44:49 +0000 Subject: [PATCH 01/10] docs: decide how the API presents the platform, and what a person may read ADR 094 proposes a platform resource (getPlatform, listPlatformOperators and a project's kind), the reads a person's credential takes beside a project secret, and the /users/me reads with a person's token, so that an agent signed in as a person finds its projects, who runs the deployment, and where a person signed in. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U --- docs/adrs/094-platform-as-a-resource.md | 216 ++++++++++++++++++++++++ docs/adrs/README.md | 1 + 2 files changed, 217 insertions(+) create mode 100644 docs/adrs/094-platform-as-a-resource.md diff --git a/docs/adrs/094-platform-as-a-resource.md b/docs/adrs/094-platform-as-a-resource.md new file mode 100644 index 0000000000..12eea29ca0 --- /dev/null +++ b/docs/adrs/094-platform-as-a-resource.md @@ -0,0 +1,216 @@ +# ADR 094: The Platform as a Resource, and What a Person May Read + +> **Status:** Proposed +> **Date:** 2026-12-02 +> **Amends:** [ADR 075](075-platform-operators.md) §6 and its rejected +> alternative "A separate listing and a capability read for operators" (an +> operator listing), [ADR 036](036-api-credential-planes.md) (which reads take +> a person's credential) +> **Related:** [ADR 053](053-cross-project-principals.md), +> [ADR 054](054-customer-collaboration-grants.md), +> [ADR 092](092-mcp-server.md) §8 + +## Context + +ADR 075 §1 puts one `platform` object above every project of a deployment, +with an `operator` relation that administers them all. The API shows no such +object. The platform is a project like any other, the platform project, which +holds: + +- the hosted cloud's customer accounts, as its users; +- the customer accounts and access teams, as its teams (ADR 054); +- the Console's sign-in and the platform issuer at `/oauth`; +- a release with the OAuth settings and the `auth.client.admit` policy. + +On 2026-12-01 a person connected an MCP client to the hosted cloud as its +bootstrap admin, an operator, and had it investigate. What went wrong: + +- **"Who is admin here?" got an empty answer.** `listProjectMembers` lists + owning teams and grants. An operator holds neither, so the platform + project's list was empty, with nothing to say why. +- **The agent could not tell the platform project from a customer's.** Its + users are every customer's account, not one customer's users. +- **An operator was refused reads the check would allow.** The check allows + an operator every role on every project (ADR 075 §3). But about thirty + operations accept only a project secret, so every person is refused before + the check runs, an operator included. Among them are `querySessions` and + `getSession`, whose sessions record the IP and user agent each began with: + the one-call answer to "where did this person sign in from". The agent + pieced it together from events instead, in 19 calls. +- **A person's agent cannot find its own projects.** The `/users/me` reads, + `listMyProjects` among them, accept only a session cookie. A person signed + in through an OAuth client cannot list the projects they can act on or ask + who they are, and the MCP endpoint offers none of them. + +ADR 075 §6 decided that operators get "no listing, label or Console view of +their own", so that the Console treats them as anyone. That holds for what a +person can reach. It leaves an agent, and a person, no way to ask who runs +the deployment. + +## Decision + +### 1. The platform is a resource of the API + +- **`getPlatform`** (`GET /platform`) answers the deployment's platform: the + platform project's `project_id`, and the platform issuer when OAuth is on. + Any authenticated caller may read it. A deployment without a platform + project answers `404`. +- **`listPlatformOperators`** (`GET /platform/operators`) lists the users who + hold `operator`, each with the user, when the assignment was made and its + grantor (`config`, ADR 075 §4). Its gate is `operator` on the platform: + operators see who else runs the deployment. It takes the new scope + `platform.read`, which no project secret holds, since no secret reaches the + operator path. Issuing operators stays configuration; there is no write. +- **A project says whether it is the platform's.** The project resource gains + `kind`: `platform` for the platform project, `standard` for every other + project. It shows wherever a project does, to whoever may read that + project, which for the platform project is its operators and the people + granted a role on it. Customers never see it. +- **`listProjectMembers` keeps its meaning:** roles on one project. On the + platform project, its description and its agent note point to + `listPlatformOperators`. + +This labels the platform, not a person. The Console still derives what a +person may do from the check, never from `kind` or from the operator list +(ADR 054 §10). + +### 2. A person reads what their role lets them read + +A read accepts a person's credential, a Console session or a person's token, +and its gate decides, unless: + +- it serves an application's sign-in (`x-zitadel-plane: app`), as + `getAuthAttempt` does; +- its answer is a credential (`x-zitadel-returns-secret`); +- it proves possession of a secret, as `getProjectClaimStatus` does + (ADR 046 §3); +- a person has an operation of their own for it: a person lists projects with + `listMyProjects`, not `queryProjects`. + +That opens five reads that only a project secret may call today. Each keeps +the gate it has: + +| Operation | Gate | What a person newly reads | +|---|---|---| +| `querySessions`, `getSession` | `viewer` | A project's sessions: user, state, factors, assurance levels, `metadata`, and the IP, user agent and fingerprint each began with | +| `listIdpRevisions` | `viewer` | The revisions of an identity provider connection | +| `listProjectPreviews` | `viewer` | The project's previews | +| `listDeploymentVariables` | `viewer` | The variables a deployment froze; a secret reads back as `{"secret": true}` | + +- **No operator special case.** An operator reads all of this on every + project, because the check allows them (ADR 075 §3). Anyone else reads it + on the projects where they hold `viewer`. +- **The scopes already exist for people.** The permission catalog's + `project_viewer` bundle holds `session.read` and `idp.read`. A person's + token already uses `deployment.read` and `variable.read`, on + `listDeployments` and `listVariables`. +- **What viewers see that they could not before:** a session's factors and + `metadata`. They already read the IP and user agent of every request on + `request.api` events. `metadata` is whatever an application wrote on the + session, so an application that keeps something sensitive there shows it + to its viewers. The operation's description says so. +- **The writes that only a project secret calls stay so:** the `publish*` + writes, `createRelease`, `buildRelease`, `setVariables`, `deleteVariable`, + `setUserPassword`, `revokeSession`, `deactivateTeam`, + `removeProjectPreview` and `createProjectClaim`. Opening any of them is a + decision of its own. +- **A test holds the rule** against every read of the spec, as + zitadel/nextgen#3538 holds the operations that take both a session cookie + and a bearer to the ones a person's token reaches. + +### 3. A person's own reads take their token + +- **The `/users/me` reads take a person's token** as well as their session: + `getMyUser`, `listMyProjects`, `listMyTeams`, `getMyUserSchema`, + `listMyPasskeys`, `listMyIdentityLinks` and `getMyPasswordState`. + - Each names the scope of what it reads, since every operation a person's + token reaches names one: `user.read`, `project.read` for + `listMyProjects`, `team.read` for `listMyTeams`, `schema.read` for + `getMyUserSchema`. + - A project secret has no self, so these refuse it. The MCP endpoint + shows them to a person's credential only. +- **A new read, `listMySessions`** (`GET /users/me/sessions`), lists the + person's own sessions with the IP and user agent each began with, under + `session.read`. It answers "where did I sign in" for a person with no role + on the project their account lives in, which is every customer of the + hosted cloud. +- **The MCP endpoint's instructions** tell an agent signed in as a person to + start with `getMyUser` and `listMyProjects`. + +### 4. Sequence + +1. §3: a person's own reads, which change nobody's access to anyone else. +2. §2: the five reads, each with its row in the gate contract test. +3. §1: the platform resource and `kind`. + +## Consequences + +### Positive + +- An agent signed in as a person finds its projects, who runs the + deployment, and where a person signed in, each in one call. +- An operator reads every project's state through the check, as ADR 075 + meant, with no operator-only path through the credential plane. +- Which reads take a person's credential is one rule, held by a test, and + not a list kept by hand. + +### Negative / Risks + +- A project's viewers read its sessions' `metadata` and factors. +- The tool list grows by about fifteen tools for a person's credential, and + `platform.read` adds a scope a client may ask for. +- Seven `/users/me` operations and five reads change their security in the + contract, and the SDKs and the API mock follow. + +## Open questions + +1. Does `getPlatform` tell the caller whether they are an operator? An agent + asks it first. ADR 075 rejected a capability read so that the Console + would not branch on one. +2. Should a person's `querySessions` and `getSession` ask `admin` instead of + `viewer`, keeping session `metadata` to administrators, against the + catalog's viewer bundle? +3. Who besides operators may list operators: staff granted a role on the + platform project? +4. Which project-secret writes a person's credential should take, starting + with `revokeSession` for an administrator. + +## Rejected alternatives + +### Taking the platform out of the project machinery + +A platform stored apart from projects would need its own users, teams, +sign-in, issuer and release. The project machinery already provides each one. +The API can present the platform as its own resource without moving it. + +### Listing operators as members of every project + +Every customer would see the deployment's staff in their member list. ADR +075 §5 shows customers what operators change, not who could. Operators stay +off every project's member list, the platform project's included, and have a +list of their own. + +### Letting operators alone past the credential plane + +Accepting an operator's credential on the project-secret-only reads, and no +one else's, makes operators a special case of the question every person asks +(ADR 075 §6). Opening the reads to people and letting the check decide gives +operators the same result through the same path. + +### Answering "where did they sign in" from events + +The IP of a sign-in is on its `request.api` events, which an agent joins by +`correlation_id`, one call per sign-in. A customer holds no role on the +project their account lives in, so cannot read those events at all. + +## Documentation impact + +- ADR 075 §6: a note that the operator listing is §1 of this ADR. +- ADR 036: which reads take a person's credential. +- `docs/design/api/system-permission-catalog.md`: `platform.read`, and + `session.read` for a person. +- The API reference for the new and changed operations, and their agent + notes (ADR 092 §3). +- The CLI's commands for the new operations, and `SKILL.md`. +- `apps/docs/content/docs/guides/investigate-with-events.mdx`: where a person + signed in, from `listMySessions` and `querySessions`. diff --git a/docs/adrs/README.md b/docs/adrs/README.md index 113aebef19..04a77b0809 100644 --- a/docs/adrs/README.md +++ b/docs/adrs/README.md @@ -99,3 +99,4 @@ This directory contains architecture decision records (ADRs) for nextgen. | [091](091-release-pinning.md) | Release Pinning | Proposed | The app sends the release it was built against in `X-Zitadel-Release` when it starts a sign-in. Each deployment keeps a pin list per target, the earlier deployments a pin may still use, taken only from the previous deployment and its list up to the release's `.zitadel/pinning/pinning.json` `keep` (default 0), so `keep: 0` is a permanent cut. A pin outside the list gets the newest release; the response's `X-Zitadel-Release` names the release that served and a `flow.pin_not_served` event records the miss. `setUserPassword` takes no pin. Amends ADR 085 §2. | | [092](092-mcp-server.md) | MCP — the API as Tools on the Server, and the MCP Servers Zitadel Protects | Proposed | Zitadel's MCP server is an endpoint of the Go server, `/api/v1/mcp`, on unless `mcp.enabled` turns it off, so a local server, a self-hosted one and the cloud serve the same one. A tool is one operation read from the embedded OpenAPI document, and a call is that operation's own request to the API's handler with the caller's credential: a project secret today, a person's token once the OAuth pieces exist. The spec marks which operations only read (`x-zitadel-read-only`), belong to applications (`x-zitadel-plane: app`) or return a credential (`x-zitadel-returns-secret`). A client is shown the tools its credential's scopes cover, and a destructive call is sent only after the person at the client confirmed that call. Customers' MCP servers, which Zitadel protects, follow on the same OAuth pieces, and Agent Skills over MCP's Skills extension are wanted on the same endpoint. | | [093](093-policy-decision-events.md) | Policy Decision Events | Proposed | A policy gate records each evaluation as a wide event, `policy.evaluate.denied` or `policy.evaluate.allowed`, naming the policy, the revision and the failed rules. The gate writes it when it decides, best-effort and outside the operation's transaction, so the events get a category of their own, `policy`. The server setting `events.policy.decisions` (`none`, `deny` by default, `all`) selects what is recorded. Amends ADR 048 and ADR 066. | +| [094](094-platform-as-a-resource.md) | The Platform as a Resource, and What a Person May Read | Proposed | The API presents the deployment's platform as its own resource: `getPlatform`, `listPlatformOperators` (gated by `operator`, scope `platform.read`) and a project's `kind` (`platform` or `standard`); `listProjectMembers` keeps meaning roles on one project. A read accepts a person's credential and its gate decides, except app-plane reads, answers that are credentials, proofs of possession and reads a person has their own operation for, which opens `querySessions`, `getSession`, `listIdpRevisions`, `listProjectPreviews` and `listDeploymentVariables` at `viewer`. The `/users/me` reads take a person's token, and `listMySessions` lists a person's own sessions. Amends ADR 075 §6 and ADR 036. | From a52891fd65070ec831557dee015b03bc8d088407 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 00:53:58 +0000 Subject: [PATCH 02/10] docs: answer ADR 094's open questions on operators, sessions and writes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A person learns how they hold a project from its effective role and sources, platform_operator among them, as ADR 054 §9 and Console ADR 0004 §5 planned, not from a capability read ADR 075 rejected. Sessions get a type of their own, read and revoked by their user and the project's administrators, operators included, in place of every viewer. Only operators list operators. The CLI's release-time writes take a person's token, variable writes are kept out of MCP tools, and setUserPassword, deactivateTeam and the operations that answer with a credential stay as they are, each with its reason. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U --- docs/adrs/094-platform-as-a-resource.md | 269 +++++++++++++++++------- docs/adrs/README.md | 2 +- 2 files changed, 195 insertions(+), 76 deletions(-) diff --git a/docs/adrs/094-platform-as-a-resource.md b/docs/adrs/094-platform-as-a-resource.md index 12eea29ca0..12240e411f 100644 --- a/docs/adrs/094-platform-as-a-resource.md +++ b/docs/adrs/094-platform-as-a-resource.md @@ -1,14 +1,16 @@ -# ADR 094: The Platform as a Resource, and What a Person May Read +# ADR 094: The Platform as a Resource, and What a Person May Do > **Status:** Proposed > **Date:** 2026-12-02 > **Amends:** [ADR 075](075-platform-operators.md) §6 and its rejected > alternative "A separate listing and a capability read for operators" (an -> operator listing), [ADR 036](036-api-credential-planes.md) (which reads take -> a person's credential) -> **Related:** [ADR 053](053-cross-project-principals.md), -> [ADR 054](054-customer-collaboration-grants.md), -> [ADR 092](092-mcp-server.md) §8 +> operator listing), [ADR 036](036-api-credential-planes.md) (which operations +> take a person's credential), [ADR 054](054-customer-collaboration-grants.md) +> §9 (effective access names the operator path) +> **Related:** [ADR 033](033-internal-permission-management.md), +> [ADR 053](053-cross-project-principals.md), +> [ADR 092](092-mcp-server.md) §8, +> [Console ADR 0004](../../apps/console/docs/adrs/0004-console-deployment-modes.md) §5 ## Context @@ -30,8 +32,8 @@ bootstrap admin, an operator, and had it investigate. What went wrong: project's list was empty, with nothing to say why. - **The agent could not tell the platform project from a customer's.** Its users are every customer's account, not one customer's users. -- **An operator was refused reads the check would allow.** The check allows - an operator every role on every project (ADR 075 §3). But about thirty +- **An operator was refused what the check would allow.** The check allows an + operator every role on every project (ADR 075 §3). But about thirty operations accept only a project secret, so every person is refused before the check runs, an operator included. Among them are `querySessions` and `getSession`, whose sessions record the IP and user agent each began with: @@ -42,25 +44,46 @@ bootstrap admin, an operator, and had it investigate. What went wrong: in through an OAuth client cannot list the projects they can act on or ask who they are, and the MCP endpoint offers none of them. -ADR 075 §6 decided that operators get "no listing, label or Console view of -their own", so that the Console treats them as anyone. That holds for what a -person can reach. It leaves an agent, and a person, no way to ask who runs -the deployment. +What the records already decide about telling a person they are an operator: + +- **ADR 075 §6:** operators get "no listing, label or Console view of their + own", and "nothing in [the Console] depends on knowing who is an operator, + so there is no capability read either". Its rejected alternatives turn + down "an endpoint telling the Console who is an operator". +- **ADR 054 §10:** the Console derives each capability on its own, and never + from being a platform-project user, a platform team's owner or a project + administrator. +- **ADR 054 §9:** a project listing may return the caller's effective role + and its sources (`owning_team`, `user:`, `team:`). It is not built: + a project answers its fields and nothing about the caller. +- **Console ADR 0004 §5:** the server answers the person's effective + permissions on a target, and the Console renders from them. Until that + exists, the Console reads `GET /projects/{platform_project_id}` and treats + a `403` or `404` as "not yours". +- **Already public:** the Console's runtime document names the platform + project (`platform_project_id`), and `listMyProjects` takes + `exclude_platform`. + +So the records answer "which projects can I act on, and how", not "am I an +operator". No operation answers either yet. ## Decision ### 1. The platform is a resource of the API - **`getPlatform`** (`GET /platform`) answers the deployment's platform: the - platform project's `project_id`, and the platform issuer when OAuth is on. - Any authenticated caller may read it. A deployment without a platform - project answers `404`. + platform project's `project_id`, and the platform issuer when OAuth is on, + as the Console's runtime document already does. Any authenticated caller + may read it. A deployment without a platform project answers `404`. - **`listPlatformOperators`** (`GET /platform/operators`) lists the users who hold `operator`, each with the user, when the assignment was made and its - grantor (`config`, ADR 075 §4). Its gate is `operator` on the platform: - operators see who else runs the deployment. It takes the new scope - `platform.read`, which no project secret holds, since no secret reaches the - operator path. Issuing operators stays configuration; there is no write. + grantor (`config`, ADR 075 §4). + - Only operators may call it: its gate is `operator` on the platform. + Nobody else, an administrator of the platform project included, reads + who runs the deployment. + - It takes the new scope `platform.read`, which no project secret holds, + since no secret reaches the operator path. + - Issuing operators stays configuration; there is no write. - **A project says whether it is the platform's.** The project resource gains `kind`: `platform` for the platform project, `standard` for every other project. It shows wherever a project does, to whoever may read that @@ -70,11 +93,62 @@ the deployment. platform project, its description and its agent note point to `listPlatformOperators`. -This labels the platform, not a person. The Console still derives what a -person may do from the check, never from `kind` or from the operator list -(ADR 054 §10). - -### 2. A person reads what their role lets them read +### 2. A person learns how they hold a project, not whether they are an operator + +- **No capability read.** `getPlatform` does not say whether the caller is + an operator, as ADR 075 decided. +- **Effective access, as ADR 054 §9 and Console ADR 0004 §5 planned.** Each + project that `getProject` and `listMyProjects` answer carries the caller's + `effective_role` (`viewer`, `editor` or `admin`) and its `sources`: + `owning_team`, `user`, `team`, and the new `platform_operator`. The check + already reports the path that allowed (ADR 075 §3), so this reads what it + decided. +- **What that answers:** an agent learns it runs the deployment from + `platform_operator` on the platform project. The Console replaces its + `getProject` probe with `effective_role`, and still derives each surface + from its own target (ADR 054 §10). + +### 3. A session has relations of its own + +Sessions are no object type today: their gate asks a role on the session's +project, `viewer` to read and `admin` to revoke. That is wrong both ways: + +- a viewer reads every session of the project, with its `metadata` and the + IP each began with; +- a person cannot read or end their own sessions on a project where they + hold no role, which is every customer of the hosted cloud on the project + their account lives in. + +The sessions are the person's own, and the people who run the project and +the deployment. The catalog gains: + +```text +type session + relations + define project: [project] + define user: [user] + define reader: user or admin from project + define revoker: user or admin from project +``` + +- **No rows per session.** `session.project` and `session.user` hold no + rows: the resolver reads them from the session itself, as it reads + `project.platform` (ADR 075 §1). Nothing is written when a session is made, + and nothing can disagree with the session (ADR 033 §2). +- **`admin from project` covers both kinds of owner.** It includes the owners + of the team that owns the project (ADR 054 §3) and the deployment's + operators (`operator from platform`, ADR 075 §1). A project secret holds + `project.admin`, so nothing changes for it. +- **The gates move:** + - `getSession` asks `reader`; + - `revokeSession` asks `revoker`; + - `querySessions` lists for `admin` on the project; + - a person who is no administrator lists their own with `listMySessions` + (§5). +- **Viewers and editors no longer read sessions.** The permission catalog's + `project_viewer` bundle drops `session.read` to match. + +### 4. A person reads what their role lets them read A read accepts a person's credential, a Console session or a person's token, and its gate decides, unless: @@ -87,38 +161,26 @@ and its gate decides, unless: - a person has an operation of their own for it: a person lists projects with `listMyProjects`, not `queryProjects`. -That opens five reads that only a project secret may call today. Each keeps -the gate it has: +That opens five reads that only a project secret may call today: | Operation | Gate | What a person newly reads | |---|---|---| -| `querySessions`, `getSession` | `viewer` | A project's sessions: user, state, factors, assurance levels, `metadata`, and the IP, user agent and fingerprint each began with | +| `querySessions`, `getSession` | §3 | Sessions: user, state, factors, assurance levels, `metadata`, and the IP, user agent and fingerprint each began with | | `listIdpRevisions` | `viewer` | The revisions of an identity provider connection | | `listProjectPreviews` | `viewer` | The project's previews | | `listDeploymentVariables` | `viewer` | The variables a deployment froze; a secret reads back as `{"secret": true}` | - **No operator special case.** An operator reads all of this on every project, because the check allows them (ADR 075 §3). Anyone else reads it - on the projects where they hold `viewer`. -- **The scopes already exist for people.** The permission catalog's - `project_viewer` bundle holds `session.read` and `idp.read`. A person's - token already uses `deployment.read` and `variable.read`, on - `listDeployments` and `listVariables`. -- **What viewers see that they could not before:** a session's factors and - `metadata`. They already read the IP and user agent of every request on - `request.api` events. `metadata` is whatever an application wrote on the - session, so an application that keeps something sensitive there shows it - to its viewers. The operation's description says so. -- **The writes that only a project secret calls stay so:** the `publish*` - writes, `createRelease`, `buildRelease`, `setVariables`, `deleteVariable`, - `setUserPassword`, `revokeSession`, `deactivateTeam`, - `removeProjectPreview` and `createProjectClaim`. Opening any of them is a - decision of its own. + where their role allows. +- **The scopes already exist for people.** A person's token already uses + `idp.read`, `deployment.read` and `variable.read`; `session.read` joins + them. - **A test holds the rule** against every read of the spec, as zitadel/nextgen#3538 holds the operations that take both a session cookie and a bearer to the ones a person's token reaches. -### 3. A person's own reads take their token +### 5. A person's own reads take their token - **The `/users/me` reads take a person's token** as well as their session: `getMyUser`, `listMyProjects`, `listMyTeams`, `getMyUserSchema`, @@ -131,17 +193,48 @@ the gate it has: shows them to a person's credential only. - **A new read, `listMySessions`** (`GET /users/me/sessions`), lists the person's own sessions with the IP and user agent each began with, under - `session.read`. It answers "where did I sign in" for a person with no role - on the project their account lives in, which is every customer of the - hosted cloud. + `session.read`. It is §3's `user` path as a list. - **The MCP endpoint's instructions** tell an agent signed in as a person to start with `getMyUser` and `listMyProjects`. -### 4. Sequence +### 6. The writes a person's credential takes + +Fifteen writes accept only a project secret today, besides an application's +sign-in. ADR 036's amendment of 2026-11-25 names the platform token from +`zitadel login`, not built yet, as the CLI's credential, and admits it where a +Console session is admitted. So the CLI could publish nothing with it until +these move. Each write keeps its gate. + +**Taken from a person, now:** + +| Operations | Gate | Why | +|---|---|---| +| `publishBranding`, `publishFlowDefinition`, `publishIdp`, `publishPolicy`, `publishSchema`, `createRelease`, `buildRelease` | `editor` | What the CLI does with a project's `.zitadel/` files. A person publishing under their own name records who changed the configuration, where a project secret records the project. `createDeployment` and `rollbackDeployment` already take a person. | +| `removeProjectPreview` | `editor` | Ends what `zitadel preview` started (`zitadel preview rm`). It is marked destructive, so the MCP endpoint asks first. | +| `revokeSession` | §3's `revoker` | A person ends their own sessions; administrators and operators end anyone's. | + +**Taken from a person, kept out of an agent's context:** + +| Operations | Gate | Why | +|---|---|---| +| `setVariables`, `deleteVariable` | `editor` | The CLI sets variables, so a person's token must. A variable's value can be a secret, and a call's arguments are the model's context. A new `x-zitadel-takes-secret` keeps an operation out of the MCP tools, as `x-zitadel-returns-secret` keeps one out for its answer (ADR 092 §4). A project secret's MCP client loses `setVariables` too. | -1. §3: a person's own reads, which change nobody's access to anyone else. -2. §2: the five reads, each with its row in the gate contract test. -3. §1: the platform resource and `kind`. +**Kept from a person's token, with reasons:** + +| Operations | Why | +|---|---| +| `setUserPassword` | Its gate asks `editor`; the catalog keeps `user.set_password` to the admin bundle. The gate contract's open note says the project-secret-only plane is what keeps an editor of the platform project from setting an operator's password. It opens to a person once the gate asks `admin` and refuses a user who holds more than the caller. | +| `deactivateTeam` | On the platform project a team is a customer account, and an administrator of the platform project is not deployment-wide (ADR 053 §9). It waits for zitadel/nextgen#3470, which decides who manages an owning team. | +| `publishApplication`, `createProjectClaim`, `createInvitation` | Each answers with a credential: a client secret, a link that gives the project, a link that gives a role. No person's token reaches one (zitadel/nextgen#3538); a Console session keeps `createInvitation`. The CLI needs the first two under `zitadel login`; see the open questions. | + +### 7. Sequence + +1. §5: a person's own reads, which change nobody's access to anyone else. +2. §3 and §4: the session type, then the five reads, each with its row in + the gate contract test. +3. §6's first table, so `zitadel login` can publish and release; then the + variable writes with `x-zitadel-takes-secret`. +4. §1 and §2: the platform resource, `kind`, and effective access. ## Consequences @@ -151,29 +244,40 @@ the gate it has: deployment, and where a person signed in, each in one call. - An operator reads every project's state through the check, as ADR 075 meant, with no operator-only path through the credential plane. -- Which reads take a person's credential is one rule, held by a test, and - not a list kept by hand. +- A person reads and ends their own sessions on any project, and nobody else + below administrator reads them. +- The CLI can publish and release under a person's name, so the events name + who changed a project's configuration. +- Which operations take a person's credential is a rule held by tests, not a + list kept by hand. ### Negative / Risks -- A project's viewers read its sessions' `metadata` and factors. -- The tool list grows by about fifteen tools for a person's credential, and - `platform.read` adds a scope a client may ask for. -- Seven `/users/me` operations and five reads change their security in the - contract, and the SDKs and the API mock follow. +- The session type is the catalog's first type below a project, and the + resolver's second implied tupleset. Viewers who read sessions today lose + them. +- The tool list grows by about twenty-five tools for a person's credential, + and `platform.read` adds a scope a client may ask for. +- About twenty operations change their security in the contract, and the + SDKs, the API mock and the CLI follow. +- A person's token, held by an agent, may now publish configuration and + build releases. What runs stays a deployment, which asks the person first. ## Open questions -1. Does `getPlatform` tell the caller whether they are an operator? An agent - asks it first. ADR 075 rejected a capability read so that the Console - would not branch on one. -2. Should a person's `querySessions` and `getSession` ask `admin` instead of - `viewer`, keeping session `metadata` to administrators, against the - catalog's viewer bundle? -3. Who besides operators may list operators: staff granted a role on the - platform project? -4. Which project-secret writes a person's credential should take, starting - with `revokeSession` for an administrator. +1. **Owners or administrators?** §3 reads "a project owner" as `admin` on + the project, which includes the owning team's owners and everyone granted + `admin`. Only the owning team's owners would need a project relation of + their own (`define owner: owner from owning_team`) and `owner from + project` on the session, which leaves out operators unless it names them + too. +2. **Credentials for the CLI.** May a first-party client's token, the CLI's, + take `publishApplication` and `createProjectClaim`, whose answers go to + the person at the terminal, while a third-party client's never does? Or + do those stay with a project secret? +3. **The password write.** Is §6's condition for `setUserPassword` the right + one, or does a person never set another person's password and send a + reset instead? ## Rejected alternatives @@ -190,12 +294,24 @@ Every customer would see the deployment's staff in their member list. ADR off every project's member list, the platform project's included, and have a list of their own. +### An "am I an operator" read + +It would be the capability read ADR 075 rejected, and the Console would +branch on it, which ADR 054 §10 forbids. Effective access with its sources +(§2) answers the same question per project, from the check. + ### Letting operators alone past the credential plane -Accepting an operator's credential on the project-secret-only reads, and no -one else's, makes operators a special case of the question every person asks -(ADR 075 §6). Opening the reads to people and letting the check decide gives -operators the same result through the same path. +Accepting an operator's credential on the project-secret-only operations, +and no one else's, makes operators a special case of the question every +person asks (ADR 075 §6). Opening them to people and letting the check +decide gives operators the same result through the same path. + +### Keeping session reads at `viewer` + +The permission catalog's viewer bundle holds `session.read`, so this was the +first draft. It shows every viewer the IP, user agent and `metadata` of +everyone's sessions, and still leaves a person unable to read their own. ### Answering "where did they sign in" from events @@ -206,11 +322,14 @@ project their account lives in, so cannot read those events at all. ## Documentation impact - ADR 075 §6: a note that the operator listing is §1 of this ADR. -- ADR 036: which reads take a person's credential. -- `docs/design/api/system-permission-catalog.md`: `platform.read`, and - `session.read` for a person. +- ADR 054 §9: `platform_operator` among the sources. +- ADR 036: which operations take a person's credential, and the CLI's. +- `docs/design/api/system-permission-catalog.md`: `platform.read`, the + session type, and `session.read` out of the viewer bundle. +- `apps/api/api/openapi/AGENTS.md`: `x-zitadel-takes-secret`. - The API reference for the new and changed operations, and their agent notes (ADR 092 §3). -- The CLI's commands for the new operations, and `SKILL.md`. +- The CLI's commands for the new operations, `zitadel login` publishing, and + `SKILL.md`. - `apps/docs/content/docs/guides/investigate-with-events.mdx`: where a person signed in, from `listMySessions` and `querySessions`. diff --git a/docs/adrs/README.md b/docs/adrs/README.md index 04a77b0809..e2c798c497 100644 --- a/docs/adrs/README.md +++ b/docs/adrs/README.md @@ -99,4 +99,4 @@ This directory contains architecture decision records (ADRs) for nextgen. | [091](091-release-pinning.md) | Release Pinning | Proposed | The app sends the release it was built against in `X-Zitadel-Release` when it starts a sign-in. Each deployment keeps a pin list per target, the earlier deployments a pin may still use, taken only from the previous deployment and its list up to the release's `.zitadel/pinning/pinning.json` `keep` (default 0), so `keep: 0` is a permanent cut. A pin outside the list gets the newest release; the response's `X-Zitadel-Release` names the release that served and a `flow.pin_not_served` event records the miss. `setUserPassword` takes no pin. Amends ADR 085 §2. | | [092](092-mcp-server.md) | MCP — the API as Tools on the Server, and the MCP Servers Zitadel Protects | Proposed | Zitadel's MCP server is an endpoint of the Go server, `/api/v1/mcp`, on unless `mcp.enabled` turns it off, so a local server, a self-hosted one and the cloud serve the same one. A tool is one operation read from the embedded OpenAPI document, and a call is that operation's own request to the API's handler with the caller's credential: a project secret today, a person's token once the OAuth pieces exist. The spec marks which operations only read (`x-zitadel-read-only`), belong to applications (`x-zitadel-plane: app`) or return a credential (`x-zitadel-returns-secret`). A client is shown the tools its credential's scopes cover, and a destructive call is sent only after the person at the client confirmed that call. Customers' MCP servers, which Zitadel protects, follow on the same OAuth pieces, and Agent Skills over MCP's Skills extension are wanted on the same endpoint. | | [093](093-policy-decision-events.md) | Policy Decision Events | Proposed | A policy gate records each evaluation as a wide event, `policy.evaluate.denied` or `policy.evaluate.allowed`, naming the policy, the revision and the failed rules. The gate writes it when it decides, best-effort and outside the operation's transaction, so the events get a category of their own, `policy`. The server setting `events.policy.decisions` (`none`, `deny` by default, `all`) selects what is recorded. Amends ADR 048 and ADR 066. | -| [094](094-platform-as-a-resource.md) | The Platform as a Resource, and What a Person May Read | Proposed | The API presents the deployment's platform as its own resource: `getPlatform`, `listPlatformOperators` (gated by `operator`, scope `platform.read`) and a project's `kind` (`platform` or `standard`); `listProjectMembers` keeps meaning roles on one project. A read accepts a person's credential and its gate decides, except app-plane reads, answers that are credentials, proofs of possession and reads a person has their own operation for, which opens `querySessions`, `getSession`, `listIdpRevisions`, `listProjectPreviews` and `listDeploymentVariables` at `viewer`. The `/users/me` reads take a person's token, and `listMySessions` lists a person's own sessions. Amends ADR 075 §6 and ADR 036. | +| [094](094-platform-as-a-resource.md) | The Platform as a Resource, and What a Person May Do | Proposed | The API presents the deployment's platform as its own resource: `getPlatform`, `listPlatformOperators` (operators only, scope `platform.read`) and a project's `kind`; a person learns how they hold a project from its effective role and sources, `platform_operator` among them, never from a capability read. Sessions get a type of their own, read and revoked by their user and the project's administrators, operators included. A read takes a person's credential and its gate decides, which opens five project-secret-only reads; the `/users/me` reads take a person's token, with a new `listMySessions`; the CLI's release-time writes take a person, variable writes are kept out of MCP tools, and `setUserPassword`, `deactivateTeam` and the operations that answer with a credential stay as they are. Amends ADR 075 §6, ADR 054 §9 and ADR 036. | From 3008b07b196df7ba55bc90db30b5edf5f2467b1d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 01:03:52 +0000 Subject: [PATCH 03/10] docs: record ADR 094's answers on project owners and password writes A project owner is admin on the project, operators included. setUserPassword takes a person at admin, raised from editor, and nobody but an operator sets an operator's password. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U --- docs/adrs/094-platform-as-a-resource.md | 25 ++++++++++--------------- docs/adrs/README.md | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/docs/adrs/094-platform-as-a-resource.md b/docs/adrs/094-platform-as-a-resource.md index 12240e411f..b39f8ae827 100644 --- a/docs/adrs/094-platform-as-a-resource.md +++ b/docs/adrs/094-platform-as-a-resource.md @@ -135,10 +135,11 @@ type session rows: the resolver reads them from the session itself, as it reads `project.platform` (ADR 075 §1). Nothing is written when a session is made, and nothing can disagree with the session (ADR 033 §2). -- **`admin from project` covers both kinds of owner.** It includes the owners - of the team that owns the project (ADR 054 §3) and the deployment's - operators (`operator from platform`, ADR 075 §1). A project secret holds - `project.admin`, so nothing changes for it. +- **`admin from project` covers both kinds of owner.** "A project owner" is + `admin` on the project, as decided on 2026-12-02. It includes the owners + of the team that owns the project (ADR 054 §3), everyone granted `admin`, + and the deployment's operators (`operator from platform`, ADR 075 §1). A + project secret holds `project.admin`, so nothing changes for it. - **The gates move:** - `getSession` asks `reader`; - `revokeSession` asks `revoker`; @@ -212,6 +213,7 @@ these move. Each write keeps its gate. | `publishBranding`, `publishFlowDefinition`, `publishIdp`, `publishPolicy`, `publishSchema`, `createRelease`, `buildRelease` | `editor` | What the CLI does with a project's `.zitadel/` files. A person publishing under their own name records who changed the configuration, where a project secret records the project. `createDeployment` and `rollbackDeployment` already take a person. | | `removeProjectPreview` | `editor` | Ends what `zitadel preview` started (`zitadel preview rm`). It is marked destructive, so the MCP endpoint asks first. | | `revokeSession` | §3's `revoker` | A person ends their own sessions; administrators and operators end anyone's. | +| `setUserPassword` | `admin`, raised from `editor` | An administrator of the user's project or an operator sets another person's password, as decided on 2026-12-02; the catalog already keeps `user.set_password` to the admin bundle. Nobody but an operator sets an operator's password: an administrator of the platform project is not deployment-wide (ADR 053 §9), and the project-secret-only plane was what kept them off it. | **Taken from a person, kept out of an agent's context:** @@ -223,7 +225,6 @@ these move. Each write keeps its gate. | Operations | Why | |---|---| -| `setUserPassword` | Its gate asks `editor`; the catalog keeps `user.set_password` to the admin bundle. The gate contract's open note says the project-secret-only plane is what keeps an editor of the platform project from setting an operator's password. It opens to a person once the gate asks `admin` and refuses a user who holds more than the caller. | | `deactivateTeam` | On the platform project a team is a customer account, and an administrator of the platform project is not deployment-wide (ADR 053 §9). It waits for zitadel/nextgen#3470, which decides who manages an owning team. | | `publishApplication`, `createProjectClaim`, `createInvitation` | Each answers with a credential: a client secret, a link that gives the project, a link that gives a role. No person's token reaches one (zitadel/nextgen#3538); a Console session keeps `createInvitation`. The CLI needs the first two under `zitadel login`; see the open questions. | @@ -265,19 +266,13 @@ these move. Each write keeps its gate. ## Open questions -1. **Owners or administrators?** §3 reads "a project owner" as `admin` on - the project, which includes the owning team's owners and everyone granted - `admin`. Only the owning team's owners would need a project relation of - their own (`define owner: owner from owning_team`) and `owner from - project` on the session, which leaves out operators unless it names them - too. -2. **Credentials for the CLI.** May a first-party client's token, the CLI's, +1. **Credentials for the CLI.** May a first-party client's token, the CLI's, take `publishApplication` and `createProjectClaim`, whose answers go to the person at the terminal, while a third-party client's never does? Or do those stay with a project secret? -3. **The password write.** Is §6's condition for `setUserPassword` the right - one, or does a person never set another person's password and send a - reset instead? +2. **The operator guard on `setUserPassword`.** How is "the user holds + `operator`" checked when the write is decided, and does the same guard + belong on the other writes to a platform-project user? ## Rejected alternatives diff --git a/docs/adrs/README.md b/docs/adrs/README.md index e2c798c497..4132a2097c 100644 --- a/docs/adrs/README.md +++ b/docs/adrs/README.md @@ -99,4 +99,4 @@ This directory contains architecture decision records (ADRs) for nextgen. | [091](091-release-pinning.md) | Release Pinning | Proposed | The app sends the release it was built against in `X-Zitadel-Release` when it starts a sign-in. Each deployment keeps a pin list per target, the earlier deployments a pin may still use, taken only from the previous deployment and its list up to the release's `.zitadel/pinning/pinning.json` `keep` (default 0), so `keep: 0` is a permanent cut. A pin outside the list gets the newest release; the response's `X-Zitadel-Release` names the release that served and a `flow.pin_not_served` event records the miss. `setUserPassword` takes no pin. Amends ADR 085 §2. | | [092](092-mcp-server.md) | MCP — the API as Tools on the Server, and the MCP Servers Zitadel Protects | Proposed | Zitadel's MCP server is an endpoint of the Go server, `/api/v1/mcp`, on unless `mcp.enabled` turns it off, so a local server, a self-hosted one and the cloud serve the same one. A tool is one operation read from the embedded OpenAPI document, and a call is that operation's own request to the API's handler with the caller's credential: a project secret today, a person's token once the OAuth pieces exist. The spec marks which operations only read (`x-zitadel-read-only`), belong to applications (`x-zitadel-plane: app`) or return a credential (`x-zitadel-returns-secret`). A client is shown the tools its credential's scopes cover, and a destructive call is sent only after the person at the client confirmed that call. Customers' MCP servers, which Zitadel protects, follow on the same OAuth pieces, and Agent Skills over MCP's Skills extension are wanted on the same endpoint. | | [093](093-policy-decision-events.md) | Policy Decision Events | Proposed | A policy gate records each evaluation as a wide event, `policy.evaluate.denied` or `policy.evaluate.allowed`, naming the policy, the revision and the failed rules. The gate writes it when it decides, best-effort and outside the operation's transaction, so the events get a category of their own, `policy`. The server setting `events.policy.decisions` (`none`, `deny` by default, `all`) selects what is recorded. Amends ADR 048 and ADR 066. | -| [094](094-platform-as-a-resource.md) | The Platform as a Resource, and What a Person May Do | Proposed | The API presents the deployment's platform as its own resource: `getPlatform`, `listPlatformOperators` (operators only, scope `platform.read`) and a project's `kind`; a person learns how they hold a project from its effective role and sources, `platform_operator` among them, never from a capability read. Sessions get a type of their own, read and revoked by their user and the project's administrators, operators included. A read takes a person's credential and its gate decides, which opens five project-secret-only reads; the `/users/me` reads take a person's token, with a new `listMySessions`; the CLI's release-time writes take a person, variable writes are kept out of MCP tools, and `setUserPassword`, `deactivateTeam` and the operations that answer with a credential stay as they are. Amends ADR 075 §6, ADR 054 §9 and ADR 036. | +| [094](094-platform-as-a-resource.md) | The Platform as a Resource, and What a Person May Do | Proposed | The API presents the deployment's platform as its own resource: `getPlatform`, `listPlatformOperators` (operators only, scope `platform.read`) and a project's `kind`; a person learns how they hold a project from its effective role and sources, `platform_operator` among them, never from a capability read. Sessions get a type of their own, read and revoked by their user and the project's administrators, operators included. A read takes a person's credential and its gate decides, which opens five project-secret-only reads; the `/users/me` reads take a person's token, with a new `listMySessions`; the CLI's release-time writes take a person, variable writes are kept out of MCP tools, `setUserPassword` asks `admin` and only an operator sets an operator's password, and `deactivateTeam` and the operations that answer with a credential stay as they are. Amends ADR 075 §6, ADR 054 §9 and ADR 036. | From deec7a85266631f7a65ad86d7f15eff729ab03d1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 01:09:25 +0000 Subject: [PATCH 04/10] docs: recast ADR 094 as the project permission model under the platform root Projects carry the workload, so the model is stated per project and the platform enters only as `operator from platform`. Adds the session type with implied tuplesets and its migrations, a cover check for writes that can take over or lock out a user, one credential-class rule, pinned first-party clients for credentials in an answer, the effective-access shape, a table of where the catalog and the gate contract disagree, and the escalation paths. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0137eGmTDLdAX6MvNFrobbNT --- docs/adrs/094-platform-as-a-resource.md | 330 ------------ docs/adrs/094-project-permission-model.md | 583 ++++++++++++++++++++++ docs/adrs/README.md | 2 +- 3 files changed, 584 insertions(+), 331 deletions(-) delete mode 100644 docs/adrs/094-platform-as-a-resource.md create mode 100644 docs/adrs/094-project-permission-model.md diff --git a/docs/adrs/094-platform-as-a-resource.md b/docs/adrs/094-platform-as-a-resource.md deleted file mode 100644 index b39f8ae827..0000000000 --- a/docs/adrs/094-platform-as-a-resource.md +++ /dev/null @@ -1,330 +0,0 @@ -# ADR 094: The Platform as a Resource, and What a Person May Do - -> **Status:** Proposed -> **Date:** 2026-12-02 -> **Amends:** [ADR 075](075-platform-operators.md) §6 and its rejected -> alternative "A separate listing and a capability read for operators" (an -> operator listing), [ADR 036](036-api-credential-planes.md) (which operations -> take a person's credential), [ADR 054](054-customer-collaboration-grants.md) -> §9 (effective access names the operator path) -> **Related:** [ADR 033](033-internal-permission-management.md), -> [ADR 053](053-cross-project-principals.md), -> [ADR 092](092-mcp-server.md) §8, -> [Console ADR 0004](../../apps/console/docs/adrs/0004-console-deployment-modes.md) §5 - -## Context - -ADR 075 §1 puts one `platform` object above every project of a deployment, -with an `operator` relation that administers them all. The API shows no such -object. The platform is a project like any other, the platform project, which -holds: - -- the hosted cloud's customer accounts, as its users; -- the customer accounts and access teams, as its teams (ADR 054); -- the Console's sign-in and the platform issuer at `/oauth`; -- a release with the OAuth settings and the `auth.client.admit` policy. - -On 2026-12-01 a person connected an MCP client to the hosted cloud as its -bootstrap admin, an operator, and had it investigate. What went wrong: - -- **"Who is admin here?" got an empty answer.** `listProjectMembers` lists - owning teams and grants. An operator holds neither, so the platform - project's list was empty, with nothing to say why. -- **The agent could not tell the platform project from a customer's.** Its - users are every customer's account, not one customer's users. -- **An operator was refused what the check would allow.** The check allows an - operator every role on every project (ADR 075 §3). But about thirty - operations accept only a project secret, so every person is refused before - the check runs, an operator included. Among them are `querySessions` and - `getSession`, whose sessions record the IP and user agent each began with: - the one-call answer to "where did this person sign in from". The agent - pieced it together from events instead, in 19 calls. -- **A person's agent cannot find its own projects.** The `/users/me` reads, - `listMyProjects` among them, accept only a session cookie. A person signed - in through an OAuth client cannot list the projects they can act on or ask - who they are, and the MCP endpoint offers none of them. - -What the records already decide about telling a person they are an operator: - -- **ADR 075 §6:** operators get "no listing, label or Console view of their - own", and "nothing in [the Console] depends on knowing who is an operator, - so there is no capability read either". Its rejected alternatives turn - down "an endpoint telling the Console who is an operator". -- **ADR 054 §10:** the Console derives each capability on its own, and never - from being a platform-project user, a platform team's owner or a project - administrator. -- **ADR 054 §9:** a project listing may return the caller's effective role - and its sources (`owning_team`, `user:`, `team:`). It is not built: - a project answers its fields and nothing about the caller. -- **Console ADR 0004 §5:** the server answers the person's effective - permissions on a target, and the Console renders from them. Until that - exists, the Console reads `GET /projects/{platform_project_id}` and treats - a `403` or `404` as "not yours". -- **Already public:** the Console's runtime document names the platform - project (`platform_project_id`), and `listMyProjects` takes - `exclude_platform`. - -So the records answer "which projects can I act on, and how", not "am I an -operator". No operation answers either yet. - -## Decision - -### 1. The platform is a resource of the API - -- **`getPlatform`** (`GET /platform`) answers the deployment's platform: the - platform project's `project_id`, and the platform issuer when OAuth is on, - as the Console's runtime document already does. Any authenticated caller - may read it. A deployment without a platform project answers `404`. -- **`listPlatformOperators`** (`GET /platform/operators`) lists the users who - hold `operator`, each with the user, when the assignment was made and its - grantor (`config`, ADR 075 §4). - - Only operators may call it: its gate is `operator` on the platform. - Nobody else, an administrator of the platform project included, reads - who runs the deployment. - - It takes the new scope `platform.read`, which no project secret holds, - since no secret reaches the operator path. - - Issuing operators stays configuration; there is no write. -- **A project says whether it is the platform's.** The project resource gains - `kind`: `platform` for the platform project, `standard` for every other - project. It shows wherever a project does, to whoever may read that - project, which for the platform project is its operators and the people - granted a role on it. Customers never see it. -- **`listProjectMembers` keeps its meaning:** roles on one project. On the - platform project, its description and its agent note point to - `listPlatformOperators`. - -### 2. A person learns how they hold a project, not whether they are an operator - -- **No capability read.** `getPlatform` does not say whether the caller is - an operator, as ADR 075 decided. -- **Effective access, as ADR 054 §9 and Console ADR 0004 §5 planned.** Each - project that `getProject` and `listMyProjects` answer carries the caller's - `effective_role` (`viewer`, `editor` or `admin`) and its `sources`: - `owning_team`, `user`, `team`, and the new `platform_operator`. The check - already reports the path that allowed (ADR 075 §3), so this reads what it - decided. -- **What that answers:** an agent learns it runs the deployment from - `platform_operator` on the platform project. The Console replaces its - `getProject` probe with `effective_role`, and still derives each surface - from its own target (ADR 054 §10). - -### 3. A session has relations of its own - -Sessions are no object type today: their gate asks a role on the session's -project, `viewer` to read and `admin` to revoke. That is wrong both ways: - -- a viewer reads every session of the project, with its `metadata` and the - IP each began with; -- a person cannot read or end their own sessions on a project where they - hold no role, which is every customer of the hosted cloud on the project - their account lives in. - -The sessions are the person's own, and the people who run the project and -the deployment. The catalog gains: - -```text -type session - relations - define project: [project] - define user: [user] - define reader: user or admin from project - define revoker: user or admin from project -``` - -- **No rows per session.** `session.project` and `session.user` hold no - rows: the resolver reads them from the session itself, as it reads - `project.platform` (ADR 075 §1). Nothing is written when a session is made, - and nothing can disagree with the session (ADR 033 §2). -- **`admin from project` covers both kinds of owner.** "A project owner" is - `admin` on the project, as decided on 2026-12-02. It includes the owners - of the team that owns the project (ADR 054 §3), everyone granted `admin`, - and the deployment's operators (`operator from platform`, ADR 075 §1). A - project secret holds `project.admin`, so nothing changes for it. -- **The gates move:** - - `getSession` asks `reader`; - - `revokeSession` asks `revoker`; - - `querySessions` lists for `admin` on the project; - - a person who is no administrator lists their own with `listMySessions` - (§5). -- **Viewers and editors no longer read sessions.** The permission catalog's - `project_viewer` bundle drops `session.read` to match. - -### 4. A person reads what their role lets them read - -A read accepts a person's credential, a Console session or a person's token, -and its gate decides, unless: - -- it serves an application's sign-in (`x-zitadel-plane: app`), as - `getAuthAttempt` does; -- its answer is a credential (`x-zitadel-returns-secret`); -- it proves possession of a secret, as `getProjectClaimStatus` does - (ADR 046 §3); -- a person has an operation of their own for it: a person lists projects with - `listMyProjects`, not `queryProjects`. - -That opens five reads that only a project secret may call today: - -| Operation | Gate | What a person newly reads | -|---|---|---| -| `querySessions`, `getSession` | §3 | Sessions: user, state, factors, assurance levels, `metadata`, and the IP, user agent and fingerprint each began with | -| `listIdpRevisions` | `viewer` | The revisions of an identity provider connection | -| `listProjectPreviews` | `viewer` | The project's previews | -| `listDeploymentVariables` | `viewer` | The variables a deployment froze; a secret reads back as `{"secret": true}` | - -- **No operator special case.** An operator reads all of this on every - project, because the check allows them (ADR 075 §3). Anyone else reads it - where their role allows. -- **The scopes already exist for people.** A person's token already uses - `idp.read`, `deployment.read` and `variable.read`; `session.read` joins - them. -- **A test holds the rule** against every read of the spec, as - zitadel/nextgen#3538 holds the operations that take both a session cookie - and a bearer to the ones a person's token reaches. - -### 5. A person's own reads take their token - -- **The `/users/me` reads take a person's token** as well as their session: - `getMyUser`, `listMyProjects`, `listMyTeams`, `getMyUserSchema`, - `listMyPasskeys`, `listMyIdentityLinks` and `getMyPasswordState`. - - Each names the scope of what it reads, since every operation a person's - token reaches names one: `user.read`, `project.read` for - `listMyProjects`, `team.read` for `listMyTeams`, `schema.read` for - `getMyUserSchema`. - - A project secret has no self, so these refuse it. The MCP endpoint - shows them to a person's credential only. -- **A new read, `listMySessions`** (`GET /users/me/sessions`), lists the - person's own sessions with the IP and user agent each began with, under - `session.read`. It is §3's `user` path as a list. -- **The MCP endpoint's instructions** tell an agent signed in as a person to - start with `getMyUser` and `listMyProjects`. - -### 6. The writes a person's credential takes - -Fifteen writes accept only a project secret today, besides an application's -sign-in. ADR 036's amendment of 2026-11-25 names the platform token from -`zitadel login`, not built yet, as the CLI's credential, and admits it where a -Console session is admitted. So the CLI could publish nothing with it until -these move. Each write keeps its gate. - -**Taken from a person, now:** - -| Operations | Gate | Why | -|---|---|---| -| `publishBranding`, `publishFlowDefinition`, `publishIdp`, `publishPolicy`, `publishSchema`, `createRelease`, `buildRelease` | `editor` | What the CLI does with a project's `.zitadel/` files. A person publishing under their own name records who changed the configuration, where a project secret records the project. `createDeployment` and `rollbackDeployment` already take a person. | -| `removeProjectPreview` | `editor` | Ends what `zitadel preview` started (`zitadel preview rm`). It is marked destructive, so the MCP endpoint asks first. | -| `revokeSession` | §3's `revoker` | A person ends their own sessions; administrators and operators end anyone's. | -| `setUserPassword` | `admin`, raised from `editor` | An administrator of the user's project or an operator sets another person's password, as decided on 2026-12-02; the catalog already keeps `user.set_password` to the admin bundle. Nobody but an operator sets an operator's password: an administrator of the platform project is not deployment-wide (ADR 053 §9), and the project-secret-only plane was what kept them off it. | - -**Taken from a person, kept out of an agent's context:** - -| Operations | Gate | Why | -|---|---|---| -| `setVariables`, `deleteVariable` | `editor` | The CLI sets variables, so a person's token must. A variable's value can be a secret, and a call's arguments are the model's context. A new `x-zitadel-takes-secret` keeps an operation out of the MCP tools, as `x-zitadel-returns-secret` keeps one out for its answer (ADR 092 §4). A project secret's MCP client loses `setVariables` too. | - -**Kept from a person's token, with reasons:** - -| Operations | Why | -|---|---| -| `deactivateTeam` | On the platform project a team is a customer account, and an administrator of the platform project is not deployment-wide (ADR 053 §9). It waits for zitadel/nextgen#3470, which decides who manages an owning team. | -| `publishApplication`, `createProjectClaim`, `createInvitation` | Each answers with a credential: a client secret, a link that gives the project, a link that gives a role. No person's token reaches one (zitadel/nextgen#3538); a Console session keeps `createInvitation`. The CLI needs the first two under `zitadel login`; see the open questions. | - -### 7. Sequence - -1. §5: a person's own reads, which change nobody's access to anyone else. -2. §3 and §4: the session type, then the five reads, each with its row in - the gate contract test. -3. §6's first table, so `zitadel login` can publish and release; then the - variable writes with `x-zitadel-takes-secret`. -4. §1 and §2: the platform resource, `kind`, and effective access. - -## Consequences - -### Positive - -- An agent signed in as a person finds its projects, who runs the - deployment, and where a person signed in, each in one call. -- An operator reads every project's state through the check, as ADR 075 - meant, with no operator-only path through the credential plane. -- A person reads and ends their own sessions on any project, and nobody else - below administrator reads them. -- The CLI can publish and release under a person's name, so the events name - who changed a project's configuration. -- Which operations take a person's credential is a rule held by tests, not a - list kept by hand. - -### Negative / Risks - -- The session type is the catalog's first type below a project, and the - resolver's second implied tupleset. Viewers who read sessions today lose - them. -- The tool list grows by about twenty-five tools for a person's credential, - and `platform.read` adds a scope a client may ask for. -- About twenty operations change their security in the contract, and the - SDKs, the API mock and the CLI follow. -- A person's token, held by an agent, may now publish configuration and - build releases. What runs stays a deployment, which asks the person first. - -## Open questions - -1. **Credentials for the CLI.** May a first-party client's token, the CLI's, - take `publishApplication` and `createProjectClaim`, whose answers go to - the person at the terminal, while a third-party client's never does? Or - do those stay with a project secret? -2. **The operator guard on `setUserPassword`.** How is "the user holds - `operator`" checked when the write is decided, and does the same guard - belong on the other writes to a platform-project user? - -## Rejected alternatives - -### Taking the platform out of the project machinery - -A platform stored apart from projects would need its own users, teams, -sign-in, issuer and release. The project machinery already provides each one. -The API can present the platform as its own resource without moving it. - -### Listing operators as members of every project - -Every customer would see the deployment's staff in their member list. ADR -075 §5 shows customers what operators change, not who could. Operators stay -off every project's member list, the platform project's included, and have a -list of their own. - -### An "am I an operator" read - -It would be the capability read ADR 075 rejected, and the Console would -branch on it, which ADR 054 §10 forbids. Effective access with its sources -(§2) answers the same question per project, from the check. - -### Letting operators alone past the credential plane - -Accepting an operator's credential on the project-secret-only operations, -and no one else's, makes operators a special case of the question every -person asks (ADR 075 §6). Opening them to people and letting the check -decide gives operators the same result through the same path. - -### Keeping session reads at `viewer` - -The permission catalog's viewer bundle holds `session.read`, so this was the -first draft. It shows every viewer the IP, user agent and `metadata` of -everyone's sessions, and still leaves a person unable to read their own. - -### Answering "where did they sign in" from events - -The IP of a sign-in is on its `request.api` events, which an agent joins by -`correlation_id`, one call per sign-in. A customer holds no role on the -project their account lives in, so cannot read those events at all. - -## Documentation impact - -- ADR 075 §6: a note that the operator listing is §1 of this ADR. -- ADR 054 §9: `platform_operator` among the sources. -- ADR 036: which operations take a person's credential, and the CLI's. -- `docs/design/api/system-permission-catalog.md`: `platform.read`, the - session type, and `session.read` out of the viewer bundle. -- `apps/api/api/openapi/AGENTS.md`: `x-zitadel-takes-secret`. -- The API reference for the new and changed operations, and their agent - notes (ADR 092 §3). -- The CLI's commands for the new operations, `zitadel login` publishing, and - `SKILL.md`. -- `apps/docs/content/docs/guides/investigate-with-events.mdx`: where a person - signed in, from `listMySessions` and `querySessions`. diff --git a/docs/adrs/094-project-permission-model.md b/docs/adrs/094-project-permission-model.md new file mode 100644 index 0000000000..6c287ec441 --- /dev/null +++ b/docs/adrs/094-project-permission-model.md @@ -0,0 +1,583 @@ +# ADR 094: Projects Carry the Permission Model, the Platform Is Its Root + +> **Status:** Proposed +> **Date:** 2026-12-02 +> **Amends:** [ADR 075](075-platform-operators.md) §6 and its rejected +> alternative "A separate listing and a capability read for operators" (an +> operator listing), [ADR 036](036-api-credential-planes.md) (which operations +> take a person's credential), [ADR 054](054-customer-collaboration-grants.md) +> §9 (the shape of effective access, with the operator path among its sources) +> **Related:** [ADR 033](033-internal-permission-management.md), +> [ADR 053](053-cross-project-principals.md) §9, +> [ADR 082](082-oauth-and-oidc-server.md) §3, +> [ADR 086](086-invitations.md), +> [ADR 092](092-mcp-server.md) §4 and §8, +> [Console ADR 0004](../../apps/console/docs/adrs/0004-console-deployment-modes.md) §5, +> [#3470](https://github.com/zitadel/nextgen/issues/3470) + +## Context + +Zitadel's workload lives in projects: each one holds its own users, teams, +sessions, applications, sign-in configuration, releases and deployments. The +deployment's platform is the root above them and its back office. Its project +holds the hosted cloud's customer accounts, the teams that own customer +projects (ADR 054), the Console's sign-in and the platform issuer. Its +operators (ADR 075) administer every project. + +The catalog already reads this way. `platform.operator` closes to +`project.admin` on every project through the implied `project.platform` +tupleset (ADR 075 §1). The API does not. It shows no platform. It presents +the platform project as one more project. And it answers some questions about +a project only to a project secret, so the people who run a project, and the +operators above them, cannot ask them. + +On 2026-12-01 a person connected an MCP client to the hosted cloud as its +bootstrap admin, an operator, and had it investigate: + +- **"Who is admin here?" was empty.** `listProjectMembers` lists owning teams + and grants. An operator holds neither, so the platform project's list was + empty, with nothing to say why. +- **The agent could not tell the platform project from a customer's.** Its + users are every customer's account, not one customer's users. +- **An operator was refused what the check allows.** About thirty operations + accept only a project secret, so every person is refused before the check + runs, an operator included. Among them are `querySessions` and `getSession`, + whose sessions record the IP and user agent each began with: the one-call + answer to "where did this person sign in from". The agent pieced it together + from events instead, in 19 calls. +- **A person's agent cannot find its own projects.** The `/users/me` reads, + `listMyProjects` among them, accept only a session cookie. + +Three gaps sit under those symptoms. Each is a gap in the project model, not +in the platform: + +1. **Nothing below a project has relations of its own.** Every gate asks + `viewer`, `editor` or `admin` on a project, so a session is read by + everyone who can view its project and by nobody else, its own user + included. +2. **Which credential an operation takes was decided operation by operation** + (ADR 036), and recorded in `userBoundSessionOperations`, a list kept for + another purpose (zitadel/nextgen#3538). +3. **A write to a user does not look at what the user holds.** Today the + project-secret-only plane keeps a platform-project editor from setting an + operator's password (the gate contract's `openCredentialTier`). That + protects the platform project only by accident, and it fails as soon as a + person's credential is admitted. + +## Decision + +### 1. The shape: a root, projects, and objects below a project + +- **One permission model, per project.** Every project, the platform + project included, has the same types, relations and gates. Nothing in the + model names the platform project. +- **The platform enters the model at one point:** `operator from platform` + on `project.admin`. An operator holds `admin` on every project through that + edge, and every role closes from `admin`. Nothing else reaches across + projects, except the cross-project grants of ADR 053. +- **The platform project is a project with back-office contents.** Its users + are customer accounts, its teams own customer projects, and its sign-in is + the Console's. Two rules hold for it because of those contents, and both are + stated in project terms so they apply anywhere the same contents appear: + - the configuration that signs people in to it is written by its admins + only (`requirePlatformConfigurationAdmin`, Console ADR 0004 §1); + - a write to a user is checked against what that user holds on other + projects (§4). On the platform project that protects the customers' + projects and the operators. +- **Objects below a project get relations of their own** when their access + differs from their project's roles. Sessions are the first (§3). Their + parent and their owner are implied from their own row, never stored as + tuples. + +### 2. The catalog + +The seeded catalog after this ADR, in the OpenFGA form the earlier ADRs use. +The first five types are unchanged. `session` is new. + +```text +type user + +type team + relations + define member: [user] + +type platform + relations + define operator: [user] # issued by configuration only (ADR 075 §4) + +type project + relations + define platform: [platform] # implied: the deployment's one platform + define team: [team] # the owning team (ADR 054 §2) + define admin: [user, team#member] or member from team or operator from platform + define editor: [user, team#member] or admin + define viewer: [user, team#member] or editor + +type session + relations + define project: [project] # implied: sessions.project_id + define user: [user] # implied: sessions.user_id + define reader: user or admin from project + define revoker: user or admin from project +``` + +**Implied tuplesets.** A relation whose comment says "implied" holds no rows. +Its tuple is a fact about the object, read from where the object is stored: + +| Tupleset | Read from | Resolved by | +|---|---|---| +| `project.platform` | the deployment: every project | SQL, the operator path (`writePlatformOperatorExists`), as today | +| `session.project` | `resource_scope_index` (`resource_kind = 'session'`), which already holds every session's project | the resolver: it asks `admin` on that project with a full Check | +| `session.user` | `sessions.user_id`, with the session's project | the resolver: it compares the caller, a user homed in the session's project, with the session's user, and asks nothing | + +- **The resolver, not SQL, follows `session.project`.** A Check of + `session#reader` becomes two questions: is the caller the session's user, + and does the caller hold `admin` on the session's project. The second is + the Check the gates already ask, so it already includes owning teams, + grants, team grants and the operator path. Nothing in + `writePlatformOperatorExists` changes: its edge filter takes only tupleset + `platform`, so the session's edges never match it. +- **Nothing writes a session tuple.** `ValidateAssignment` refuses any + assignment whose `object_type` is `session`, as it refuses a malformed + platform one (`ErrPlatformAssignmentShape`). A relation that only the row + decides cannot be granted around the row. +- **Lists need no new predicate.** `querySessions` gates project-wide on + `admin`: an admin's list is every session of the project, and anyone else + is refused. A person lists their own sessions with `listMySessions` (§6), + whose filter is `user_id`, not a resolver predicate. `resource_scope_index` + gains no column. +- **Migrations, one per dialect** (Postgres, SQLite, Spanner, each at its + next number), additive like `platform_operator`: + - `authz_relations`: `(session, project)`, `(session, user)`, + `(session, reader)`, `(session, revoker)`; + - `authz_relation_references`: `session.project → project`, + `session.user → user`; + - `authz_expression_edges`, for each of `reader` and `revoker`: a + `computed_userset` on `session.user` at position 0, and a + `tuple_to_userset` with source `project.admin` and tupleset + `session.project` at position 1; + - `authz_relation_closure`: the reflexive rows. No existing closure + changes. + - The `Down` deletes exactly these rows, as `platform_operator`'s does. +- **The compiler and the oracle learn the implied set.** `domain` gains + `AuthzImpliedTuplesets`, `{project.platform, session.project, session.user}`. + The compiler refuses an implied tupleset that is not in that set, so a new + one is a decision. The oracle (`resolver/oracle.go`) mirrors the resolver + for `session`, and its property tests cover the session's user, a + project admin, an operator, a viewer and a stranger. + +### 3. Sessions + +Decided on 2026-12-02. A session is read and revoked by its own user, by an +administrator of its project ("a project owner" means `admin`), and by +operators. Viewers and editors no longer read sessions. + +| Operation | Today | After | +|---|---|---| +| `getSession` | `viewer` on the project, project secret only | `session#reader` | +| `revokeSession` | `admin` on the project, project secret only | `session#revoker` | +| `querySessions` | `viewer` on the project, project secret only | `admin` on the project | +| `listMySessions` (new, §6) | none | the caller's own sessions | + +- `admin from project` includes the owning team's members (ADR 054 §3), + everyone granted `admin`, and the operators. A project secret holds + `project.admin`, so nothing changes for it. +- On the platform project, a customer reads and ends their own Console + sessions. An admin of the platform project reads every customer's, and an + admin of a workload project reads that project's sessions. That is the + "owners and operators" rule, stated per project. +- A session read never answers the session's token. `getSession` and + `querySessions` keep no `x-zitadel-returns-secret`, and a test holds it + (§5). +- The permission catalog's `project_viewer` bundle drops `session.read`. + +### 4. Writes to a user are checked against what the user holds + +Decided on 2026-12-02: an administrator of the user's project, or an +operator, may set another person's password. The draft added that only an +operator sets an operator's password. This section states that rule as a +property of every project. + +**The rule.** A write that can take over or lock out a user needs `admin` on +the user's project, and the caller must cover the target. The caller covers +the target when, for every role the target holds on any project, the caller +holds at least that role there, and, when the target holds +`platform.operator`, the caller holds it too. + +- **Where it applies:** + - the credential tier: `setUserPassword`, `createUserPasskeyRegistration`, + `completeUserPasskeyRegistration`, and any later factor reset + (`credentialTierPath`); + - `deleteUser` (lockout); + - `updateUser` when it changes an attribute a sign-in identifies by (the + email or the username). The catalog's `user.write` row already warns that + an editor changing identifiers is safe only while no sign-in trusts the + email alone. This closes that before `magic_link` or `otp` arrive, rather + than after. +- **How it is computed.** The target's roles are what `listMyProjects` would + answer for the target: their direct grants, their team grants and their + owning-team memberships, with the role each gives. The caller must hold at + least that role on each of those projects. Each is one `CheckProjects` + call, which is already one statement for the grants and at most one for + the operator path. +- **It is a later check, not a relation.** "Holds everything the target + holds" compares two principals' whole grant sets, which no OpenFGA relation + expresses. It runs after the gate, like `requirePlatformConfigurationAdmin`, + and its rows go in `authz_later_checks_internal_test.go`. A refusal answers + the operation's `permission_denied`. +- **What it does on each kind of project:** + - On a workload project, whose users hold no role elsewhere, it is just + `admin`. + - On the platform project, a customer account holds `admin` on the + customer's projects, so only someone who also holds that, an operator in + practice, may take the account over. An admin of the platform project + cannot. This is ADR 053 §9 enforced at the write. + - It answers the draft's second open question ("how is 'the user holds + operator' checked"): the operator is one of the roles covered. +- **`openCredentialTier` closes.** The three credential-tier rows move to + `admin`. `TestCredentialTierOperationsRefuseTheSessionCookie` becomes a test + that every credential-tier operation asks `admin` and runs the cover check, + whichever of a project secret, a Console cookie or a person's token calls + it. After that, the cookie may call them too. + +### 5. Which credential an operation takes: one rule + +ADR 036 split the planes. This replaces the per-operation list with a rule +the spec carries and a test holds. + +| Class | Marked by | Project secret | Console session | Person's token | Through the MCP endpoint | +|---|---|---|---|---|---| +| Application sign-in | `x-zitadel-plane: app` | yes | no | no | no | +| Read | `GET`, or `x-zitadel-read-only` | yes | yes | yes, with the scope it names | yes | +| Write | everything else | yes | yes | yes, with the scope it names | yes, destructive ones ask first | +| Takes a secret | `x-zitadel-takes-secret` (new) | yes | yes | yes | no | +| Returns a credential | `x-zitadel-returns-secret` | yes | `createInvitation` only, as today | a pinned first-party client only (§8) | no | +| Proves possession | `getProjectClaimStatus` (ADR 046 §3) | yes | no | no | no | +| Self | `/users/me/*` | no: a secret has no self | yes | yes | yes | +| Twin of a self read | `queryProjects` (a person uses `listMyProjects`) | yes | no | no | no | + +- **The gate decides, not the plane.** Within a class that admits a person, + their role decides through the operation's gate. An operator passes because + the check allows them, not because the plane names them. +- **Scopes.** Every operation that admits a person's token names a scope + (`TestEveryOperationAPersonsTokenReachesNamesAScope`). This ADR adds: + - `session.read` and `session.delete`, which the catalog already declares; + - `user.set_password` for the credential tier. It is the catalog's own + split: the spec names `user.write` there today, which the catalog lists + as drift. An agent's token then takes over no account unless it was + issued for exactly that; + - `platform.read` for `listPlatformOperators` (§9). +- **The tests:** + - `TestEveryOperationTakesTheCredentialsItsClassAdmits` replaces + `userBoundSessionOperations` as the authority. The map stays only for + what it was made for, which operations skip an anonymous building cookie. + - zitadel/nextgen#3538's `TestAPersonsTokenReachesWhatASessionReaches` + holds the same equality from the other side. + - `TestNoReadAnswersASecretUnmarked` checks every read's response schema + against `x-zitadel-returns-secret`. + +What this opens, beyond §3 and §6, read by role: + +| Operation | Gate | Class | +|---|---|---| +| `listIdpRevisions`, `listProjectPreviews`, `listDeploymentVariables` | `viewer` | Read | +| `publishBranding`, `publishFlowDefinition`, `publishIdp`, `publishPolicy`, `publishSchema`, `createRelease`, `buildRelease` | `editor`; `admin` on the platform project (`requirePlatformConfigurationAdmin`) | Write | +| `removeProjectPreview` | `editor` (`whyPreviewRemoval`) | Write, destructive | +| `setVariables`, `deleteVariable` | `editor` | Takes a secret | +| `setUserPassword` and the passkey registrations | `admin` and the cover check (§4) | Write, credential tier | + +Kept where they are, with their reasons: + +- `deactivateTeam`, until #3470 decides who manages an owning team (§7). +- `publishApplication`, `createProjectClaim` and `createInvitation`, whose + answers are credentials (§8). + +### 6. A person's own reads take their token + +- `getMyUser`, `listMyProjects`, `listMyTeams`, `getMyUserSchema`, + `listMyPasskeys`, `listMyIdentityLinks` and `getMyPasswordState` take a + person's token as well as their session. Each names the scope of what it + reads: `user.read`, `project.read`, `team.read` or `schema.read`. +- **New: `listMySessions`** (`GET /users/me/sessions`, `session.read`) + lists the caller's sessions in their home project with the IP and user + agent each began with. It is §2's `session.user` arm as a list. +- **The MCP endpoint's instructions** tell an agent signed in as a person to + start with `getMyUser`, then `listMyProjects`, which answers each project + with its access (§10). + +### 7. Team membership that confers a project role + +#3470: `createTeamMembership` asks `admin` on the team's project, and +`createUser` with `team_id` asks `editor`. On an owning team, that lets an +admin of the platform project, or an editor through `createUser`, make +anyone an admin of a customer's project. + +- **The rule is §4's, applied to the role the membership confers.** Adding a + member to a team needs, on every project the team holds a role on (as + owner or through a team grant), at least that role. Both operations ask + it. +- ADR 054 §8's recovery path stays: an admin of the platform project may add + an owner to an owning team that has no active member. That is the one + exception, it is logged with `authorization.path`, and an operator may + always add one. +- `deactivateTeam` takes a person's credential once this rule lands, under + the same check, since deactivating an owning team ends its owners' access. + +### 8. Credentials in an answer go only to pinned first-party clients + +Today no person's token reaches an operation whose answer is a credential: +`publishApplication` (a client secret), `createProjectClaim` (a link that +hands over a project) or `createInvitation` (a link that gives a role). An +outside app such as Claude may hold the token, and a secret in a model's +context can leak. The CLI signs in as a person (ADR 036, amendment of +2026-11-25), and its claim flow calls `createProjectClaim` +(`apps/cli/src/lib/claim/`). + +**Recommendation:** these take a person's token only when the token was +issued to a client the deployment's configuration names as first-party, and +never through the MCP endpoint. + +- **First-party is declared by configuration, not by the client's + document.** + - A client metadata document can never claim it: `ParseClientDocument` + builds the client without `first_party`. + - A stored application can. `first_party` is a field of its client + document, written by `publishApplication`, which on the platform project + an admin of the platform project may call. An admin of the platform + project is not deployment-wide (ADR 053 §9), so the document's flag + cannot be what admits a credential. + - So the server reads a new `oauth.first_party_clients` list from its + configuration: client ids of the platform issuer, the CLI's among them. + The document's `first_party` keeps its one meaning, consent is skipped + (ADR 082 §3). +- **The check reads the token's `client_id`.** The token records it + (`actor.ClientID` already names it on events). A token issued to the + endpoint's audience never qualifies (`issuedFor`), so an MCP client is + refused even when its client id is listed. +- **Why not keep these on a project secret:** the CLI would need a project + secret to claim a project, which is the credential the claim flow exists + to avoid handing a person. + +### 9. The platform as a resource + +Decided on 2026-12-02. + +- **`getPlatform`** (`GET /platform`) answers the platform project's + `project_id` and, when OAuth is on, the platform issuer, as the Console's + runtime document already does. Any authenticated caller may read it. A + deployment without a platform project answers `404`. +- **`listPlatformOperators`** (`GET /platform/operators`) lists the users who + hold `operator`, each with when the assignment was made and its grantor + (`config`, ADR 075 §4). + - Its gate is `operator` on the platform. Only operators read it. An admin + of the platform project does not. + - Its scope is `platform.read`, which no project secret holds, since no + secret reaches the operator path. + - There is no write. Issuing operators stays configuration. +- **A project says what it is.** The project resource gains `kind`: + `platform` for the platform project, `standard` for any other. It shows to + whoever may read that project. +- **`listProjectMembers` keeps its meaning:** roles held on one project. On + the platform project, its description and its agent note point to + `listPlatformOperators`. + +### 10. Effective access: how a person holds a project + +ADR 054 §9 and Console ADR 0004 §5 planned this. ADR 075 §6 rejected a +capability read ("am I an operator"). This is per project, read from the +check, and is not that read. + +```json +{ + "project_id": "proj_…", + "kind": "standard", + "access": { + "role": "admin", + "sources": [ + { "kind": "owning_team", "team_id": "team_…", "role": "admin" }, + { "kind": "grant", "grant_id": "grant_…", "role": "editor" }, + { "kind": "team_grant", "team_id": "team_…", "grant_id": "grant_…", "role": "viewer" }, + { "kind": "platform_operator", "role": "admin" } + ] + } +} +``` + +- **Where it appears:** `getProject` and every item of `listMyProjects`. + `access` is the caller's, never anyone else's. +- **`role`** is `StrongestProjectRole`. +- **`sources`** lists every path that grants a role, not only the first one + that allowed. The resolver today stops at the first allow (`CheckPath`), so + this needs one more statement: the caller's active assignments that close + to a project role, plus the operator path. +- **What it answers:** + - An agent learns it runs the deployment from a `platform_operator` source + on any project. + - "Who is admin here", for an operator on the platform project, becomes + `listProjectMembers` (empty, with its note) plus `listPlatformOperators`. +- **The Console replaces its probe.** `readPlatformAccess` + (`apps/console/src/features/platform/access.ts`) reads + `GET /projects/{platform_project_id}` and treats `403` or `404` as "not + yours". It reads `access.role` from the same response instead, and a person + without access still gets the `404`. Each surface still derives itself from + its own target (ADR 054 §10). No screen branches on `platform_operator`. + +### 11. Where the records disagree, and which wins + +| Topic | Permission catalog | Gate contract (`authz_contract_internal_test.go`) | This ADR | +|---|---|---|---| +| Session reads | `project_viewer` bundle holds `session.read` | `QuerySessions`, `GetSession` ask `viewer` | **Decision wins.** `admin` or the session's user; the catalog and the contract both change. | +| Setting a password | `user.set_password` is admin-only and credential-tier (lines 85, 178) | asks `editor`, marked `openCredentialTier` | **The catalog wins**, plus the cover check (§4); `open` is removed. | +| Passkey registration for another user | under `user.set_password` | asks `editor`, marked `openCredentialTier` | Same as setting a password. | +| A password's scope | `user.set_password` | the spec names `user.write` (catalog drift note) | **The catalog wins**: the scope becomes `user.set_password`. | +| Changing a user's identifiers | `user.write` at `editor`, safe only until email-trusting sign-in | `UpdateUser` asks `editor` | `editor` stays; the cover check (§4) applies to identifier changes. | +| Removing a preview | write never implies delete (line 53) | asks `editor`, `whyPreviewRemoval`, marked `openWriteIsNotDelete` | **The contract wins** for previews: removing one ends a preview early and keeps its history. The `open` note stays for `deleteVariable` and `revokeRelease`, which this ADR does not decide. | +| Invitation reads | folded into `team_membership.read`, which viewers hold | ADR 086 asks `admin`, marked `openInvitationRead` | Not decided here. A person's token keeps ADR 086's `admin`. | +| Operators as a role on the platform project | `platform.operator` is not a role on the platform project (line 246) | — | Unchanged: `listPlatformOperators` gates on `platform#operator`, not on `project#admin`. | +| A capability read for operators | — | — | ADR 075 §6 stands for "am I an operator". Effective access per project (§10) amends its "no listing" with `listPlatformOperators`. | + +### 12. Sequence + +1. **§6:** a person's own reads take their token, and `listMySessions`. This + changes nobody's access to anyone else. +2. **§2 and §3:** the session type in all three dialects, the resolver and + oracle, then the session gates, each with its contract row. +3. **§4 and §7:** the cover check, the credential tier at `admin`, and #3470. + This must land before any credential-tier operation admits a person. +4. **§5:** the class rule and its tests, then the reads and the CLI's writes + it opens, with `x-zitadel-takes-secret`. +5. **§9 and §10:** the platform resource, `kind`, and effective access; the + Console drops its probe. +6. **§8,** once the user answers its question. + +## Escalation paths, and how this closes each + +| # | Path | Today | Closed by | +|---|---|---|---| +| 1 | An admin of the platform project acts deployment-wide | Kept apart by the catalog (ADR 075 §1); nothing lists who is an operator | `platform#operator` stays the only cross-project relation; `listPlatformOperators` gates on it (§9) | +| 2 | An admin or editor of the platform project sets a customer's or an operator's password, or registers a passkey for them | Only the project-secret plane prevents it (`openCredentialTier`) | `admin` plus the cover check (§4); the test holds every credential-tier operation, whichever credential calls it | +| 3 | An editor changes an operator's or a customer's email, then signs in by email | Safe only while no sign-in trusts the email alone (catalog `user.write`) | The cover check on identifier changes (§4) | +| 4 | An admin of the platform project deletes or deactivates an operator's user (lockout) | `deleteUser` asks `admin` | The cover check on `deleteUser` (§4) | +| 5 | An admin of the platform project adds a member to a customer's owning team | Open (#3470): `createTeamMembership` asks `admin`, `createUser` with `team_id` asks `editor` | The membership must not confer more than the caller holds (§7); ADR 054 §8 recovery is the one exception | +| 6 | A viewer reads every session's IP, user agent and `metadata` | The catalog's viewer bundle | `session#reader` (§3) | +| 7 | Someone grants themselves `session#reader` on another user's session | Not possible yet: no session type | `ValidateAssignment` refuses every `session` assignment (§2) | +| 8 | A credential lands in an outside app's context | No person's token reaches one (#3538) | Pinned first-party clients only, never through the MCP endpoint (§8) | +| 9 | An admin of the platform project marks an application `first_party` to get §8's credentials | — | First-party for credentials is configuration (`oauth.first_party_clients`), not the document's flag (§8) | +| 10 | An agent's token publishes sign-in configuration for the whole cloud | Not possible: only a project secret publishes | `requirePlatformConfigurationAdmin` on the platform project; a release still needs a separate deployment, which asks the person first (§5) | +| 11 | A variable's secret value passes through a model's context | Variable writes are project-secret-only | `x-zitadel-takes-secret` keeps them out of MCP tools (§5) | +| 12 | A team secret (`sk_team_`) reaches sessions | — | `session.*` stays off the `sk_team_` allowlist; its Checks answer `NotFound` | + +## Consequences + +### Positive + +- One model per project. The platform adds one edge and one listing, so what + holds for a customer's project holds for the platform project and the other + way round. +- An agent signed in as a person finds its projects, how it holds each one, + who runs the deployment, and where a person signed in, each in one call. +- Account takeover is closed by a rule about what the target holds, not by + which credential plane the caller used. +- Which credential an operation takes is a class in the spec, held by tests. + +### Negative / Risks + +- `session` is the catalog's first type below a project, and the resolver + learns two implied tuplesets. The oracle and its property tests must grow + with it. +- The cover check adds one `CheckProjects` per write to a user. It is cheap + on a workload project and proportional to a customer's projects on the + platform project. +- Viewers lose session reads, and editors lose `setUserPassword`. +- About twenty-five operations change their security in the spec. The SDKs, + the API mock and the CLI follow. +- A person's token, held by an agent, may publish configuration and build + releases. Serving one stays a deployment, which the MCP endpoint asks + before. + +## Open questions for the user + +1. **Credentials for the CLI (§8).** Accept "pinned first-party clients, + never through MCP" for `publishApplication` and `createProjectClaim`? The + alternative is to leave both with a project secret, which keeps the CLI's + claim flow on a secret. +2. **`createInvitation` under §8.** A Console session takes it today. Should a + pinned first-party client's token take it too, so that `zitadel` can + invite, or should it stay with the Console? +3. **The cover check's reach (§4).** Apply it to every project, as proposed, + or only where the target holds roles elsewhere, which is the platform + project today? Proposed: everywhere, because it costs nothing on a + workload project and protects any later cross-project grant (ADR 053). +4. **Effective access shows every source (§10).** Show all of them, including + a viewer grant under an admin owning-team membership, or only the ones + that give the strongest role? Proposed: all, so an agent can explain why + access stays after one source is removed. + +## Rejected alternatives + +### Taking the platform out of the project machinery + +A platform stored apart from projects would need its own users, teams, +sign-in, issuer and release. The project machinery provides each one, and +the API can present the platform as its own resource without moving it. + +### Rules that name the platform project + +"Only an operator sets an operator's password", or "an admin of the platform +project may not touch customer accounts", would each be an exception keyed on +the platform project. The cover check (§4) gives the same answer there and +the right one on every other project. + +### Listing operators as members of every project + +Every customer would see the deployment's staff in their member list. ADR +075 §5 shows customers what operators change, not who could. + +### An "am I an operator" read + +It would be the capability read ADR 075 rejected, and the Console would +branch on it, which ADR 054 §10 forbids. Effective access with its sources +answers the same question per project, from the check. + +### Letting operators alone past the credential plane + +Admitting an operator's credential on the project-secret-only operations, +and no one else's, makes operators a special case of a question every person +asks. Opening them by class and letting the gate decide gives operators the +same result through the same path. + +### Session tuples written at sign-in + +They would double every sign-in's writes, and could disagree with the +session they describe (ADR 033 §2). The session's row already says whose it +is and where it lives. + +### Keeping session reads at `viewer` + +It shows every viewer the IP, user agent and `metadata` of everyone's +sessions, and still leaves a person unable to read their own. + +### Trusting the application document's `first_party` for credentials + +An admin of the platform project writes that document (§8, path 9). The flag +keeps its one meaning, consent. + +## Documentation impact + +- ADR 075 §6: the operator listing is §9 of this ADR; operators appear as an + effective-access source (§10). +- ADR 054 §9: the effective-access shape; §8: the cover rule for + owning-team membership (§7). +- ADR 036: the credential classes (§5) replace the per-operation list. +- `docs/design/api/system-permission-catalog.md`: the `session` type, + `session.read` out of `project_viewer`, `user.set_password` as the spec's + scope, `platform.read`, and the cover check under the credential tier. +- `apps/api/api/openapi/AGENTS.md`: `x-zitadel-takes-secret` and the class + rule. +- `apps/api/internal/storage/AGENTS.md`: implied tuplesets are never + assignments. +- The API reference and the agent notes (ADR 092 §3) for the new and changed + operations; the MCP endpoint's instructions (§6). +- The CLI's commands, `zitadel login` publishing, and `SKILL.md`. +- `apps/docs/content/docs/guides/investigate-with-events.mdx`: where a person + signed in, from `listMySessions` and `querySessions`. diff --git a/docs/adrs/README.md b/docs/adrs/README.md index 4132a2097c..10b695c0ab 100644 --- a/docs/adrs/README.md +++ b/docs/adrs/README.md @@ -99,4 +99,4 @@ This directory contains architecture decision records (ADRs) for nextgen. | [091](091-release-pinning.md) | Release Pinning | Proposed | The app sends the release it was built against in `X-Zitadel-Release` when it starts a sign-in. Each deployment keeps a pin list per target, the earlier deployments a pin may still use, taken only from the previous deployment and its list up to the release's `.zitadel/pinning/pinning.json` `keep` (default 0), so `keep: 0` is a permanent cut. A pin outside the list gets the newest release; the response's `X-Zitadel-Release` names the release that served and a `flow.pin_not_served` event records the miss. `setUserPassword` takes no pin. Amends ADR 085 §2. | | [092](092-mcp-server.md) | MCP — the API as Tools on the Server, and the MCP Servers Zitadel Protects | Proposed | Zitadel's MCP server is an endpoint of the Go server, `/api/v1/mcp`, on unless `mcp.enabled` turns it off, so a local server, a self-hosted one and the cloud serve the same one. A tool is one operation read from the embedded OpenAPI document, and a call is that operation's own request to the API's handler with the caller's credential: a project secret today, a person's token once the OAuth pieces exist. The spec marks which operations only read (`x-zitadel-read-only`), belong to applications (`x-zitadel-plane: app`) or return a credential (`x-zitadel-returns-secret`). A client is shown the tools its credential's scopes cover, and a destructive call is sent only after the person at the client confirmed that call. Customers' MCP servers, which Zitadel protects, follow on the same OAuth pieces, and Agent Skills over MCP's Skills extension are wanted on the same endpoint. | | [093](093-policy-decision-events.md) | Policy Decision Events | Proposed | A policy gate records each evaluation as a wide event, `policy.evaluate.denied` or `policy.evaluate.allowed`, naming the policy, the revision and the failed rules. The gate writes it when it decides, best-effort and outside the operation's transaction, so the events get a category of their own, `policy`. The server setting `events.policy.decisions` (`none`, `deny` by default, `all`) selects what is recorded. Amends ADR 048 and ADR 066. | -| [094](094-platform-as-a-resource.md) | The Platform as a Resource, and What a Person May Do | Proposed | The API presents the deployment's platform as its own resource: `getPlatform`, `listPlatformOperators` (operators only, scope `platform.read`) and a project's `kind`; a person learns how they hold a project from its effective role and sources, `platform_operator` among them, never from a capability read. Sessions get a type of their own, read and revoked by their user and the project's administrators, operators included. A read takes a person's credential and its gate decides, which opens five project-secret-only reads; the `/users/me` reads take a person's token, with a new `listMySessions`; the CLI's release-time writes take a person, variable writes are kept out of MCP tools, `setUserPassword` asks `admin` and only an operator sets an operator's password, and `deactivateTeam` and the operations that answer with a credential stay as they are. Amends ADR 075 §6, ADR 054 §9 and ADR 036. | +| [094](094-project-permission-model.md) | Projects Carry the Permission Model, the Platform Is Its Root | Proposed | One permission model per project; the platform enters only as `operator from platform` on `project.admin`. Sessions become a catalog type whose project and user are implied from the row: read and revoked by their user and the project's admins, operators included. Writes that can take over or lock out a user need `admin` and must cover every role the target holds (the credential tier, identifier changes, deletion, owning-team membership). Which credential an operation takes is a class in the spec held by tests; credentials in an answer go only to configuration-pinned first-party clients, never through MCP. `getPlatform`, `listPlatformOperators` (operators only) and a project's `kind`; effective access with its sources replaces the Console's probe. Amends ADR 075 §6, ADR 054 §9 and ADR 036. | From b7a57f496fab0277951c9bf104a04c4a3de09260 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 01:17:57 +0000 Subject: [PATCH 05/10] docs: keep setUserPassword out of MCP tools in ADR 094, since it takes a secret Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0137eGmTDLdAX6MvNFrobbNT --- docs/adrs/094-project-permission-model.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/adrs/094-project-permission-model.md b/docs/adrs/094-project-permission-model.md index 6c287ec441..7d442f5d0f 100644 --- a/docs/adrs/094-project-permission-model.md +++ b/docs/adrs/094-project-permission-model.md @@ -284,7 +284,8 @@ What this opens, beyond §3 and §6, read by role: | `publishBranding`, `publishFlowDefinition`, `publishIdp`, `publishPolicy`, `publishSchema`, `createRelease`, `buildRelease` | `editor`; `admin` on the platform project (`requirePlatformConfigurationAdmin`) | Write | | `removeProjectPreview` | `editor` (`whyPreviewRemoval`) | Write, destructive | | `setVariables`, `deleteVariable` | `editor` | Takes a secret | -| `setUserPassword` and the passkey registrations | `admin` and the cover check (§4) | Write, credential tier | +| `setUserPassword` | `admin` and the cover check (§4) | Write, credential tier; takes a secret (the new password is in the request) | +| the passkey registrations | `admin` and the cover check (§4) | Write, credential tier | Kept where they are, with their reasons: @@ -464,7 +465,7 @@ check, and is not that read. | 8 | A credential lands in an outside app's context | No person's token reaches one (#3538) | Pinned first-party clients only, never through the MCP endpoint (§8) | | 9 | An admin of the platform project marks an application `first_party` to get §8's credentials | — | First-party for credentials is configuration (`oauth.first_party_clients`), not the document's flag (§8) | | 10 | An agent's token publishes sign-in configuration for the whole cloud | Not possible: only a project secret publishes | `requirePlatformConfigurationAdmin` on the platform project; a release still needs a separate deployment, which asks the person first (§5) | -| 11 | A variable's secret value passes through a model's context | Variable writes are project-secret-only | `x-zitadel-takes-secret` keeps them out of MCP tools (§5) | +| 11 | A variable's secret value, or a password being set, passes through a model's context | Both writes are project-secret-only | `x-zitadel-takes-secret` keeps `setVariables`, `deleteVariable` and `setUserPassword` out of MCP tools (§5) | | 12 | A team secret (`sk_team_`) reaches sessions | — | `session.*` stays off the `sk_team_` allowlist; its Checks answer `NotFound` | ## Consequences From 1bc2a2f24716c6a83af959a579d4004b1edfe628 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 01:50:53 +0000 Subject: [PATCH 06/10] docs: fold the user's MCP and credential decisions into ADR 094 Every management operation takes a person's token, a PAT or a machine identity and is an MCP tool; marks on secret-bearing operations warn instead of hiding. The pinned first-party list now only decides who skips consent on the platform issuer. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0137eGmTDLdAX6MvNFrobbNT --- docs/adrs/094-project-permission-model.md | 239 +++++++++++++--------- docs/adrs/README.md | 2 +- 2 files changed, 144 insertions(+), 97 deletions(-) diff --git a/docs/adrs/094-project-permission-model.md b/docs/adrs/094-project-permission-model.md index 7d442f5d0f..01715515da 100644 --- a/docs/adrs/094-project-permission-model.md +++ b/docs/adrs/094-project-permission-model.md @@ -6,7 +6,10 @@ > alternative "A separate listing and a capability read for operators" (an > operator listing), [ADR 036](036-api-credential-planes.md) (which operations > take a person's credential), [ADR 054](054-customer-collaboration-grants.md) -> §9 (the shape of effective access, with the operator path among its sources) +> §9 (the shape of effective access, with the operator path among its sources), +> [ADR 092](092-mcp-server.md) §4 and §6 (which operations are tools, and who +> is asked), [ADR 082](082-oauth-and-oidc-server.md) §3 (who skips consent on +> the platform issuer) > **Related:** [ADR 033](033-internal-permission-management.md), > [ADR 053](053-cross-project-principals.md) §9, > [ADR 082](082-oauth-and-oidc-server.md) §3, @@ -242,30 +245,64 @@ holds at least that role there, and, when the target holds ### 5. Which credential an operation takes: one rule -ADR 036 split the planes. This replaces the per-operation list with a rule -the spec carries and a test holds. - -| Class | Marked by | Project secret | Console session | Person's token | Through the MCP endpoint | -|---|---|---|---|---|---| -| Application sign-in | `x-zitadel-plane: app` | yes | no | no | no | -| Read | `GET`, or `x-zitadel-read-only` | yes | yes | yes, with the scope it names | yes | -| Write | everything else | yes | yes | yes, with the scope it names | yes, destructive ones ask first | -| Takes a secret | `x-zitadel-takes-secret` (new) | yes | yes | yes | no | -| Returns a credential | `x-zitadel-returns-secret` | yes | `createInvitation` only, as today | a pinned first-party client only (§8) | no | -| Proves possession | `getProjectClaimStatus` (ADR 046 §3) | yes | no | no | no | -| Self | `/users/me/*` | no: a secret has no self | yes | yes | yes | -| Twin of a self read | `queryProjects` (a person uses `listMyProjects`) | yes | no | no | no | - -- **The gate decides, not the plane.** Within a class that admits a person, - their role decides through the operation's gate. An operator passes because - the check allows them, not because the plane names them. -- **Scopes.** Every operation that admits a person's token names a scope +Decided by the user on 2026-12-02: "We want to have an agent-native IAM so +all operations should be able to go through the MCP but either its a user +through consent OR a PAT or a machine identity (or agent)." And: "MCP is for +managing resources and debuging and building the login UI." + +ADR 036 split the planes. This replaces the per-operation list +(`userBoundSessionOperations`) with three classes the spec carries and a +test holds. + +| Class | Operations | Project secret | Console session | Person's token (consent) | PAT | Machine identity | MCP tool | +|---|---|---|---|---|---|---|---| +| **Management** | everything not below | yes | yes | yes | yes | yes | yes | +| **Application sign-in** | `x-zitadel-plane: app` (six), `createSession`, `exchangeHandoff`, `createAuthAttemptHandoff` | yes | no | no | no | no | no | +| **Public** | `createFlow`, `getFlowStep`, `submitFlowStep`, `getLive`, `getReady` | anonymous | — | — | — | — | no | + +- **In the management class, the credential's scopes and the principal's + permissions decide, and nothing else.** An operator passes because the + check allows them, not because the plane names them. A person's token, a + PAT and a machine identity are each capped by their scopes; a PAT and a + machine identity never hold more than their owner (identity model). +- **Nothing is hidden for what it returns or takes.** ADR 092 §4's rule that + an operation answering with a credential is never a tool is withdrawn, and + `x-zitadel-takes-secret` hides nothing. Both marks stay, as warnings: + - a scope that reaches a marked operation is never preselected on the + consent screen; + - the operation's event records the mark, the principal and the + `client_id`; + - the tool's description says what the answer or the argument holds. +- **Asking the person before a marked or destructive call (ADR 092 §6).** + Recommended: + - the gate is the scope the person consented to, which is never + preselected for these operations, plus the client's own prompt; + - the endpoint's question is sent where the client can answer it + (protocol revision `2026-07-28`). A client on an earlier revision is + served without it, rather than refused, as long as its token carries the + operation's own scope (`user.set_password`, `session.delete`); + - a machine identity is never asked: its grants are the decision. + This keeps today's clients and unattended identities working. It also + keeps the strongest operations behind a scope that a person ticked on + purpose. +- **What stays with a person's own session.** `getMySession`, + `revokeMySession` and `getMySessionCsrfToken` describe the browser session + that calls them, so they stay cookie-only. The other session-cookie-only + operations are a person's own and take a person's token: the `/users/me` + reads (§6), `updateMyUser`, `completeProjectClaim`, and `lookupInvitation`, + `acceptInvitation`, `rejectInvitation`. +- **Two operations take no credential today:** `createProject` and + `getProjectClaimWindow`. `createProject` is management. It takes a + person's token, a PAT or a machine identity and creates the project under + a team the caller may create projects for (ADR 054 §7), with no anonymous + create-then-claim link. Its anonymous form stays for the cloud's sign-up. + `getProjectClaimWindow` belongs to that anonymous flow and stays public. +- **Scopes.** Every management operation names a scope (`TestEveryOperationAPersonsTokenReachesNamesAScope`). This ADR adds: - `session.read` and `session.delete`, which the catalog already declares; - - `user.set_password` for the credential tier. It is the catalog's own - split: the spec names `user.write` there today, which the catalog lists - as drift. An agent's token then takes over no account unless it was - issued for exactly that; + - `user.set_password` for the credential tier, the catalog's own split + (the spec names `user.write` there today, which the catalog lists as + drift); - `platform.read` for `listPlatformOperators` (§9). - **The tests:** - `TestEveryOperationTakesTheCredentialsItsClassAdmits` replaces @@ -273,25 +310,28 @@ the spec carries and a test holds. what it was made for, which operations skip an anonymous building cookie. - zitadel/nextgen#3538's `TestAPersonsTokenReachesWhatASessionReaches` holds the same equality from the other side. - - `TestNoReadAnswersASecretUnmarked` checks every read's response schema - against `x-zitadel-returns-secret`. + - `TestNoOperationAnswersASecretUnmarked` checks every response schema + against `x-zitadel-returns-secret`, and every request schema against + `x-zitadel-takes-secret`. -What this opens, beyond §3 and §6, read by role: +What this opens to a person, a PAT and a machine identity, each at its gate: -| Operation | Gate | Class | +| Operation | Gate | Marks | |---|---|---| -| `listIdpRevisions`, `listProjectPreviews`, `listDeploymentVariables` | `viewer` | Read | -| `publishBranding`, `publishFlowDefinition`, `publishIdp`, `publishPolicy`, `publishSchema`, `createRelease`, `buildRelease` | `editor`; `admin` on the platform project (`requirePlatformConfigurationAdmin`) | Write | -| `removeProjectPreview` | `editor` (`whyPreviewRemoval`) | Write, destructive | -| `setVariables`, `deleteVariable` | `editor` | Takes a secret | -| `setUserPassword` | `admin` and the cover check (§4) | Write, credential tier; takes a secret (the new password is in the request) | -| the passkey registrations | `admin` and the cover check (§4) | Write, credential tier | - -Kept where they are, with their reasons: - -- `deactivateTeam`, until #3470 decides who manages an owning team (§7). -- `publishApplication`, `createProjectClaim` and `createInvitation`, whose - answers are credentials (§8). +| `querySessions`, `getSession`, `revokeSession` | §3 | `revokeSession` destructive | +| `listIdpRevisions`, `listProjectPreviews`, `listDeploymentVariables` | `viewer` | — | +| `publishBranding`, `publishFlowDefinition`, `publishIdp`, `publishPolicy`, `publishSchema`, `createRelease`, `buildRelease` | `editor`; `admin` on the platform project (`requirePlatformConfigurationAdmin`) | — | +| `removeProjectPreview` | `editor` (`whyPreviewRemoval`) | destructive | +| `setVariables`, `deleteVariable` | `editor` | takes a secret | +| `publishApplication` | `editor`; `admin` on the platform project | returns a secret | +| `createProjectClaim` | `editor` | returns a secret | +| `createInvitation` | `admin` (ADR 086) | returns a secret | +| `setUserPassword` | `admin` and the cover check (§4) | takes a secret, destructive | +| `createUserPasskeyRegistration`, `completeUserPasskeyRegistration` | `admin` and the cover check (§4) | — | +| `deactivateTeam` | `admin` and §7's rule | destructive | + +The last three rows wait for §4 and §7: none of them admits a person's +credential before the cover check is enforced. ### 6. A person's own reads take their token @@ -324,40 +364,29 @@ anyone an admin of a customer's project. - `deactivateTeam` takes a person's credential once this rule lands, under the same check, since deactivating an owning team ends its owners' access. -### 8. Credentials in an answer go only to pinned first-party clients - -Today no person's token reaches an operation whose answer is a credential: -`publishApplication` (a client secret), `createProjectClaim` (a link that -hands over a project) or `createInvitation` (a link that gives a role). An -outside app such as Claude may hold the token, and a secret in a model's -context can leak. The CLI signs in as a person (ADR 036, amendment of -2026-11-25), and its claim flow calls `createProjectClaim` -(`apps/cli/src/lib/claim/`). - -**Recommendation:** these take a person's token only when the token was -issued to a client the deployment's configuration names as first-party, and -never through the MCP endpoint. - -- **First-party is declared by configuration, not by the client's - document.** - - A client metadata document can never claim it: `ParseClientDocument` - builds the client without `first_party`. - - A stored application can. `first_party` is a field of its client - document, written by `publishApplication`, which on the platform project - an admin of the platform project may call. An admin of the platform - project is not deployment-wide (ADR 053 §9), so the document's flag - cannot be what admits a credential. - - So the server reads a new `oauth.first_party_clients` list from its - configuration: client ids of the platform issuer, the CLI's among them. - The document's `first_party` keeps its one meaning, consent is skipped - (ADR 082 §3). -- **The check reads the token's `client_id`.** The token records it - (`actor.ClientID` already names it on events). A token issued to the - endpoint's audience never qualifies (`issuedFor`), so an MCP client is - refused even when its client id is listed. -- **Why not keep these on a project secret:** the CLI would need a project - secret to claim a project, which is the credential the claim flow exists - to avoid handing a person. +### 8. Who decides that a client skips consent + +The draft kept credential-returning operations to clients the deployment +pins as first-party. The user decided otherwise on 2026-12-02, asked whether +only the CLI should receive secrets: "but an mcp client can already do that +and we do not want to limit what MCP clients can be used as a saas offer, +right?" Every management operation now takes any client the person +consented to (§5). + +What remains of the finding is consent itself: + +- A client metadata document can never claim `first_party`: + `ParseClientDocument` builds the client without it. +- A stored application can. `first_party` is a field of its client + document, written by `publishApplication`, which on the platform project + an admin of the platform project may call. A first-party client of the + platform issuer is asked no consent (ADR 082 §3), so its tokens carry + every scope it asks for, for every customer who signs in to it. +- **Recommendation:** on the platform issuer, the deployment's configuration + names the clients that skip consent (`oauth.first_party_clients`: the + Console, the CLI). The document's flag still decides consent on every + other project's issuer, where the project's own admins are the right + people to decide it. ### 9. The platform as a resource @@ -444,12 +473,13 @@ check, and is not that read. 2. **§2 and §3:** the session type in all three dialects, the resolver and oracle, then the session gates, each with its contract row. 3. **§4 and §7:** the cover check, the credential tier at `admin`, and #3470. - This must land before any credential-tier operation admits a person. -4. **§5:** the class rule and its tests, then the reads and the CLI's writes - it opens, with `x-zitadel-takes-secret`. + This must land before any credential-tier operation, or + `deactivateTeam`, admits a person. +4. **§5:** the class rule and its tests, then the operations it opens, and + ADR 092 §4's amendment. `createProject` for a signed-in caller follows. 5. **§9 and §10:** the platform resource, `kind`, and effective access; the Console drops its probe. -6. **§8,** once the user answers its question. +6. **§8:** the configured consent-skipping list on the platform issuer. ## Escalation paths, and how this closes each @@ -462,10 +492,10 @@ check, and is not that read. | 5 | An admin of the platform project adds a member to a customer's owning team | Open (#3470): `createTeamMembership` asks `admin`, `createUser` with `team_id` asks `editor` | The membership must not confer more than the caller holds (§7); ADR 054 §8 recovery is the one exception | | 6 | A viewer reads every session's IP, user agent and `metadata` | The catalog's viewer bundle | `session#reader` (§3) | | 7 | Someone grants themselves `session#reader` on another user's session | Not possible yet: no session type | `ValidateAssignment` refuses every `session` assignment (§2) | -| 8 | A credential lands in an outside app's context | No person's token reaches one (#3538) | Pinned first-party clients only, never through the MCP endpoint (§8) | -| 9 | An admin of the platform project marks an application `first_party` to get §8's credentials | — | First-party for credentials is configuration (`oauth.first_party_clients`), not the document's flag (§8) | +| 8 | A credential lands in an outside app's context | No person's token reaches one (#3538 before 049c3080b) | Accepted by the user's decision (§5). Bounded by the operation's scope, never preselected on consent; its event names the principal and `client_id`; the endpoint asks where the client can answer | +| 9 | An admin of the platform project marks an application `first_party`, so the platform issuer asks customers no consent for it | Possible today | On the platform issuer, the clients that skip consent come from configuration (§8) | | 10 | An agent's token publishes sign-in configuration for the whole cloud | Not possible: only a project secret publishes | `requirePlatformConfigurationAdmin` on the platform project; a release still needs a separate deployment, which asks the person first (§5) | -| 11 | A variable's secret value, or a password being set, passes through a model's context | Both writes are project-secret-only | `x-zitadel-takes-secret` keeps `setVariables`, `deleteVariable` and `setUserPassword` out of MCP tools (§5) | +| 11 | A variable's secret value, or a password being set, passes through a model's context | Both writes are project-secret-only | Accepted by the user's decision (§5). `x-zitadel-takes-secret` keeps the scope off the consent screen's defaults and records the mark in events | | 12 | A team secret (`sk_team_`) reaches sessions | — | `session.*` stays off the `sk_team_` allowlist; its Checks answer `NotFound` | ## Consequences @@ -498,21 +528,26 @@ check, and is not that read. ## Open questions for the user -1. **Credentials for the CLI (§8).** Accept "pinned first-party clients, - never through MCP" for `publishApplication` and `createProjectClaim`? The - alternative is to leave both with a project secret, which keeps the CLI's - claim flow on a secret. -2. **`createInvitation` under §8.** A Console session takes it today. Should a - pinned first-party client's token take it too, so that `zitadel` can - invite, or should it stay with the Console? +Decided on 2026-12-02 and folded in: every management operation goes +through the MCP endpoint for a person (consent), a PAT or a machine identity +(§5); the endpoint leaves out the application sign-in and public operations; +`createInvitation` takes a person's token. + +1. **Asking before a marked or destructive call (§5).** Accept "the + consented scope is the gate; the endpoint asks where the client can + answer; a machine identity is never asked"? The alternative, refusing + clients that cannot answer, keeps most of today's clients and every + unattended identity off these operations. +2. **Consent on the platform issuer (§8).** Accept that configuration names + the clients that skip consent there, rather than the application's own + `first_party` flag? 3. **The cover check's reach (§4).** Apply it to every project, as proposed, or only where the target holds roles elsewhere, which is the platform - project today? Proposed: everywhere, because it costs nothing on a - workload project and protects any later cross-project grant (ADR 053). -4. **Effective access shows every source (§10).** Show all of them, including - a viewer grant under an admin owning-team membership, or only the ones - that give the strongest role? Proposed: all, so an agent can explain why - access stays after one source is removed. + project today? Proposed: everywhere. It costs nothing on a workload + project and protects any later cross-project grant (ADR 053). +4. **Effective access shows every source (§10).** Show every source, or only + the ones that give the strongest role? Proposed: all, so an agent can + explain why access stays after one source is removed. ## Rejected alternatives @@ -558,10 +593,18 @@ is and where it lives. It shows every viewer the IP, user agent and `metadata` of everyone's sessions, and still leaves a person unable to read their own. -### Trusting the application document's `first_party` for credentials +### Keeping credential-returning operations from outside clients + +The first draft admitted them only for clients the deployment pins, never +through MCP. The user rejected that on 2026-12-02: an agent-native IAM offers +every management operation to every client a person consents to, and a SaaS +offer cannot pick which MCP clients its customers use. + +### Hiding operations that take or return a secret from MCP tools -An admin of the platform project writes that document (§8, path 9). The flag -keeps its one meaning, consent. +ADR 092 §4 did this for answers; the draft extended it to requests. It would +leave an agent unable to register an application, claim a project, invite a +person or set a variable. The marks now warn instead of hiding (§5). ## Documentation impact @@ -570,11 +613,15 @@ keeps its one meaning, consent. - ADR 054 §9: the effective-access shape; §8: the cover rule for owning-team membership (§7). - ADR 036: the credential classes (§5) replace the per-operation list. +- ADR 092 §4: an operation that returns a credential is a tool; the marks + warn instead (§5). §6: who is asked, and when (§5). - `docs/design/api/system-permission-catalog.md`: the `session` type, `session.read` out of `project_viewer`, `user.set_password` as the spec's scope, `platform.read`, and the cover check under the credential tier. - `apps/api/api/openapi/AGENTS.md`: `x-zitadel-takes-secret` and the class rule. +- ADR 082 §3: on the platform issuer, configuration names the clients that + skip consent (§8). - `apps/api/internal/storage/AGENTS.md`: implied tuplesets are never assignments. - The API reference and the agent notes (ADR 092 §3) for the new and changed diff --git a/docs/adrs/README.md b/docs/adrs/README.md index 10b695c0ab..9bee4b8c9a 100644 --- a/docs/adrs/README.md +++ b/docs/adrs/README.md @@ -99,4 +99,4 @@ This directory contains architecture decision records (ADRs) for nextgen. | [091](091-release-pinning.md) | Release Pinning | Proposed | The app sends the release it was built against in `X-Zitadel-Release` when it starts a sign-in. Each deployment keeps a pin list per target, the earlier deployments a pin may still use, taken only from the previous deployment and its list up to the release's `.zitadel/pinning/pinning.json` `keep` (default 0), so `keep: 0` is a permanent cut. A pin outside the list gets the newest release; the response's `X-Zitadel-Release` names the release that served and a `flow.pin_not_served` event records the miss. `setUserPassword` takes no pin. Amends ADR 085 §2. | | [092](092-mcp-server.md) | MCP — the API as Tools on the Server, and the MCP Servers Zitadel Protects | Proposed | Zitadel's MCP server is an endpoint of the Go server, `/api/v1/mcp`, on unless `mcp.enabled` turns it off, so a local server, a self-hosted one and the cloud serve the same one. A tool is one operation read from the embedded OpenAPI document, and a call is that operation's own request to the API's handler with the caller's credential: a project secret today, a person's token once the OAuth pieces exist. The spec marks which operations only read (`x-zitadel-read-only`), belong to applications (`x-zitadel-plane: app`) or return a credential (`x-zitadel-returns-secret`). A client is shown the tools its credential's scopes cover, and a destructive call is sent only after the person at the client confirmed that call. Customers' MCP servers, which Zitadel protects, follow on the same OAuth pieces, and Agent Skills over MCP's Skills extension are wanted on the same endpoint. | | [093](093-policy-decision-events.md) | Policy Decision Events | Proposed | A policy gate records each evaluation as a wide event, `policy.evaluate.denied` or `policy.evaluate.allowed`, naming the policy, the revision and the failed rules. The gate writes it when it decides, best-effort and outside the operation's transaction, so the events get a category of their own, `policy`. The server setting `events.policy.decisions` (`none`, `deny` by default, `all`) selects what is recorded. Amends ADR 048 and ADR 066. | -| [094](094-project-permission-model.md) | Projects Carry the Permission Model, the Platform Is Its Root | Proposed | One permission model per project; the platform enters only as `operator from platform` on `project.admin`. Sessions become a catalog type whose project and user are implied from the row: read and revoked by their user and the project's admins, operators included. Writes that can take over or lock out a user need `admin` and must cover every role the target holds (the credential tier, identifier changes, deletion, owning-team membership). Which credential an operation takes is a class in the spec held by tests; credentials in an answer go only to configuration-pinned first-party clients, never through MCP. `getPlatform`, `listPlatformOperators` (operators only) and a project's `kind`; effective access with its sources replaces the Console's probe. Amends ADR 075 §6, ADR 054 §9 and ADR 036. | +| [094](094-project-permission-model.md) | Projects Carry the Permission Model, the Platform Is Its Root | Proposed | One permission model per project; the platform enters only as `operator from platform` on `project.admin`. Sessions become a catalog type whose project and user are implied from the row: read and revoked by their user and the project's admins, operators included. Writes that can take over or lock out a user need `admin` and must cover every role the target holds (the credential tier, identifier changes, deletion, owning-team membership). Every management operation takes a person's token (consent), a PAT or a machine identity and is an MCP tool, decided by scopes and permissions; only application sign-in and the public flow stay out, and secret-bearing operations are marked, never hidden. `getPlatform`, `listPlatformOperators` (operators only) and a project's `kind`; effective access with its sources replaces the Console's probe. Amends ADR 075 §6, ADR 054 §9, ADR 036, ADR 092 §4 and §6, and ADR 082 §3. | From f3db7f9c9e7db2fc0bc36d246620b47e86645c0a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 03:28:06 +0000 Subject: [PATCH 07/10] docs: answer the review of ADR 094: order the checks first, and keep the platform project's configuration and credentials to operators Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0137eGmTDLdAX6MvNFrobbNT --- docs/adrs/094-project-permission-model.md | 186 +++++++++++++++------- 1 file changed, 131 insertions(+), 55 deletions(-) diff --git a/docs/adrs/094-project-permission-model.md b/docs/adrs/094-project-permission-model.md index 01715515da..9099aa6d8a 100644 --- a/docs/adrs/094-project-permission-model.md +++ b/docs/adrs/094-project-permission-model.md @@ -159,8 +159,11 @@ Its tuple is a fact about the object, read from where the object is stored: `computed_userset` on `session.user` at position 0, and a `tuple_to_userset` with source `project.admin` and tupleset `session.project` at position 1; - - `authz_relation_closure`: the reflexive rows. No existing closure - changes. + - `authz_relation_closure`: the reflexive rows, and the two the compiler + derives from the computed usersets, `session.user` to `session.reader` + and to `session.revoker` (`compiler.go`, `directImplications`). No + existing closure changes. Nothing can match them, since no assignment + names `session` (below). - The `Down` deletes exactly these rows, as `platform_operator`'s does. - **The compiler and the oracle learn the implied set.** `domain` gains `AuthzImpliedTuplesets`, `{project.platform, session.project, session.user}`. @@ -211,6 +214,9 @@ holds at least that role there, and, when the target holds - the credential tier: `setUserPassword`, `createUserPasskeyRegistration`, `completeUserPasskeyRegistration`, and any later factor reset (`credentialTierPath`); + - minting or rotating a credential that acts as another principal: a + principal client's secret or key, and a PAT owned by someone else + (identity model). Each is account takeover by another name; - `deleteUser` (lockout); - `updateUser` when it changes an attribute a sign-in identifies by (the email or the username). The catalog's `user.write` row already warns that @@ -227,14 +233,25 @@ holds at least that role there, and, when the target holds holds" compares two principals' whole grant sets, which no OpenFGA relation expresses. It runs after the gate, like `requirePlatformConfigurationAdmin`, and its rows go in `authz_later_checks_internal_test.go`. A refusal answers - the operation's `permission_denied`. + the operation's `permission_denied` with its own reason, + `target_holds_more`, so an agent can say why. It does not name the + project or role the caller lacks, which would tell them what the target + holds. +- **It holds only at the moment of the write.** A credential set for a user + who holds nothing yet stays when that user later gains a role. On a + workload project that is the project's own business. On the platform + project, where every account can come to own customer projects, it is + not, so there the credential tier, identifier changes and deletion of + another user are **operators' only** until the user decides otherwise + (open question 6). - **What it does on each kind of project:** - On a workload project, whose users hold no role elsewhere, it is just `admin`. - - On the platform project, a customer account holds `admin` on the - customer's projects, so only someone who also holds that, an operator in - practice, may take the account over. An admin of the platform project - cannot. This is ADR 053 §9 enforced at the write. + - On the platform project, writes to another user's credentials or + identifiers are operators' only, as above. The cover check still runs, + so an operator cannot take over another operator's account unnoticed: + the target's `operator` is a role the caller must also hold, and the + event records both. - It answers the draft's second open question ("how is 'the user holds operator' checked"): the operator is one of the roles covered. - **`openCredentialTier` closes.** The three credential-tier rows move to @@ -257,14 +274,21 @@ test holds. | Class | Operations | Project secret | Console session | Person's token (consent) | PAT | Machine identity | MCP tool | |---|---|---|---|---|---|---|---| | **Management** | everything not below | yes | yes | yes | yes | yes | yes | -| **Application sign-in** | `x-zitadel-plane: app` (six), `createSession`, `exchangeHandoff`, `createAuthAttemptHandoff` | yes | no | no | no | no | no | +| **Application sign-in** | the nine marked `x-zitadel-plane: app`: `createSession`, `exchangeHandoff`, `createAuthAttempt`, `getAuthAttempt`, `createAuthAttemptHandoff`, `createAuthAttemptChallenge`, `verifyAuthAttemptChallenge`, `createUserPasskeyRegistration`, `completeUserPasskeyRegistration` | yes | no | no | no | no | no | | **Public** | `createFlow`, `getFlowStep`, `submitFlowStep`, `getLive`, `getReady` | anonymous | — | — | — | — | no | - **In the management class, the credential's scopes and the principal's permissions decide, and nothing else.** An operator passes because the check allows them, not because the plane names them. A person's token, a - PAT and a machine identity are each capped by their scopes; a PAT and a - machine identity never hold more than their owner (identity model). + PAT and a machine identity are each capped by their scopes. +- **What a PAT and a machine identity hold.** A PAT acts as its owner, + capped by its scopes. A principal client acting for its owner never holds + more than the owner; a client acting as itself holds its own grants, which + stay when the owner loses a role (identity model). ADR 053 §9 makes + platform-homed automation wait for that principal's own record. So this + ADR admits a person's token and a Console session now, and PATs and + machine identities once their own record (ADR 036's PAT conditions, the + identity model's principal client) is accepted (open question 7). - **Nothing is hidden for what it returns or takes.** ADR 092 §4's rule that an operation answering with a credential is never a tool is withdrawn, and `x-zitadel-takes-secret` hides nothing. Both marks stay, as warnings: @@ -274,23 +298,33 @@ test holds. `client_id`; - the tool's description says what the answer or the argument holds. - **Asking the person before a marked or destructive call (ADR 092 §6).** - Recommended: - - the gate is the scope the person consented to, which is never - preselected for these operations, plus the client's own prompt; - - the endpoint's question is sent where the client can answer it - (protocol revision `2026-07-28`). A client on an earlier revision is - served without it, rather than refused, as long as its token carries the - operation's own scope (`user.set_password`, `session.delete`); - - a machine identity is never asked: its grants are the decision. - This keeps today's clients and unattended identities working. It also - keeps the strongest operations behind a scope that a person ticked on - purpose. + Recommended, in two stages: + - **Until scope choice ships** (PR 3543): consent on main grants all + requested scopes or none (`flowengine/auth_request.go`), and most + marked operations share a scope with harmless ones (`createDeployment` + and `rollbackDeployment` share `deployment.write`; `createInvitation` + shares `project.write`). So the scope is no gate yet. A marked or + destructive call through the endpoint from a client that cannot answer + the question (protocol revision before `2026-07-28`) is **refused**, as + ADR 092 §6 has it today. + - **Once a person can choose scopes, and each marked operation has a scope + of its own** (`user.set_password`, `session.delete`, a new + `deployment.deploy`, `invitation.create`, `application.publish`, + `variable.write`): the scope a person ticked on purpose is the gate. The + endpoint still asks where the client can answer; a client that cannot is + served if its token carries that operation's own scope. + - A machine identity is never asked: its grants are the decision. - **What stays with a person's own session.** `getMySession`, `revokeMySession` and `getMySessionCsrfToken` describe the browser session that calls them, so they stay cookie-only. The other session-cookie-only operations are a person's own and take a person's token: the `/users/me` reads (§6), `updateMyUser`, `completeProjectClaim`, and `lookupInvitation`, `acceptInvitation`, `rejectInvitation`. +- **`createProjectClaim` keeps the project secret.** A claim is bound to the + hash of the secret that started it (`secretHashOperations`, `claim.go`), + and the secret is what proves the project is the claimant's. A signed-in + person or machine has no project to claim: it creates one under its team + (next item). - **Two operations take no credential today:** `createProject` and `getProjectClaimWindow`. `createProject` is management. It takes a person's token, a PAT or a machine identity and creates the project under @@ -320,18 +354,30 @@ What this opens to a person, a PAT and a machine identity, each at its gate: |---|---|---| | `querySessions`, `getSession`, `revokeSession` | §3 | `revokeSession` destructive | | `listIdpRevisions`, `listProjectPreviews`, `listDeploymentVariables` | `viewer` | — | -| `publishBranding`, `publishFlowDefinition`, `publishIdp`, `publishPolicy`, `publishSchema`, `createRelease`, `buildRelease` | `editor`; `admin` on the platform project (`requirePlatformConfigurationAdmin`) | — | +| `publishBranding`, `publishFlowDefinition`, `publishIdp`, `publishPolicy`, `publishSchema`, `createRelease`, `buildRelease` | `editor`; on the platform project, operators only (below) | — | | `removeProjectPreview` | `editor` (`whyPreviewRemoval`) | destructive | | `setVariables`, `deleteVariable` | `editor` | takes a secret | -| `publishApplication` | `editor`; `admin` on the platform project | returns a secret | -| `createProjectClaim` | `editor` | returns a secret | +| `publishApplication` | `editor`; on the platform project, operators only (below) | returns a secret | | `createInvitation` | `admin` (ADR 086) | returns a secret | -| `setUserPassword` | `admin` and the cover check (§4) | takes a secret, destructive | -| `createUserPasskeyRegistration`, `completeUserPasskeyRegistration` | `admin` and the cover check (§4) | — | +| `setUserPassword` | `admin` and the cover check (§4); on the platform project, operators only | takes a secret, destructive | | `deactivateTeam` | `admin` and §7's rule | destructive | -The last three rows wait for §4 and §7: none of them admits a person's -credential before the cover check is enforced. +- The last two rows wait for §4 and §7: neither admits a person's credential + before the cover check is enforced. +- The passkey registrations stay on the application plane, which the user + kept out of MCP, until the user decides otherwise (open question 5). +- **The platform project's sign-in configuration is operators' only.** Today + its identity providers, flows, schemas, policies, applications and + releases take only a project secret, and the platform project mints none + (ADR 053 §9), so nobody but configuration changes them. Opening them at + `admin` would let an administrator of the platform project, who is not an + operator, publish an identity provider connection and sign in as any user + linked to it, operators included (links resolve by connection and + subject, `flow_sso_identity_resolver.go`). So on the platform project + `requirePlatformConfigurationAdmin` asks `platform#operator` for every + configuration write a person's credential newly reaches, until the user + decides otherwise (open question 4). The writes a Console session already + makes there (origins, deployments) keep today's `admin`. ### 6. A person's own reads take their token @@ -357,6 +403,14 @@ anyone an admin of a customer's project. member to a team needs, on every project the team holds a role on (as owner or through a team grant), at least that role. Both operations ask it. +- **Who passes it.** The gate today is `admin` on the team's project, the + platform project for an owning team. With the cover rule on top, only an + operator passes both, and a customer still cannot add a co-owner, which + #3470 asks for. Recommended: an active member of the team that owns the + project may add a member (they already hold its `admin`), the gate asks + team membership instead of `admin` on the platform project, and an admin + of the platform project adds one only under the recovery path below (open + question 8). - ADR 054 §8's recovery path stays: an admin of the platform project may add an owner to an owning team that has no active member. That is the one exception, it is logged with `authorization.path`, and an operator may @@ -401,8 +455,10 @@ Decided on 2026-12-02. (`config`, ADR 075 §4). - Its gate is `operator` on the platform. Only operators read it. An admin of the platform project does not. - - Its scope is `platform.read`, which no project secret holds, since no - secret reaches the operator path. + - Its scope is `platform.read`. A project secret's `project.write` stands + in for every scope (`scopeGranted`, `authz.go`), but a secret still + cannot call it: the gate is `platform#operator`, which only a user + homed in the platform project can hold. - There is no write. Issuing operators stays configuration. - **A project says what it is.** The project resource gains `kind`: `platform` for the platform project, `standard` for any other. It shows to @@ -457,10 +513,10 @@ check, and is not that read. | Topic | Permission catalog | Gate contract (`authz_contract_internal_test.go`) | This ADR | |---|---|---|---| | Session reads | `project_viewer` bundle holds `session.read` | `QuerySessions`, `GetSession` ask `viewer` | **Decision wins.** `admin` or the session's user; the catalog and the contract both change. | -| Setting a password | `user.set_password` is admin-only and credential-tier (lines 85, 178) | asks `editor`, marked `openCredentialTier` | **The catalog wins**, plus the cover check (§4); `open` is removed. | +| Setting a password | `user.set_password` is admin-only and credential-tier (lines 85, 178) | asks `editor`, marked `openCredentialTier` | **The catalog wins**, plus the cover check (§4), and operators only on the platform project; `open` is removed. | | Passkey registration for another user | under `user.set_password` | asks `editor`, marked `openCredentialTier` | Same as setting a password. | | A password's scope | `user.set_password` | the spec names `user.write` (catalog drift note) | **The catalog wins**: the scope becomes `user.set_password`. | -| Changing a user's identifiers | `user.write` at `editor`, safe only until email-trusting sign-in | `UpdateUser` asks `editor` | `editor` stays; the cover check (§4) applies to identifier changes. | +| Changing a user's identifiers | `user.write` at `editor`, safe only until email-trusting sign-in | `UpdateUser` asks `editor` | `editor` stays on a workload project, with the cover check (§4); on the platform project, operators only until open question 6 is answered. | | Removing a preview | write never implies delete (line 53) | asks `editor`, `whyPreviewRemoval`, marked `openWriteIsNotDelete` | **The contract wins** for previews: removing one ends a preview early and keeps its history. The `open` note stays for `deleteVariable` and `revokeRelease`, which this ADR does not decide. | | Invitation reads | folded into `team_membership.read`, which viewers hold | ADR 086 asks `admin`, marked `openInvitationRead` | Not decided here. A person's token keeps ADR 086's `admin`. | | Operators as a role on the platform project | `platform.operator` is not a role on the platform project (line 246) | — | Unchanged: `listPlatformOperators` gates on `platform#operator`, not on `project#admin`. | @@ -468,33 +524,41 @@ check, and is not that read. ### 12. Sequence +Each step must leave the system no less safe than the step before, on its +own. So the checks land before the operations they bound. + 1. **§6:** a person's own reads take their token, and `listMySessions`. This changes nobody's access to anyone else. 2. **§2 and §3:** the session type in all three dialects, the resolver and oracle, then the session gates, each with its contract row. -3. **§4 and §7:** the cover check, the credential tier at `admin`, and #3470. - This must land before any credential-tier operation, or - `deactivateTeam`, admits a person. -4. **§5:** the class rule and its tests, then the operations it opens, and - ADR 092 §4's amendment. `createProject` for a signed-in caller follows. -5. **§9 and §10:** the platform resource, `kind`, and effective access; the +3. **§8:** on the platform issuer, configuration names the clients that + skip consent. Before this, no step may let a person publish an + application on the platform project. +4. **§4 and §7:** the cover check, the credential tier at `admin`, the + operator-only rule for the platform project, and #3470. +5. **§5:** the class rule and its tests, then the operations it opens, with + the platform project's configuration at `platform#operator`, and ADR 092 + §4's amendment. Marked and destructive calls from clients that cannot + answer stay refused until scope choice and per-operation scopes ship. + `createProject` for a signed-in caller follows. +6. **§9 and §10:** the platform resource, `kind`, and effective access; the Console drops its probe. -6. **§8:** the configured consent-skipping list on the platform issuer. +7. PATs and machine identities, once their own record is accepted. ## Escalation paths, and how this closes each | # | Path | Today | Closed by | |---|---|---|---| | 1 | An admin of the platform project acts deployment-wide | Kept apart by the catalog (ADR 075 §1); nothing lists who is an operator | `platform#operator` stays the only cross-project relation; `listPlatformOperators` gates on it (§9) | -| 2 | An admin or editor of the platform project sets a customer's or an operator's password, or registers a passkey for them | Only the project-secret plane prevents it (`openCredentialTier`) | `admin` plus the cover check (§4); the test holds every credential-tier operation, whichever credential calls it | +| 2 | An admin or editor of the platform project sets a customer's or an operator's password, or registers a passkey for them, including before the account owns anything | Only the project-secret plane prevents it (`openCredentialTier`) | On the platform project, operators only; elsewhere `admin` plus the cover check (§4). The test holds every credential-tier operation, whichever credential calls it | | 3 | An editor changes an operator's or a customer's email, then signs in by email | Safe only while no sign-in trusts the email alone (catalog `user.write`) | The cover check on identifier changes (§4) | | 4 | An admin of the platform project deletes or deactivates an operator's user (lockout) | `deleteUser` asks `admin` | The cover check on `deleteUser` (§4) | | 5 | An admin of the platform project adds a member to a customer's owning team | Open (#3470): `createTeamMembership` asks `admin`, `createUser` with `team_id` asks `editor` | The membership must not confer more than the caller holds (§7); ADR 054 §8 recovery is the one exception | -| 6 | A viewer reads every session's IP, user agent and `metadata` | The catalog's viewer bundle | `session#reader` (§3) | +| 6 | A viewer reads every session's IP, user agent and `metadata` | The catalog's viewer bundle; events also show a request's `ip` and `user_agent` to viewers | `session#reader` (§3) for sessions. **Still open for events:** `listEvents` and `getEvent` ask `viewer` and answer the request metadata. Recommended: answer `ip` and `user_agent` only to `admin`, as sessions do | | 7 | Someone grants themselves `session#reader` on another user's session | Not possible yet: no session type | `ValidateAssignment` refuses every `session` assignment (§2) | | 8 | A credential lands in an outside app's context | No person's token reaches one (#3538 before 049c3080b) | Accepted by the user's decision (§5). Bounded by the operation's scope, never preselected on consent; its event names the principal and `client_id`; the endpoint asks where the client can answer | -| 9 | An admin of the platform project marks an application `first_party`, so the platform issuer asks customers no consent for it | Possible today | On the platform issuer, the clients that skip consent come from configuration (§8) | -| 10 | An agent's token publishes sign-in configuration for the whole cloud | Not possible: only a project secret publishes | `requirePlatformConfigurationAdmin` on the platform project; a release still needs a separate deployment, which asks the person first (§5) | +| 9 | An admin of the platform project marks an application `first_party`, so the platform issuer asks customers no consent for it | Not possible today: a person cannot publish an application (`security.go`, ADR 092 §4) | On the platform issuer, configuration names the clients that skip consent (§8), landing before any person may publish an application there (§12); and the platform project's configuration is operators' only (§5) | +| 10 | An agent's token, or an admin of the platform project, publishes sign-in configuration for the whole cloud, such as an identity provider that signs in as an operator | Not possible: only a project secret publishes, and the platform project mints none | On the platform project, configuration writes ask `platform#operator` (§5). A deployment through the endpoint is refused for a client that cannot answer the question until per-operation scopes ship (§5) | | 11 | A variable's secret value, or a password being set, passes through a model's context | Both writes are project-secret-only | Accepted by the user's decision (§5). `x-zitadel-takes-secret` keeps the scope off the consent screen's defaults and records the mark in events | | 12 | A team secret (`sk_team_`) reaches sessions | — | `session.*` stays off the `sk_team_` allowlist; its Checks answer `NotFound` | @@ -533,21 +597,33 @@ through the MCP endpoint for a person (consent), a PAT or a machine identity (§5); the endpoint leaves out the application sign-in and public operations; `createInvitation` takes a person's token. -1. **Asking before a marked or destructive call (§5).** Accept "the - consented scope is the gate; the endpoint asks where the client can - answer; a machine identity is never asked"? The alternative, refusing - clients that cannot answer, keeps most of today's clients and every - unattended identity off these operations. +1. **Asking before a marked or destructive call (§5).** Accept the two + stages: refused from clients that cannot answer until scope choice and + per-operation scopes ship, then the ticked scope is the gate? 2. **Consent on the platform issuer (§8).** Accept that configuration names the clients that skip consent there, rather than the application's own `first_party` flag? -3. **The cover check's reach (§4).** Apply it to every project, as proposed, - or only where the target holds roles elsewhere, which is the platform - project today? Proposed: everywhere. It costs nothing on a workload - project and protects any later cross-project grant (ADR 053). -4. **Effective access shows every source (§10).** Show every source, or only - the ones that give the strongest role? Proposed: all, so an agent can - explain why access stays after one source is removed. +3. **The cover check's reach (§4).** Every project, as proposed, or only + where the target holds roles elsewhere? +4. **The platform project's sign-in configuration (§5).** Operators only, as + proposed, or may its administrators change it with a personal credential? + Proposed: operators only, since an identity provider published there + signs in as anyone linked to it, operators included. +5. **Registering a passkey for another user (§5).** Stays on the application + plane, as the user's rule has it, or becomes a management operation under + §4? Proposed: stays. +6. **Credentials and identifiers of a platform-project user (§4).** Operators + only, as proposed, because a credential set today keeps whatever the + account owns tomorrow; or `admin` plus the cover check, as elsewhere? + This also settles `updateUser`'s identifier changes there; elsewhere they + stay at `editor` plus the cover check (§11). +7. **PATs and machine identities (§5).** Admitted with this ADR, or once + their own record is accepted? Proposed: once their record is accepted + (ADR 053 §9). +8. **Who adds a member to an owning team (§7).** Its own members, as + proposed, or only operators? +9. **Effective access shows every source (§10).** Every source, as + proposed, or only the strongest? ## Rejected alternatives From a884e749fc19cb75795a1d802b70386193a30efc Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 03:46:31 +0000 Subject: [PATCH 08/10] docs: fold the user's decisions of 2026-12-02 into ADR 094 Operators only for the platform project's sign-in configuration; the consented scope gates risky calls, in two stages; configuration names who skips consent; the cover check on every project; identifier changes ask admin; passkey registration stays on the application plane; PATs and machine identities wait for their own ADR; events show IP and user agent to admins only. Records the role, project secret, invitation and search decisions for the roles ADR. Three questions remain open. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0137eGmTDLdAX6MvNFrobbNT --- docs/adrs/094-project-permission-model.md | 125 +++++++++++++--------- 1 file changed, 73 insertions(+), 52 deletions(-) diff --git a/docs/adrs/094-project-permission-model.md b/docs/adrs/094-project-permission-model.md index 9099aa6d8a..ffb4a4403b 100644 --- a/docs/adrs/094-project-permission-model.md +++ b/docs/adrs/094-project-permission-model.md @@ -204,6 +204,8 @@ operator, may set another person's password. The draft added that only an operator sets an operator's password. This section states that rule as a property of every project. +Decided on 2026-12-02: the cover check applies on every project. + **The rule.** A write that can take over or lock out a user needs `admin` on the user's project, and the caller must cover the target. The caller covers the target when, for every role the target holds on any project, the caller @@ -219,10 +221,11 @@ holds at least that role there, and, when the target holds (identity model). Each is account takeover by another name; - `deleteUser` (lockout); - `updateUser` when it changes an attribute a sign-in identifies by (the - email or the username). The catalog's `user.write` row already warns that - an editor changing identifiers is safe only while no sign-in trusts the - email alone. This closes that before `magic_link` or `otp` arrive, rather - than after. + email or the username). Decided on 2026-12-02: such a change asks + `admin`, raised from `editor`, on every project, since it is a takeover + path. The catalog's `user.write` row already warns that an editor + changing identifiers is safe only while no sign-in trusts the email + alone; this closes it before `magic_link` or `otp` arrive. - **How it is computed.** The target's roles are what `listMyProjects` would answer for the target: their direct grants, their team grants and their owning-team memberships, with the role each gives. The caller must hold at @@ -242,8 +245,8 @@ holds at least that role there, and, when the target holds workload project that is the project's own business. On the platform project, where every account can come to own customer projects, it is not, so there the credential tier, identifier changes and deletion of - another user are **operators' only** until the user decides otherwise - (open question 6). + another user are **operators' only**. That default stands until the user + decides how a credential set today is bounded tomorrow (open question 2). - **What it does on each kind of project:** - On a workload project, whose users hold no role elsewhere, it is just `admin`. @@ -285,10 +288,11 @@ test holds. capped by its scopes. A principal client acting for its owner never holds more than the owner; a client acting as itself holds its own grants, which stay when the owner loses a role (identity model). ADR 053 §9 makes - platform-homed automation wait for that principal's own record. So this - ADR admits a person's token and a Console session now, and PATs and - machine identities once their own record (ADR 036's PAT conditions, the - identity model's principal client) is accepted (open question 7). + platform-homed automation wait for that principal's own record. Decided + on 2026-12-02: this ADR admits a person's token and a Console session; + PATs and machine identities are admitted only once their own ADR (ADR + 036's PAT conditions, the identity model's principal client) is accepted. + Staff automation never holds `operator`. - **Nothing is hidden for what it returns or takes.** ADR 092 §4's rule that an operation answering with a credential is never a tool is withdrawn, and `x-zitadel-takes-secret` hides nothing. Both marks stay, as warnings: @@ -298,7 +302,9 @@ test holds. `client_id`; - the tool's description says what the answer or the argument holds. - **Asking the person before a marked or destructive call (ADR 092 §6).** - Recommended, in two stages: + Decided on 2026-12-02: the consented scope is the gate, the endpoint asks + only where the client can answer, and a machine is never asked. In two + stages: - **Until scope choice ships** (PR 3543): consent on main grants all requested scopes or none (`flowengine/auth_request.go`), and most marked operations share a scope with harmless ones (`createDeployment` @@ -314,6 +320,13 @@ test holds. endpoint still asks where the client can answer; a client that cannot is served if its token carries that operation's own scope. - A machine identity is never asked: its grants are the decision. + - **Today, PR 3542** offers the three operations that answer with a + credential (`publishApplication`, `createProjectClaim`, + `createInvitation`) as tools and asks about none of them: the + `x-zitadel-returns-secret` mark only words the tool's description. That + is consistent with the decision only while those three are not + destructive; marking any of them destructive brings it under the first + stage. - **What stays with a person's own session.** `getMySession`, `revokeMySession` and `getMySessionCsrfToken` describe the browser session that calls them, so they stay cookie-only. The other session-cookie-only @@ -364,8 +377,8 @@ What this opens to a person, a PAT and a machine identity, each at its gate: - The last two rows wait for §4 and §7: neither admits a person's credential before the cover check is enforced. -- The passkey registrations stay on the application plane, which the user - kept out of MCP, until the user decides otherwise (open question 5). +- The passkey registrations stay on the application plane, out of MCP, + with the other application sign-in calls (decided on 2026-12-02). - **The platform project's sign-in configuration is operators' only.** Today its identity providers, flows, schemas, policies, applications and releases take only a project secret, and the platform project mints none @@ -375,9 +388,9 @@ What this opens to a person, a PAT and a machine identity, each at its gate: linked to it, operators included (links resolve by connection and subject, `flow_sso_identity_resolver.go`). So on the platform project `requirePlatformConfigurationAdmin` asks `platform#operator` for every - configuration write a person's credential newly reaches, until the user - decides otherwise (open question 4). The writes a Console session already - makes there (origins, deployments) keep today's `admin`. + configuration write a person's credential newly reaches (decided on + 2026-12-02: operators only). The writes a Console session already makes + there (origins, deployments) keep today's `admin`. ### 6. A person's own reads take their token @@ -410,7 +423,7 @@ anyone an admin of a customer's project. project may add a member (they already hold its `admin`), the gate asks team membership instead of `admin` on the platform project, and an admin of the platform project adds one only under the recovery path below (open - question 8). + question 1). - ADR 054 §8's recovery path stays: an admin of the platform project may add an owner to an owning team that has no active member. That is the one exception, it is logged with `authorization.path`, and an operator may @@ -436,7 +449,7 @@ What remains of the finding is consent itself: an admin of the platform project may call. A first-party client of the platform issuer is asked no consent (ADR 082 §3), so its tokens carry every scope it asks for, for every customer who signs in to it. -- **Recommendation:** on the platform issuer, the deployment's configuration +- **Decided on 2026-12-02:** on the platform issuer, the deployment's configuration names the clients that skip consent (`oauth.first_party_clients`: the Console, the CLI). The document's flag still decides consent on every other project's issuer, where the project's own admins are the right @@ -516,7 +529,7 @@ check, and is not that read. | Setting a password | `user.set_password` is admin-only and credential-tier (lines 85, 178) | asks `editor`, marked `openCredentialTier` | **The catalog wins**, plus the cover check (§4), and operators only on the platform project; `open` is removed. | | Passkey registration for another user | under `user.set_password` | asks `editor`, marked `openCredentialTier` | Same as setting a password. | | A password's scope | `user.set_password` | the spec names `user.write` (catalog drift note) | **The catalog wins**: the scope becomes `user.set_password`. | -| Changing a user's identifiers | `user.write` at `editor`, safe only until email-trusting sign-in | `UpdateUser` asks `editor` | `editor` stays on a workload project, with the cover check (§4); on the platform project, operators only until open question 6 is answered. | +| Changing a user's identifiers | `user.write` at `editor`, safe only until email-trusting sign-in | `UpdateUser` asks `editor` | **Decided:** `admin` and the cover check on every project (§4); on the platform project, operators only. | | Removing a preview | write never implies delete (line 53) | asks `editor`, `whyPreviewRemoval`, marked `openWriteIsNotDelete` | **The contract wins** for previews: removing one ends a preview early and keeps its history. The `open` note stays for `deleteVariable` and `revokeRelease`, which this ADR does not decide. | | Invitation reads | folded into `team_membership.read`, which viewers hold | ADR 086 asks `admin`, marked `openInvitationRead` | Not decided here. A person's token keeps ADR 086's `admin`. | | Operators as a role on the platform project | `platform.operator` is not a role on the platform project (line 246) | — | Unchanged: `listPlatformOperators` gates on `platform#operator`, not on `project#admin`. | @@ -554,7 +567,7 @@ own. So the checks land before the operations they bound. | 3 | An editor changes an operator's or a customer's email, then signs in by email | Safe only while no sign-in trusts the email alone (catalog `user.write`) | The cover check on identifier changes (§4) | | 4 | An admin of the platform project deletes or deactivates an operator's user (lockout) | `deleteUser` asks `admin` | The cover check on `deleteUser` (§4) | | 5 | An admin of the platform project adds a member to a customer's owning team | Open (#3470): `createTeamMembership` asks `admin`, `createUser` with `team_id` asks `editor` | The membership must not confer more than the caller holds (§7); ADR 054 §8 recovery is the one exception | -| 6 | A viewer reads every session's IP, user agent and `metadata` | The catalog's viewer bundle; events also show a request's `ip` and `user_agent` to viewers | `session#reader` (§3) for sessions. **Still open for events:** `listEvents` and `getEvent` ask `viewer` and answer the request metadata. Recommended: answer `ip` and `user_agent` only to `admin`, as sessions do | +| 6 | A viewer reads every session's IP, user agent and `metadata` | The catalog's viewer bundle; events also show a request's `ip` and `user_agent` to viewers | `session#reader` (§3) for sessions. **Still open for events:** `listEvents` and `getEvent` ask `viewer` and answer the request metadata. Decided on 2026-12-02: `ip` and `user_agent` are answered only to `admin`, as sessions are | | 7 | Someone grants themselves `session#reader` on another user's session | Not possible yet: no session type | `ValidateAssignment` refuses every `session` assignment (§2) | | 8 | A credential lands in an outside app's context | No person's token reaches one (#3538 before 049c3080b) | Accepted by the user's decision (§5). Bounded by the operation's scope, never preselected on consent; its event names the principal and `client_id`; the endpoint asks where the client can answer | | 9 | An admin of the platform project marks an application `first_party`, so the platform issuer asks customers no consent for it | Not possible today: a person cannot publish an application (`security.go`, ADR 092 §4) | On the platform issuer, configuration names the clients that skip consent (§8), landing before any person may publish an application there (§12); and the platform project's configuration is operators' only (§5) | @@ -590,40 +603,48 @@ own. So the checks land before the operations they bound. releases. Serving one stays a deployment, which the MCP endpoint asks before. +## Related decisions of 2026-12-02 + +Recorded here for the roles ADR, which is not written yet: + +- **Roles.** Viewer, editor and admin stay the only ladder (ADR 054 §5). + There is no `user_manager` role and no `supporter` level. A help-desk + person is a viewer who is granted the single permissions they need; a + named bundle can follow. Staff support is an operator giving one staff + member a viewer grant on one project, with an expiry. +- **The project secret** shrinks to an application's sign-in calls and local + development once PATs and service accounts exist. No date is set, and it + keeps working until people have moved. +- **Invitations** take the grant scopes (`grant.create`, `grant.read`, + `grant.delete`), which answers the permission catalog's open question 8 + (zitadel/nextgen#3538). +- **`search`** asks each result type's own read scope of a person's token. + ## Open questions for the user -Decided on 2026-12-02 and folded in: every management operation goes -through the MCP endpoint for a person (consent), a PAT or a machine identity -(§5); the endpoint leaves out the application sign-in and public operations; -`createInvitation` takes a person's token. - -1. **Asking before a marked or destructive call (§5).** Accept the two - stages: refused from clients that cannot answer until scope choice and - per-operation scopes ship, then the ticked scope is the gate? -2. **Consent on the platform issuer (§8).** Accept that configuration names - the clients that skip consent there, rather than the application's own - `first_party` flag? -3. **The cover check's reach (§4).** Every project, as proposed, or only - where the target holds roles elsewhere? -4. **The platform project's sign-in configuration (§5).** Operators only, as - proposed, or may its administrators change it with a personal credential? - Proposed: operators only, since an identity provider published there - signs in as anyone linked to it, operators included. -5. **Registering a passkey for another user (§5).** Stays on the application - plane, as the user's rule has it, or becomes a management operation under - §4? Proposed: stays. -6. **Credentials and identifiers of a platform-project user (§4).** Operators - only, as proposed, because a credential set today keeps whatever the - account owns tomorrow; or `admin` plus the cover check, as elsewhere? - This also settles `updateUser`'s identifier changes there; elsewhere they - stay at `editor` plus the cover check (§11). -7. **PATs and machine identities (§5).** Admitted with this ADR, or once - their own record is accepted? Proposed: once their record is accepted - (ADR 053 §9). -8. **Who adds a member to an owning team (§7).** Its own members, as - proposed, or only operators? -9. **Effective access shows every source (§10).** Every source, as - proposed, or only the strongest? +Decided on 2026-12-02 and folded in: +- every management operation goes through the MCP endpoint (§5); +- asking before a call, in two stages (§5); +- who skips consent on the platform issuer (§8); +- the cover check on every project (§4); +- the platform project's sign-in configuration is operators' only (§5); +- passkey registration stays on the application plane (§5); +- identifier changes ask `admin` (§4); +- PATs and machine identities wait for their own ADR (§5); +- request `ip` and `user_agent` in events go to admins only. + +Still open: + +1. **Who adds a member to an owning team (§7, #3470).** Its own members, an + admin of the platform project only through ADR 054 §8's recovery path, + and operators always, as proposed; or only operators? +2. **Credentials of a platform-project user (§4).** The cover check holds + only at the moment of the write. Keep setting another platform-project + user's password, and deleting that user, to operators, as now proposed; + or allow `admin` with the cover check and bound what a credential set + today keeps tomorrow in another way? +3. **Effective access shows every source (§10).** Every source, as proposed, + or only the strongest? ## Rejected alternatives From 5e2114d31387e84ecce0f4c49941c2631872de8b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 04:17:12 +0000 Subject: [PATCH 09/10] docs: say plainly that ADR 094 decided who reads a request's IP in events Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0137eGmTDLdAX6MvNFrobbNT --- docs/adrs/094-project-permission-model.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/adrs/094-project-permission-model.md b/docs/adrs/094-project-permission-model.md index ffb4a4403b..2773eff8b5 100644 --- a/docs/adrs/094-project-permission-model.md +++ b/docs/adrs/094-project-permission-model.md @@ -567,7 +567,7 @@ own. So the checks land before the operations they bound. | 3 | An editor changes an operator's or a customer's email, then signs in by email | Safe only while no sign-in trusts the email alone (catalog `user.write`) | The cover check on identifier changes (§4) | | 4 | An admin of the platform project deletes or deactivates an operator's user (lockout) | `deleteUser` asks `admin` | The cover check on `deleteUser` (§4) | | 5 | An admin of the platform project adds a member to a customer's owning team | Open (#3470): `createTeamMembership` asks `admin`, `createUser` with `team_id` asks `editor` | The membership must not confer more than the caller holds (§7); ADR 054 §8 recovery is the one exception | -| 6 | A viewer reads every session's IP, user agent and `metadata` | The catalog's viewer bundle; events also show a request's `ip` and `user_agent` to viewers | `session#reader` (§3) for sessions. **Still open for events:** `listEvents` and `getEvent` ask `viewer` and answer the request metadata. Decided on 2026-12-02: `ip` and `user_agent` are answered only to `admin`, as sessions are | +| 6 | A viewer reads every session's IP, user agent and `metadata` | The catalog's viewer bundle; events also show a request's `ip` and `user_agent` to viewers | `session#reader` (§3) for sessions. **For events:** `listEvents` and `getEvent` ask `viewer` and answer the request metadata today. Decided on 2026-12-02: `ip` and `user_agent` are answered only to `admin`, as sessions are | | 7 | Someone grants themselves `session#reader` on another user's session | Not possible yet: no session type | `ValidateAssignment` refuses every `session` assignment (§2) | | 8 | A credential lands in an outside app's context | No person's token reaches one (#3538 before 049c3080b) | Accepted by the user's decision (§5). Bounded by the operation's scope, never preselected on consent; its event names the principal and `client_id`; the endpoint asks where the client can answer | | 9 | An admin of the platform project marks an application `first_party`, so the platform issuer asks customers no consent for it | Not possible today: a person cannot publish an application (`security.go`, ADR 092 §4) | On the platform issuer, configuration names the clients that skip consent (§8), landing before any person may publish an application there (§12); and the platform project's configuration is operators' only (§5) | From 250de078bdc1b5388d311e0ffc4e4f75ee7ce725 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 04:50:12 +0000 Subject: [PATCH 10/10] docs: close ADR 094's last open questions with the user's decisions Owning-team members and operators add members; another platform-project user's credentials and deletion are operators' only; effective access lists every source. Records the cancelInvitation, secret rotation and invitation replacement decisions, and that the roles ADR waits. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0137eGmTDLdAX6MvNFrobbNT --- docs/adrs/094-project-permission-model.md | 51 ++++++++++++----------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/docs/adrs/094-project-permission-model.md b/docs/adrs/094-project-permission-model.md index 2773eff8b5..5041b7bd11 100644 --- a/docs/adrs/094-project-permission-model.md +++ b/docs/adrs/094-project-permission-model.md @@ -245,8 +245,8 @@ holds at least that role there, and, when the target holds workload project that is the project's own business. On the platform project, where every account can come to own customer projects, it is not, so there the credential tier, identifier changes and deletion of - another user are **operators' only**. That default stands until the user - decides how a credential set today is bounded tomorrow (open question 2). + another user are **operators' only** (decided on 2026-12-02: those are + customer accounts, so an admin setting one would be an account takeover). - **What it does on each kind of project:** - On a workload project, whose users hold no role elsewhere, it is just `admin`. @@ -419,11 +419,11 @@ anyone an admin of a customer's project. - **Who passes it.** The gate today is `admin` on the team's project, the platform project for an owning team. With the cover rule on top, only an operator passes both, and a customer still cannot add a co-owner, which - #3470 asks for. Recommended: an active member of the team that owns the - project may add a member (they already hold its `admin`), the gate asks - team membership instead of `admin` on the platform project, and an admin - of the platform project adds one only under the recovery path below (open - question 1). + #3470 asks for. Decided on 2026-12-02: an active member of the team that + owns the project may add a member (they already hold its `admin`), the + gate asks team membership instead of `admin` on the platform project, an + operator may always add one, and an admin of the platform project adds + one only under the recovery path below. - ADR 054 §8's recovery path stays: an admin of the platform project may add an owner to an owning team that has no active member. That is the one exception, it is logged with `authorization.path`, and an operator may @@ -506,7 +506,8 @@ check, and is not that read. `access` is the caller's, never anyone else's. - **`role`** is `StrongestProjectRole`. - **`sources`** lists every path that grants a role, not only the first one - that allowed. The resolver today stops at the first allow (`CheckPath`), so + that allowed (decided on 2026-12-02: otherwise removing the strongest + grant leaves access nobody saw). The resolver today stops at the first allow (`CheckPath`), so this needs one more statement: the caller's active assignments that close to a project role, plus the operator path. - **What it answers:** @@ -618,11 +619,22 @@ Recorded here for the roles ADR, which is not written yet: - **Invitations** take the grant scopes (`grant.create`, `grant.read`, `grant.delete`), which answers the permission catalog's open question 8 (zitadel/nextgen#3538). + `createInvitation` with `replaces_invitation_id` deletes the original, so + it also asks `grant.delete`, and `grant.read` when it carries the + original's metadata over. +- **`cancelInvitation`** is not asked about before it runs: cancelling is + how a leaked invitation link is ended, and a client that cannot answer + the endpoint's question must be able to end one (zitadel/nextgen#3542). +- **A leaked client secret** is replaced through a dedicated rotate + operation, in its own change; today only a retry with the request's + `Idempotency-Key` replaces it, which a tool cannot send. - **`search`** asks each result type's own read scope of a person's token. +- **The roles ADR** waits until someone builds help-desk permissions; the + decisions above are its record until then. -## Open questions for the user +## Open questions -Decided on 2026-12-02 and folded in: +None. Decided on 2026-12-02 and folded in: - every management operation goes through the MCP endpoint (§5); - asking before a call, in two stages (§5); - who skips consent on the platform issuer (§8); @@ -630,21 +642,12 @@ Decided on 2026-12-02 and folded in: - the platform project's sign-in configuration is operators' only (§5); - passkey registration stays on the application plane (§5); - identifier changes ask `admin` (§4); +- another platform-project user's credentials and deletion are operators' + only (§4); +- who adds a member to an owning team (§7); - PATs and machine identities wait for their own ADR (§5); -- request `ip` and `user_agent` in events go to admins only. - -Still open: - -1. **Who adds a member to an owning team (§7, #3470).** Its own members, an - admin of the platform project only through ADR 054 §8's recovery path, - and operators always, as proposed; or only operators? -2. **Credentials of a platform-project user (§4).** The cover check holds - only at the moment of the write. Keep setting another platform-project - user's password, and deleting that user, to operators, as now proposed; - or allow `admin` with the cover check and bound what a credential set - today keeps tomorrow in another way? -3. **Effective access shows every source (§10).** Every source, as proposed, - or only the strongest? +- request `ip` and `user_agent` in events go to admins only; +- effective access lists every source (§10). ## Rejected alternatives