From c0d53687d4d8b8238654d698abbcc65d23e1a11c Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 25 Nov 2026 15:52:16 -0800 Subject: [PATCH 1/3] docs: record that a call made for a user names who acts and how the management API takes bearers --- .../033-internal-permission-management.md | 87 ++++++++++++------ docs/adrs/036-api-credential-planes.md | 30 +++++++ docs/adrs/037-token-lifecycle.md | 10 +++ docs/adrs/082-oauth-and-oidc-server.md | 26 ++++-- docs/adrs/README.md | 6 +- docs/design/api/events-for-people.md | 19 +++- docs/design/api/identity-model.md | 89 +++++++++++++------ docs/design/glossary.md | 7 +- 8 files changed, 211 insertions(+), 63 deletions(-) diff --git a/docs/adrs/033-internal-permission-management.md b/docs/adrs/033-internal-permission-management.md index 3dab119d8f..9214390af0 100644 --- a/docs/adrs/033-internal-permission-management.md +++ b/docs/adrs/033-internal-permission-management.md @@ -3,6 +3,13 @@ > **Status:** Proposed > **Date:** 2026-07-09 > **Context:** Authorization for Zitadel-owned internal resources (projects, teams, users, apps, flows, policies) and agent delegation. Builds on [ADR 032](032-permission-catalogs.md). +> +> **Amended 2026-11-25** (§3, §5): every call made for a user names who acts, +> and no token hides its actor. A delegation is a user's consent to a client, +> a token exchange, or an operator's act-as that the user did not grant, with +> one `delegation_id` that the consent, the tokens and every event share. +> Consent is its own record, not an assignment. There is no impersonation. An +> agent is an application, and its client is the principal. ## Introduction @@ -47,7 +54,7 @@ Terms specific to internal/system-catalog authorization, in addition to |---|---| | **System catalog** | The catalog of Zitadel-owned permissions and optional bundles for internal API resources; replaces legacy level-specific role semantics. See [ADR 032 §1](032-permission-catalogs.md#1-one-model-two-catalogs). | | **Credential class** | The kind of principal presenting a request (user token, `sk_proj_`, `sk_team_`, origin-bound browser nonce), which constrains which permissions/scopes are even reachable regardless of grants. | -| **Agent delegation** | A scoped, explicit, auditable grant of authority from a human or service principal to an agent, distinct from the agent inheriting the grantor's full permission set. | +| **Delegation** | Authority to act for a user: the user's consent to a client, a token exchange, or an operator's act-as that the user did not grant. Scoped, explicit and audited under one `delegation_id`, distinct from the acting principal inheriting the user's full permission set (§3). | ## Context @@ -77,8 +84,9 @@ Two related issue areas constrain the decision: - Tenant isolation and data residency need project/tenant boundaries that can be enforced before resource data is fetched. -- Agent identity needs first-class principals and scoped delegations, not - broad inherited user authority. +- Agents need scoped delegations, not broad inherited user authority. An + agent is an application, and the client it acts through is the principal + ([identity model](../design/api/identity-model.md#applications)). Cross-project human identity (agencies, consultants, platform staff, and operators) is a related but distinct issue area, tracked by @@ -140,15 +148,35 @@ access is out of scope here (see Introduction, [#333](https://github.com/zitadel whatever grant model that future ADR defines must fit this same storage/residency invariant, not bypass it. -### 3. Agent delegation +### 3. Delegation -Agent delegations are stored as assignments with an explicit grantor, -delegation id, expiry/revocation state, and scope (the general storage -shape from [ADR 032 §3](032-permission-catalogs.md#3-canonical-relational-storage)). -An agent never receives permissions by copying all permissions from its -owner. The resolver must be able to explain which delegation authorized or -denied an agent action, so that both audit review and the agent itself can -see exactly why an action succeeded or failed. +**Amended 2026-11-25.** Every call made for a user names who acts: a token +issued for a user on behalf of another principal carries `act`, and Zitadel +issues no token that hides its actor. A delegation is a user's consent to a +client, a token exchange, or an operator's act-as that the user did not +grant. It has one `delegation_id`, which the consent record, the tokens and +every event share. + +There is no impersonation. A support or admin act-as is a delegation the user +did not grant, named and recorded as one. + +Consent is a record of its own per user, client and protected API, holding a +set of scopes ([ADR 082 §8](082-oauth-and-oidc-server.md#8-consent)). It is +not an `authz_assignments` row: that table's foreign key to a catalog +relation, its principal types, which have no client, and its lack of an API +column cannot hold it. Assignment rows reference a `delegation_id` only for +grants on Zitadel's own API; those are stored with an explicit grantor, +expiry/revocation state, and scope (the general storage shape from +[ADR 032 §3](032-permission-catalogs.md#3-canonical-relational-storage)). + +Whether a first-hop token, which a client obtains itself with the +authorization code grant, carries `act` beside `client_id` is +[ADR 082's open question 7](082-oauth-and-oidc-server.md#open-questions). + +An acting principal never receives permissions by copying all permissions +from the user it acts for. The resolver must be able to explain which +delegation authorized or denied an action, so that both audit review and the +acting principal can see exactly why an action succeeded or failed. ### 4. Resolver and list filtering for internal resources @@ -201,20 +229,27 @@ the same authorization semantics. ### 5. Audit trail and grant provenance -Every action performed under an explicit grant or agent delegation records -the grant context in the event actor metadata. For example, an agent acting -under a delegation: +Every action performed under an explicit grant or a delegation records the +grant context in the event actor metadata. A delegated event records `actor`, +the acting principal (a client or an operator); `user_id`, the user acted +for; `grantor`, who authorized it; `delegation_id`; and `delegation_type`. +For example, a client acting for a user under a delegation: ``` -actor: agent:report-bot -delegation_id: delegation-123 -grantor: user:alice -action: project.export.create -target: project:42 +actor: client:report-bot +user_id: user:alice +grantor: user:alice +delegation_id: delegation-123 +delegation_type: delegated +action: project.export.create +target: project:42 ``` -This makes delegated agent actions visible in the resource owner's audit -log. There is no hidden access path: the grant check and the audit record +The event contract still lists `agent` as an actor type until the rename to +`client` lands ([identity model](../design/api/identity-model.md#what-changes)). + +This makes delegated actions visible in the resource owner's audit log. +There is no hidden access path: the grant check and the audit record are the same code path. (The equivalent shape for staff/support grants — issuer, human-readable `reason`, role tier, and a break-glass escape hatch for when normal grant issuance is unavailable — is defined by @@ -266,14 +301,14 @@ scoped SQL query against data we already own. `app.read`, `app.write`, `app.delete` — and extend to all Zitadel resource types. Canonical names live in [`docs/design/api/system-permission-catalog.md`](../design/api/system-permission-catalog.md). -2. Design relational migrations for `resource_scope_index` and agent - delegation columns on `authz_assignments` (D2 — not sibling delegation - tables). Wave 0 DDL spike and locked decisions: +2. Design relational migrations for `resource_scope_index` and the + delegation columns on `authz_assignments` for grants on Zitadel's own API + (D2 — not sibling delegation tables; consent is its own record, §3). Wave 0 DDL spike and locked decisions: [`docs/design/api/permission-storage.md`](../design/api/permission-storage.md) (implementation tracked by [issue #422](https://github.com/zitadel/nextgen/issues/422)). 3. Update OpenAPI security declarations to use the final permission names. -4. Define agent delegation schema, audit record shape, and denial - explanation fields. +4. Define the delegation schema, audit record shape, and denial explanation + fields. 5. Staff/support access, cross-project human identity, and the break-glass escape hatch are tracked by [issue #333](https://github.com/zitadel/nextgen/issues/333) and intentionally out of scope here. Cross-project principals are diff --git a/docs/adrs/036-api-credential-planes.md b/docs/adrs/036-api-credential-planes.md index 08f967ff70..31f8c0ceb0 100644 --- a/docs/adrs/036-api-credential-planes.md +++ b/docs/adrs/036-api-credential-planes.md @@ -349,3 +349,33 @@ A deployment to `primary` freezes the project's primary origins, and a rollback restores the ones it names. A primary origin serves the newest primary deployment only when that deployment names it and the project still lists it. So an added origin waits for a deploy, and removing one takes effect at once. + +## Amendment (2026-11-25): the management API accepts platform bearers + +The management API accepts access tokens issued by the platform project's +issuer whose audience is the management API. It checks the session on every +call and admits exactly the operations a console session may call. A session +cookie is accepted only from a browser on the issuer's own origin, and every +other caller presents a bearer. The server verifies the issuer and the +signing project exactly, so a customer project's token cannot pass as a +platform token. This is the user bearer +[ADR 053 §5](053-cross-project-principals.md#5-first-party-human-sessions-may-call-the-operator-plane) +expects, with the same principal and grant semantics as the console's cookie. + +| Caller | Credential | +|---|---| +| The console, on the issuer's origin | Its session cookie | +| The login widget and SDK proxy in a customer's app | The end user's session cookie, with the publishable key | +| The CLI | The platform token it gets from `zitadel login` | +| A remote MCP client | A bearer: a personal access token first, an OAuth token once consent and client registration ship ([ADR 082](082-oauth-and-oidc-server.md#recommended-sequence)) | +| CI and customer backends | The project secret today; workload identity federation is planned, GitHub Actions first, and service applications later | + +Personal access tokens are added as a bridge, on four conditions: + +- each has a required expiry; +- an event's actor is the token's owner; +- each can be revoked; +- a personal access token is never a client's identity. + +This brings in operator PATs, which the operator row and +[Out of scope](#out-of-scope) put later, as that bridge. diff --git a/docs/adrs/037-token-lifecycle.md b/docs/adrs/037-token-lifecycle.md index c078ef8d3b..adad160003 100644 --- a/docs/adrs/037-token-lifecycle.md +++ b/docs/adrs/037-token-lifecycle.md @@ -3,6 +3,10 @@ > **Status:** Accepted > **Date:** 2026-06-30 > **Context:** Evolution of session security +> +> **Amended 2026-11-25** (Personal Access Tokens): personal access tokens are +> added as a bridge to the management API, on the conditions of +> [ADR 036](036-api-credential-planes.md#amendment-2026-11-25-the-management-api-accepts-platform-bearers). ## Context @@ -129,3 +133,9 @@ possible right now. PATs are out of scope for now as well. They do not provide any extra value yet in the MVP. + +**Amended 2026-11-25:** PATs are added as a bridge to the management API: a +remote MCP client presents one until OAuth consent and client registration +ship. A PAT has a required expiry, can be revoked, makes its +owner the actor of the events it causes, and is never a client's identity +([ADR 036](036-api-credential-planes.md#amendment-2026-11-25-the-management-api-accepts-platform-bearers)). diff --git a/docs/adrs/082-oauth-and-oidc-server.md b/docs/adrs/082-oauth-and-oidc-server.md index ef78848fc0..1c294ef0f4 100644 --- a/docs/adrs/082-oauth-and-oidc-server.md +++ b/docs/adrs/082-oauth-and-oidc-server.md @@ -48,6 +48,12 @@ > only when it sent Basic credentials. The code names the deployment that > served its request, so a declared client authenticates against that > deployment's variable (zitadel/nextgen#2796). +> +> **Amended 2026-11-25** (§8, §11, open question 7): a consent is a +> delegation ([ADR 033 §3](033-internal-permission-management.md#3-delegation)): +> one record per user, client and API, holding a set of scopes, with a +> `delegation_id` that its tokens and their events share. Token exchange is +> delegation, never impersonation: the token names who acts in `act`. ## TL;DR @@ -411,8 +417,11 @@ refresh tokens ship. ### 8. Consent A consent records that a user let a client use some scopes. It is kept per -user, client and scope, and is called a consent because ADR 032 uses *grant* -for permissions. The flow engine inserts the consent step (ADR 081 §11) when +user, client and API, as one record holding a set of scopes, and is called a +consent because ADR 032 uses *grant* for permissions. A consent is a +delegation ([ADR 033 §3](033-internal-permission-management.md#3-delegation)): +it carries a `delegation_id`, which the tokens issued under it and their +events share. The flow engine inserts the consent step (ADR 081 §11) when a third-party client asks for scopes the user has not consented to, and whenever a request says `prompt=consent`, and on every request for an application whose document says so (§3). The scope descriptions on the @@ -471,9 +480,11 @@ enterprise-managed authorization builds on token exchange and comes with it ### 11. Later -- Token exchange (RFC 8693), first, since delegation, impersonation and - workload identity federation ride on it, and MCP's enterprise-managed - authorization with them (§10). +- Token exchange (RFC 8693), first, since delegation and workload identity + federation ride on it, and MCP's enterprise-managed authorization with them + (§10). Token exchange is delegation, never impersonation: a token it issues + for a user names the acting client in `act`, and Zitadel issues none that + hides its actor ([ADR 033 §3](033-internal-permission-management.md#3-delegation)). - Device authorization (RFC 8628) for CLIs and TVs. - Back-channel logout for third-party clients (first-party ones share the session, ADR 081 §12). @@ -598,6 +609,11 @@ protocol spans the server, the SDK proxy and the widget. ``, and its name. 6. How a registered application moves into the release, since the release build refuses a file that takes its slug (§3). +7. Whether a first-hop token, which a client obtains itself with the + authorization code grant, carries `act` in addition to `client_id`, or + `act` appears only when a different principal presents the user, through + token exchange or an operator's act-as + ([ADR 033 §3](033-internal-permission-management.md#3-delegation)). ## Rejected alternatives diff --git a/docs/adrs/README.md b/docs/adrs/README.md index a4f70eaf40..1abc2d3d1b 100644 --- a/docs/adrs/README.md +++ b/docs/adrs/README.md @@ -38,11 +38,11 @@ This directory contains architecture decision records (ADRs) for nextgen. | [030](030-error-model-mapping-and-reporting.md) | Error Model, Mapping, and Reporting | Accepted (amended) | Adopt `domain.Error` as canonical (add `Unwrap`, drop `Parent`→`Details`); `database.*Error` stays storage-local; shared `internal/errreport` leaf with global atomics captures location everywhere and gated deepest-first stacks; per-layer types glued via `sloggcp` interfaces; storage→domain→API mapping plus redaction policy; logging is one request line plus one error line per failing request (amended 2026-10-23). | | [031](031-openapi-querying.md) | OpenAPI querying | Accepted (amended) | Flexible query language for list endpoints: `POST //query` with `limit`, `page_token`, `sorting` and `filter`; adopt `QUERY` once OpenAPI/Ogen support it. Amended 2026-10-24 to the shipped operator set and GET policy. | | [032](032-permission-catalogs.md) | Permission Catalogs — A Portable Relational FGA Core | Accepted | One permission engine, two catalogs (system and app-group) over a shared OpenFGA parser/profile/compiler pipeline and portable relational storage/resolver core for internal and external authorization; companion to ADR 033 and ADR 034. | -| [033](033-internal-permission-management.md) | Internal Permission Management (System Catalog) | Proposed | System-catalog authorization for Zitadel-owned resources: `resource_scope_index`, list-endpoint predicate injection, 403/404 denial semantics, and audited agent delegation. Staff/support and cross-project access are out of scope, tracked by issue #333. Companion to ADR 032 and ADR 034. | +| [033](033-internal-permission-management.md) | Internal Permission Management (System Catalog) | Proposed | System-catalog authorization for Zitadel-owned resources: `resource_scope_index`, list-endpoint predicate injection, 403/404 denial semantics, and audited agent delegation. Staff/support and cross-project access are out of scope, tracked by issue #333. Companion to ADR 032 and ADR 034. Amended 2026-11-25: a delegation (a user's consent, a token exchange, or an operator's act-as the user did not grant) has one `delegation_id` that consent, tokens and events share; a token issued for a user on behalf of another principal carries `act`; consent is its own record, not an assignment; no impersonation. | | [034](034-external-permission-management.md) | External Permission Management (App-Group Catalog) | Proposed | App-group catalog for customer-owned apps/APIs — customer-authored policies, app grants, and token claims — built on the shared OpenFGA parser/profile/compiler pipeline defined in ADR 032. Companion to ADR 032 and ADR 033. | | [035](035-configuration-environments.md) | Environment Releases for Configuration Resources | Accepted | Configuration bundled as immutable **releases** pinning specific revisions of each resource; **environments** are runtime slots that run one release at a time; **deployments** are immutable records linking releases to environments. Supersedes ADR 007's `plan`/`apply` orchestration in favor of atomic release construction plus a separate deploy step. Amended by ADR 063: a pointer pins a `revision_id`, not a per-revision resource id. | -| [036](036-api-credential-planes.md) | API Credential Planes — Public, App, and Operator | Proposed | Every operation belongs to one credential plane: public (browser; publishable key, origin checks scoped by operation class — credential-establishing ops enforce the allowlist, cookie-principal reads skip it), app (deployment; project secret), operator (CLI/CI; secret, later PATs). Promotes `PreviewSecret` to a publishable key, makes `exchangeHandoff` dual-plane (body-delivered handoffs exchangeable with pk + origin; URL-delivered require PKCE-style proof), and turns dev/prod proxies into credential-free path forwarders — superseding PR #56's secret-injecting edge proxy for SPAs. Amended 2026-08-03: per-credential exposure contracts (the session token is never script-readable), server-originated me-ops, and SSR session validation at the render layer replacing the `x-nextgen-auth-token` tunnel, with Route Handler bearers requiring an audience-bound `at+JWT`. Amended 2026-10-31: a caller with no `Origin`, or from a console origin the project does not list, is served the project's newest primary deployment; an empty allowlist admits only loopback origins, and nothing falls back to the newest revisions; a deployment freezes its primary origins. | -| [037](037-token-lifecycle.md) | Token lifecycle | Accepted | Evolution of session security | +| [036](036-api-credential-planes.md) | API Credential Planes — Public, App, and Operator | Proposed | Every operation belongs to one credential plane: public (browser; publishable key, origin checks scoped by operation class — credential-establishing ops enforce the allowlist, cookie-principal reads skip it), app (deployment; project secret), operator (CLI/CI; secret, later PATs). Promotes `PreviewSecret` to a publishable key, makes `exchangeHandoff` dual-plane (body-delivered handoffs exchangeable with pk + origin; URL-delivered require PKCE-style proof), and turns dev/prod proxies into credential-free path forwarders — superseding PR #56's secret-injecting edge proxy for SPAs. Amended 2026-08-03: per-credential exposure contracts (the session token is never script-readable), server-originated me-ops, and SSR session validation at the render layer replacing the `x-nextgen-auth-token` tunnel, with Route Handler bearers requiring an audience-bound `at+JWT`. Amended 2026-10-31: a caller with no `Origin`, or from a console origin the project does not list, is served the project's newest primary deployment; an empty allowlist admits only loopback origins, and nothing falls back to the newest revisions; a deployment freezes its primary origins. Amended 2026-11-25: the management API accepts the platform issuer's access tokens for its audience, a session cookie only from a browser on the issuer's origin, and personal access tokens as a bridge with a required expiry, the owner as actor, revocation, and never a client identity. | +| [037](037-token-lifecycle.md) | Token lifecycle | Accepted | Evolution of session security. Amended 2026-11-25: personal access tokens are added as a bridge, on ADR 036's conditions. | | [038](038-user-credential-migration-and-recovery.md) | User Credential Migration and Recovery | Proposed | Transparent password rehash-on-verify via passwap; passkey migration (soft second-passkey nudge, ROR for domain/`rpId` changes) and single-secret TOTP rotation; last-factor deregistration safeguard; email magic-link / one-time code as both a primary auth method and a recovery path, alongside recovery codes. | | [039](039-signing-key-rotation-and-incident-response.md) | Signing Key Rotation and Incident Response | Proposed | Per-project signing keys with `active_from`/`retired_at`, a propagation window and a grace period, auto-rotating every 30 days and retired by supersession rather than by an expiry clock; emergency signing-key and master-key/KEK compromise handling, where master-key-and-database compromise means rotating every secret rather than re-wrapping it. | | [040](040-tenant-login-templates-editable-config.md) | Tenant Login Templates as Editable Config | Implemented (amended by 057) | Login templates become an editable-config resource: immutable per-project branding revisions, release-pinned resolution on flow responses, CLI-authoritative LiquidJS validation with a lexical Go gate, sibling-`.liquid` local dialect. The ejectable page-layout catalog is amended by ADR 057. Amended 2026-09-15: the descriptor references the template as `"liquid_template": { "$file": "./login.liquid" }` instead of `liquid_template_file`. | diff --git a/docs/design/api/events-for-people.md b/docs/design/api/events-for-people.md index 54759686f5..eba0189273 100644 --- a/docs/design/api/events-for-people.md +++ b/docs/design/api/events-for-people.md @@ -55,7 +55,10 @@ Three more findings shape the proposal: - **Some fields are never written**: `client_id`, `fingerprint`, `team_id`, `delegation_id` and `grantor`. `delegation_type` is always `direct`, no event has actor type `agent` or category `signal`. The console offers - Application and Device filters all the same. + Application and Device filters all the same. The + [identity model](identity-model.md) removes `agent` as an actor type: a + client acting as itself is `service`. The contract lists `agent` until the + rename lands. The session row already holds the browser's address and user agent, written when the browser opens the session, and a fingerprint when the client sent @@ -185,6 +188,20 @@ With it: resources ([credentials.md](credentials.md)). The actor index then answers what a key did, with no index on `token_id`. +**LOCKED (2026-11-25): a call made for a user names who acts** +([ADR 033 §3](../../adrs/033-internal-permission-management.md#3-delegation)). +Its events map the delegation onto these fields: + +| Field | Holds | +|-------|-------| +| `actor_id`, `actor_type` | The acting principal: a client or an operator | +| `user_id` | The user acted for | +| `grantor` | Who authorized the delegation | +| `delegation_id` | The delegation the consent, the tokens and the events share | +| `delegation_type` | The kind of delegation | + +A personal access token's actor is its owner, with its owner's kind. + **LOCKED (2026-11-11): until this is built, both events keep the actor they have**, the caller on `session.established` and the user on `auth.token.issued`. Naming the user on both was weighed and dropped: it diff --git a/docs/design/api/identity-model.md b/docs/design/api/identity-model.md index 129dac948c..7ba2ce0152 100644 --- a/docs/design/api/identity-model.md +++ b/docs/design/api/identity-model.md @@ -1,11 +1,29 @@ # Identity Model: Users, Applications and Connections -> **Status:** Draft for discussion. The names are proposals too, except -> Application and Client; see [Names](#names). +> **Status:** The application half, [Applications](#applications) and what +> [Principals](#principals) says of clients, is accepted (2026-11-25) with +> the amendments below. The rest is a draft for discussion, and the names are +> proposals too, except Application and Client; see [Names](#names). > > **Date:** 2026-10-28 > -> **Updated:** 2026-11-09 +> **Updated:** 2026-11-25 +> +> **Amended 2026-11-25:** an agent is an application, and a client can act as +> itself or for a user; there is no separate agent kind, and no impersonation +> ([ADR 033 §3](../../adrs/033-internal-permission-management.md#3-delegation)). +> +> 1. The authorization principal type `agent` becomes `client`. In the event +> `actor_type` and the three `*_by_type` enums, `agent` is removed and +> `service` is the kind of a client acting as itself; a personal access +> token's actor is its owner's kind ([What changes](#what-changes)). +> 2. Every client that is a principal has an owner, a user or a team. When a +> user owner is removed, ownership moves to a team or the client is +> suspended. A client acting for its owner never holds more than its owner. +> 3. An application may be labelled `agent`; the label changes policy and +> audit, not the model. +> 4. An agent that must be a user gets a linked user, one to one, owned by +> the client's owner (open question 6). > > **Builds on:** [#1283](https://github.com/zitadel/nextgen/issues/1283) > (the resource and access model), @@ -44,7 +62,7 @@ call that needed the id the last one returned ([One call](#one-call)). | Noun | Is | Holds | | --- | --- | --- | | **User** | A person who signs in | Properties and sign-in methods, defined by a user schema per kind of person | -| **Application** | Anything that uses Zitadel: a web or mobile application, a backend, a service account, a SaaS product, or an agent calling APIs and MCP servers, Zitadel's own included | Any number of configs: OAuth clients (an OIDC client is one that asks for `openid`), SAML IdP configs, SCIM provisioning configs, and the APIs it serves, MCP servers among them, each with its mappings. A confidential client can be a principal: it acts as itself, or for a user by delegation or impersonation | +| **Application** | Anything that uses Zitadel: a web or mobile application, a backend, a service account, a SaaS product, or an agent calling APIs and MCP servers, Zitadel's own included | Any number of configs: OAuth clients (an OIDC client is one that asks for `openid`), SAML IdP configs, SCIM provisioning configs, and the APIs it serves, MCP servers among them, each with its mappings. A confidential client can be a principal: it acts as itself, or for a user by delegation | | **Connection** | Anything Zitadel trusts upstream: Google, a customer's Entra and the agents it runs, GitHub Actions, a SCIM directory | Any number of configs: OIDC and OAuth RP, OIDC WIF, SAML SP and SCIM provider configs, with the mappings | The two sides mirror each other: @@ -115,8 +133,13 @@ it holds rights the way a user does ([Principals](#principals)): ([RFC 8693](https://www.rfc-editor.org/rfc/rfc8693)). The token's `sub` is the user and its `act` names the client, so every API sees both. A third-party client delegates only for users who consented. -- **Impersonate**: the same, without `act`, so APIs see only the user. It is - the narrower right. + +There is no impersonating right: Zitadel issues no token for a user that +hides who acts. + +**A principal client has an owner**, a user or a team. When a user owner is +removed, ownership moves to a team or the client is suspended. A client +acting for its owner never holds more than its owner. A principal client can also carry attributes, such as a warehouse ID, validated by a schema the developer ships and mapped to claims the way user @@ -171,8 +194,13 @@ depends on whom it works for, whose API it calls, and who vouches for it: Agents delegate: a delegated token names the agent in `act`, so an API can set limits for agents, and Zitadel can refuse what only a person may do, -such as claiming a project. Who may impersonate is the customer's call, for -its staff or its tools. +such as claiming a project. A support or admin act-as is a delegation the +user did not grant, named and recorded the same way. + +There is no agent kind. An application may be labelled `agent`; the label +changes policy and audit, not the model. An agent that must be a user, for +APIs that accept only user tokens, gets a linked user, one to one, owned by +the client's owner. ### Connections @@ -221,22 +249,30 @@ the project itself through its secret. A public client never is one. client gives it its rights. Grants to users and to teams are data, written through the API. -**Delegate and impersonate are roles like any other.** Users and clients hold -them, directly or through a team, over one user, a schema's users or a team's -users, as v4's `ORG_END_USER_IMPERSONATOR` was. What they need on top: +**Delegate is a role like any other.** Users and clients hold it, directly or +through a team, over one user, a schema's users or a team's users. An +operator's act-as is a delegation the user did not grant, never a token +without `act`. What act-as needs on top: -- a switch on the project or the application before impersonation can be - granted at all, as v4's security setting was; -- an audit of every exchange, naming the holder, the user acted for and the - path the right came from: directly, or through which team; -- the effective holders in the console, so "who can impersonate Acme's - users" lists those who hold it through a team too. +- a switch before act-as can be granted at all, as v4's impersonation + setting was ([open question 2](#open-questions)); +- an audit of every exchange and act-as, naming the holder, the user acted + for and the path the right came from: directly, or through which team; +- the effective holders in the console, so "who can act as Acme's users" + lists those who hold it through a team too. **Personal access tokens belong to a principal**, never to the person who minted one. A tool that takes nothing but a static bearer token, such as a Grafana data source, a CI plugin or a webhook sender, then needs no person's token, which breaks when that person leaves. +**Amended 2026-11-25:** personal access tokens come as a bridge, on four +conditions +([ADR 036](../../adrs/036-api-credential-planes.md#amendment-2026-11-25-the-management-api-accepts-platform-bearers)): +a required expiry, the token's owner as the event's actor, revocation, and +never a client's identity. Where this document gives a client PATs, those +conditions win. + - A PAT acts with its owner's rights and ends with its owner. - Whoever may manage the owner manages its PATs: creates, lists, rotates and revokes them. The creator is kept for audit only. @@ -518,7 +554,7 @@ metadata, verifies the domain, checks the mapping and runs a test sign-in. | **Connection** | Anything Zitadel trusts upstream, with its configs and mappings | "IdP", "provider", v4's identity providers | Auth0's and WorkOS's word. "Provider" already names Zitadel itself, the OIDC provider, and the server side of SCIM | | **WIF config** | A connection's trust in the tokens workloads get from CI systems, clusters and clouds | keys and secrets stored in CI | The clouds' name: workload identity federation | | **Mapping** | How claims, attributes and SCIM translate to and from user properties, and which client a workload becomes | the IdP connection's `claim_mapping`, v4's actions for mapping | Says what it does | -| **Delegate**, **impersonate** | Roles to act for a user, with `act` or without, which users and clients hold | v4's impersonation setting | RFC 8693's words | +| **Delegate** | The role to act for a user, named in `act`, which users and clients hold | v4's impersonation setting | RFC 8693's word | ## What changes @@ -527,7 +563,7 @@ Measured against what the repo has today: | Area | Today | With this model | | --- | --- | --- | | Glossary | `app` is one OIDC client or SAML SP; `app_group` (LOCKED) holds roles; `idp` is an upstream provider | `application` replaces `app`: the software, which holds its configs; one OIDC client is a client; `idp` becomes connection | -| Authz | Principal types `user`, `team`, `agent`, `sk_proj`, `sk_team`; `agent` is unused; team members are users; scopes cap only project secrets; only `project_admin` writes connections | A `client` principal type, which `agent` becomes, with grants and team memberships like a user's; delegate and impersonate as roles; `sk_proj` and `sk_team` become PATs with an owner type; a client's scopes cap every token; `team_admin` manages its team's connections and applications | +| Authz | Principal types `user`, `team`, `agent`, `sk_proj`, `sk_team`; `agent` is unused; team members are users; scopes cap only project secrets; only `project_admin` writes connections | A `client` principal type, which `agent` becomes, with grants and team memberships like a user's, and an owner; the event `actor_type` and the `*_by_type` enums drop `agent`, `service` is a client acting as itself, and a PAT's actor has its owner's kind (the contract still lists `agent` until the rename lands); delegate as a role, and act-as as a delegation; `sk_proj` and `sk_team` become PATs with an owner type; a client's scopes cap every token; `team_admin` manages its team's connections and applications | | #2430 | Machines are users of a `service` or `agent` kind; a client is owned by an app, an identity or both; client methods sit in `x-auth-methods` | Machines are applications; every client belongs to an application (a self-registered one from its first request) and can be a principal itself; client methods move to the client, and `x-auth-methods` keeps sign-in methods. Its secret format, hashing, import rules and named credentials per client carry over, and its PATs gain an owner type; its client table loses the identity column | | IdP connections | Project-level, OIDC only, one `protocol` block per connection | A connection holds several configs (OIDC, OAuth, WIF, SAML, SCIM) and the mappings between them; the developer's are declared, and a B2B customer's belongs to its team and is written through the API within the developer's rules | | CLI | No application or OAuth command | `application create` writes an application with its clients and APIs from a preset, generates each new client's id, and turns the issuer on if it is off; `settings oauth enable` stays for turning the issuer on alone ([ADR 082 §12](../../adrs/082-oauth-and-oidc-server.md#12-what-a-developer-touches)) | @@ -536,17 +572,18 @@ Measured against what the repo has today: Clients are a field of their application's document; a client that registers itself is a record of its own, so a declared application and the clients that reference it keep separate writers. -Tokens stay single-audience, and consents stay per user, client and scope. +Tokens stay single-audience, and a consent is one record per user, client +and API, holding a set of scopes +([ADR 082 §8](../../adrs/082-oauth-and-oidc-server.md#8-consent)). ## Open questions 1. **Names.** Connection or Provider; what to call the configs, and a PAT that a client or a team owns. App or Application is settled as Application ([#2785](https://github.com/zitadel/nextgen/issues/2785)). -2. **Delegation and impersonation policy.** Whether the switch that allows - impersonation sits on the project or the application, when a user's - consent is needed, and which actions besides claiming a project only a - person may take. +2. **Act-as policy.** Whether the switch that allows an operator's act-as + sits on the project or the application, and which actions besides + claiming a project only a person may take. 3. **Self-service rules.** Where they live: on the user schema, which already says how a kind of person signs in; as an operation policy on a team's connection writes, a template Zitadel defines and the release fills in @@ -562,7 +599,9 @@ Tokens stay single-audience, and consents stay per user, client and scope. verified domain. 6. **Agents that must be users.** APIs that accept only user tokens, and Entra's agent paired one to one with a user account, which a connection - could map to a user. + could map to a user. Answered 2026-11-25: such an agent gets a linked + user, one to one, owned by the client's owner + ([Applications](#applications)). ## Prior art diff --git a/docs/design/glossary.md b/docs/design/glossary.md index 92bbceb789..4413a77e0c 100644 --- a/docs/design/glossary.md +++ b/docs/design/glossary.md @@ -65,7 +65,8 @@ Core nouns used across the API. Full endpoint map in [`api/resource-map.md`](api |---|---| | **project** | See §1. Top-level tenant. | | **team** | See §1. Tenant-grouping inside a project. | -| **app** | An OIDC client / SAML SP registered to consume Zitadel; lives in a project. | +| **application** | Anything that uses Zitadel, agents included: the software, which holds its clients, SAML and SCIM configs and the APIs it serves; lives in a project. Replaces *app*. See the [identity model](api/identity-model.md#applications). | +| **client** | A technical integration of an application: its credentials and at most one OAuth config. A confidential client can be a principal, acting as itself or for a user. | | **app_group** | A bundle of related apps that share a role/grant container. **LOCKED rename** from today's "project" (the authz container — not the tenant). | | **idp** | External identity provider the project federates **to**. Zitadel acts as OIDC/SAML client downstream. | | **user** | See §1. Identity inside a project. | @@ -96,10 +97,10 @@ How a permission check is framed and resolved. Long-form in [ADR 032](../adrs/03 | Term | Meaning | |---|---| -| **principal** | Whatever presents a credential to be checked in a permission decision: a user token, an agent, a service token (`sk_proj_…`, `sk_team_…`), or an origin-bound browser nonce. | +| **principal** | Whatever presents a credential to be checked in a permission decision: a user token, a client (an agent acts through its application's client), a service token (`sk_proj_…`, `sk_team_…`), or an origin-bound browser nonce. | | **scope** | The resolved project/team/resource boundary a permission check runs against, produced by `resource_scope_index` before authorization runs. | | **`resource_scope_index`** | A global lookup table mapping a globally-addressable resource id to its project/team scope, consulted by middleware before authorization runs. See [`api/url-architecture.md`](api/url-architecture.md). | -| **delegation** | An explicit, audited transfer of authority from one principal to another (e.g. a person to an agent), distinct from an agent silently inheriting everything its grantor could do. | +| **delegation** | Authority to act for a user: the user's consent to a client, a token exchange, or an operator's act-as that the user did not grant. It has one `delegation_id` that the consent, the tokens and every event share, and no token hides who acts. Distinct from silently inheriting everything the user could do; there is no impersonation. See [ADR 033 §3](../adrs/033-internal-permission-management.md#3-delegation). | --- From 3e906e748786df8025d8a420c5177fd4c04f7c46 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 25 Nov 2026 16:25:28 -0800 Subject: [PATCH 2/3] docs: state the rule that a token names who acts in ADR 082 and list what ADR 034 leaves open --- .../033-internal-permission-management.md | 34 ++++++-------- .../034-external-permission-management.md | 17 +++++++ docs/adrs/082-oauth-and-oidc-server.md | 46 ++++++++++++++----- docs/adrs/README.md | 6 +-- docs/design/api/events-for-people.md | 3 +- docs/design/api/identity-model.md | 2 +- docs/design/glossary.md | 2 +- 7 files changed, 74 insertions(+), 36 deletions(-) diff --git a/docs/adrs/033-internal-permission-management.md b/docs/adrs/033-internal-permission-management.md index 9214390af0..b67d1e2297 100644 --- a/docs/adrs/033-internal-permission-management.md +++ b/docs/adrs/033-internal-permission-management.md @@ -4,12 +4,14 @@ > **Date:** 2026-07-09 > **Context:** Authorization for Zitadel-owned internal resources (projects, teams, users, apps, flows, policies) and agent delegation. Builds on [ADR 032](032-permission-catalogs.md). > -> **Amended 2026-11-25** (§3, §5): every call made for a user names who acts, -> and no token hides its actor. A delegation is a user's consent to a client, -> a token exchange, or an operator's act-as that the user did not grant, with -> one `delegation_id` that the consent, the tokens and every event share. -> Consent is its own record, not an assignment. There is no impersonation. An -> agent is an application, and its client is the principal. +> **Amended 2026-11-25** (§3, §5): how the management API resolves and records +> a call made for a user. The rule for the tokens themselves, that each names +> who acts and none hides its actor, is +> [ADR 082 §7](082-oauth-and-oidc-server.md#7-tokens)'s and holds for every +> project. Here: consent is its own record, not an assignment; an acting +> principal never gets a copy of the user's permissions; a delegated event +> records the actor, the user, the grantor and the `delegation_id`. An agent +> is an application, and its client is the principal. ## Introduction @@ -150,15 +152,13 @@ storage/residency invariant, not bypass it. ### 3. Delegation -**Amended 2026-11-25.** Every call made for a user names who acts: a token -issued for a user on behalf of another principal carries `act`, and Zitadel -issues no token that hides its actor. A delegation is a user's consent to a -client, a token exchange, or an operator's act-as that the user did not -grant. It has one `delegation_id`, which the consent record, the tokens and -every event share. - -There is no impersonation. A support or admin act-as is a delegation the user -did not grant, named and recorded as one. +**Amended 2026-11-25.** What a delegation is, and what a token issued under +one carries, is decided once for every project in +[ADR 082 §7](082-oauth-and-oidc-server.md#7-tokens): the token names who acts +in `act`, the delegation has one `delegation_id`, and there is no +impersonation. This section says what the management API does with such a +call. What a customer's API does with one is +[ADR 034](034-external-permission-management.md#open-questions)'s. Consent is a record of its own per user, client and protected API, holding a set of scopes ([ADR 082 §8](082-oauth-and-oidc-server.md#8-consent)). It is @@ -169,10 +169,6 @@ grants on Zitadel's own API; those are stored with an explicit grantor, expiry/revocation state, and scope (the general storage shape from [ADR 032 §3](032-permission-catalogs.md#3-canonical-relational-storage)). -Whether a first-hop token, which a client obtains itself with the -authorization code grant, carries `act` beside `client_id` is -[ADR 082's open question 7](082-oauth-and-oidc-server.md#open-questions). - An acting principal never receives permissions by copying all permissions from the user it acts for. The resolver must be able to explain which delegation authorized or denied an action, so that both audit review and the diff --git a/docs/adrs/034-external-permission-management.md b/docs/adrs/034-external-permission-management.md index 411fad932d..4f3e99f621 100644 --- a/docs/adrs/034-external-permission-management.md +++ b/docs/adrs/034-external-permission-management.md @@ -125,3 +125,20 @@ they apply to both catalogs, not just this one. external permissions. 2. Design relational migrations for app-group catalog tables and app grants. + +## Open questions + +Added 2026-11-25. This ADR binds users and teams to apps and predates the +rule that a token issued for a user names who acts +([ADR 082 §7](082-oauth-and-oidc-server.md#7-tokens)). It does not yet say +what that rule means for a customer's app: + +1. Whether a client can hold an app grant, so that an agent acting as itself + gets permission claims, or app grants stay for users and teams. +2. Which permission claims a token carries when a client acts for a user: the + user's app grants as they are, or those grants narrowed by the scopes the + user consented to + ([ADR 082 §8](082-oauth-and-oidc-server.md#8-consent)). On Zitadel's own + API an acting principal never gets a copy of the user's permissions + ([ADR 033 §3](033-internal-permission-management.md#3-delegation)); + whether a customer's app gets the same guarantee is not decided. diff --git a/docs/adrs/082-oauth-and-oidc-server.md b/docs/adrs/082-oauth-and-oidc-server.md index 1c294ef0f4..7fe566a690 100644 --- a/docs/adrs/082-oauth-and-oidc-server.md +++ b/docs/adrs/082-oauth-and-oidc-server.md @@ -49,11 +49,12 @@ > served its request, so a declared client authenticates against that > deployment's variable (zitadel/nextgen#2796). > -> **Amended 2026-11-25** (§8, §11, open question 7): a consent is a -> delegation ([ADR 033 §3](033-internal-permission-management.md#3-delegation)): -> one record per user, client and API, holding a set of scopes, with a -> `delegation_id` that its tokens and their events share. Token exchange is -> delegation, never impersonation: the token names who acts in `act`. +> **Amended 2026-11-25** (§7, §8, §11, open questions 7 and 8): every call +> made for a user names who acts, in every project's tokens: a token issued +> for a user on behalf of another principal carries `act`, and no token hides +> its actor (§7). A consent is a delegation: one record per user, client and +> API, holding a set of scopes, with a `delegation_id` that its tokens and +> their events share. Token exchange is delegation, never impersonation. ## TL;DR @@ -414,14 +415,35 @@ to revoke the tokens issued for a code that is used twice, when possible. ADR 037 stores nothing for access tokens, so there is nothing to revoke until refresh tokens ship. +#### A token issued for a user names who acts + +**Amended 2026-11-25.** Every call made for a user names who acts: a token +issued for a user on behalf of another principal carries `act`, and Zitadel +issues no token that hides its actor. This holds for every project's tokens, +a customer's and the platform project's alike. + +A delegation is a user's consent to a client (§8), a token exchange (§11), or +an operator's act-as that the user did not grant. It has one `delegation_id`, +which the consent record, the tokens and every event share. + +There is no impersonation. A support or admin act-as is a delegation the user +did not grant, named and recorded as one. + +What an API does with such a token is its own. The management API resolves +and records it as +[ADR 033 §3](033-internal-permission-management.md#3-delegation) and +[§5](033-internal-permission-management.md#5-audit-trail-and-grant-provenance) +say. A customer's API reads it from the token; which permission claims that +token holds is open in +[ADR 034](034-external-permission-management.md#open-questions). + ### 8. Consent A consent records that a user let a client use some scopes. It is kept per user, client and API, as one record holding a set of scopes, and is called a consent because ADR 032 uses *grant* for permissions. A consent is a -delegation ([ADR 033 §3](033-internal-permission-management.md#3-delegation)): -it carries a `delegation_id`, which the tokens issued under it and their -events share. The flow engine inserts the consent step (ADR 081 §11) when +delegation (§7): it carries a `delegation_id`, which the tokens issued under +it and their events share. The flow engine inserts the consent step (ADR 081 §11) when a third-party client asks for scopes the user has not consented to, and whenever a request says `prompt=consent`, and on every request for an application whose document says so (§3). The scope descriptions on the @@ -484,7 +506,7 @@ enterprise-managed authorization builds on token exchange and comes with it federation ride on it, and MCP's enterprise-managed authorization with them (§10). Token exchange is delegation, never impersonation: a token it issues for a user names the acting client in `act`, and Zitadel issues none that - hides its actor ([ADR 033 §3](033-internal-permission-management.md#3-delegation)). + hides its actor (§7). - Device authorization (RFC 8628) for CLIs and TVs. - Back-channel logout for third-party clients (first-party ones share the session, ADR 081 §12). @@ -612,8 +634,10 @@ protocol spans the server, the SDK proxy and the widget. 7. Whether a first-hop token, which a client obtains itself with the authorization code grant, carries `act` in addition to `client_id`, or `act` appears only when a different principal presents the user, through - token exchange or an operator's act-as - ([ADR 033 §3](033-internal-permission-management.md#3-delegation)). + token exchange or an operator's act-as (§7). +8. Whether an access token carries the `delegation_id` as a claim, and under + which name, so that an API outside Zitadel can record the delegation a + call was made under, or only Zitadel's own records hold it (§7). ## Rejected alternatives diff --git a/docs/adrs/README.md b/docs/adrs/README.md index 1abc2d3d1b..81eaf15cc1 100644 --- a/docs/adrs/README.md +++ b/docs/adrs/README.md @@ -38,8 +38,8 @@ This directory contains architecture decision records (ADRs) for nextgen. | [030](030-error-model-mapping-and-reporting.md) | Error Model, Mapping, and Reporting | Accepted (amended) | Adopt `domain.Error` as canonical (add `Unwrap`, drop `Parent`→`Details`); `database.*Error` stays storage-local; shared `internal/errreport` leaf with global atomics captures location everywhere and gated deepest-first stacks; per-layer types glued via `sloggcp` interfaces; storage→domain→API mapping plus redaction policy; logging is one request line plus one error line per failing request (amended 2026-10-23). | | [031](031-openapi-querying.md) | OpenAPI querying | Accepted (amended) | Flexible query language for list endpoints: `POST //query` with `limit`, `page_token`, `sorting` and `filter`; adopt `QUERY` once OpenAPI/Ogen support it. Amended 2026-10-24 to the shipped operator set and GET policy. | | [032](032-permission-catalogs.md) | Permission Catalogs — A Portable Relational FGA Core | Accepted | One permission engine, two catalogs (system and app-group) over a shared OpenFGA parser/profile/compiler pipeline and portable relational storage/resolver core for internal and external authorization; companion to ADR 033 and ADR 034. | -| [033](033-internal-permission-management.md) | Internal Permission Management (System Catalog) | Proposed | System-catalog authorization for Zitadel-owned resources: `resource_scope_index`, list-endpoint predicate injection, 403/404 denial semantics, and audited agent delegation. Staff/support and cross-project access are out of scope, tracked by issue #333. Companion to ADR 032 and ADR 034. Amended 2026-11-25: a delegation (a user's consent, a token exchange, or an operator's act-as the user did not grant) has one `delegation_id` that consent, tokens and events share; a token issued for a user on behalf of another principal carries `act`; consent is its own record, not an assignment; no impersonation. | -| [034](034-external-permission-management.md) | External Permission Management (App-Group Catalog) | Proposed | App-group catalog for customer-owned apps/APIs — customer-authored policies, app grants, and token claims — built on the shared OpenFGA parser/profile/compiler pipeline defined in ADR 032. Companion to ADR 032 and ADR 033. | +| [033](033-internal-permission-management.md) | Internal Permission Management (System Catalog) | Proposed | System-catalog authorization for Zitadel-owned resources: `resource_scope_index`, list-endpoint predicate injection, 403/404 denial semantics, and audited agent delegation. Staff/support and cross-project access are out of scope, tracked by issue #333. Companion to ADR 032 and ADR 034. Amended 2026-11-25: how the management API resolves and records a call made for a user under ADR 082 §7's rule: consent is its own record, not an assignment; an acting principal never gets a copy of the user's permissions; a delegated event records the actor, the user, the grantor and the `delegation_id`. | +| [034](034-external-permission-management.md) | External Permission Management (App-Group Catalog) | Proposed | App-group catalog for customer-owned apps/APIs — customer-authored policies, app grants, and token claims — built on the shared OpenFGA parser/profile/compiler pipeline defined in ADR 032. Companion to ADR 032 and ADR 033. Open since 2026-11-25: whether a client can hold an app grant, and which permission claims a token carries when a client acts for a user. | | [035](035-configuration-environments.md) | Environment Releases for Configuration Resources | Accepted | Configuration bundled as immutable **releases** pinning specific revisions of each resource; **environments** are runtime slots that run one release at a time; **deployments** are immutable records linking releases to environments. Supersedes ADR 007's `plan`/`apply` orchestration in favor of atomic release construction plus a separate deploy step. Amended by ADR 063: a pointer pins a `revision_id`, not a per-revision resource id. | | [036](036-api-credential-planes.md) | API Credential Planes — Public, App, and Operator | Proposed | Every operation belongs to one credential plane: public (browser; publishable key, origin checks scoped by operation class — credential-establishing ops enforce the allowlist, cookie-principal reads skip it), app (deployment; project secret), operator (CLI/CI; secret, later PATs). Promotes `PreviewSecret` to a publishable key, makes `exchangeHandoff` dual-plane (body-delivered handoffs exchangeable with pk + origin; URL-delivered require PKCE-style proof), and turns dev/prod proxies into credential-free path forwarders — superseding PR #56's secret-injecting edge proxy for SPAs. Amended 2026-08-03: per-credential exposure contracts (the session token is never script-readable), server-originated me-ops, and SSR session validation at the render layer replacing the `x-nextgen-auth-token` tunnel, with Route Handler bearers requiring an audience-bound `at+JWT`. Amended 2026-10-31: a caller with no `Origin`, or from a console origin the project does not list, is served the project's newest primary deployment; an empty allowlist admits only loopback origins, and nothing falls back to the newest revisions; a deployment freezes its primary origins. Amended 2026-11-25: the management API accepts the platform issuer's access tokens for its audience, a session cookie only from a browser on the issuer's origin, and personal access tokens as a bridge with a required expiry, the owner as actor, revocation, and never a client identity. | | [037](037-token-lifecycle.md) | Token lifecycle | Accepted | Evolution of session security. Amended 2026-11-25: personal access tokens are added as a bridge, on ADR 036's conditions. | @@ -87,7 +87,7 @@ This directory contains architecture decision records (ADRs) for nextgen. | [079](079-release-confidence.md) | Release Confidence — One Owner per Property, a Suite per Service, Three Gates | Proposed | Every property of a change has one owner, from the Go suites for authorization and the console's route specs, a new console browser project and the console lanes, to one deployment suite per cloud service (server, console, docs, website, schemas). A merge waits on `full-pr`; the production domains wait on every service's `(Production)` status, made blocking; the preview checks, what runs signed in on previews and visual review only report. Two probes: `/livez` checks nothing behind the process, `/readyz` checks the database and answers `503` without it, and `/healthz` is removed. The storybook leaves the deployment and stays the team's workbench and the atoms' CI gate; customers see the login's components as live examples in the docs. Open, with options: how a suite signs in on a deployment (recommended: a fresh project, sign-up and claim per run, so no stored credential), where the console's accessibility checks run (recommended: Vitest in Chromium over MSW, where any axe violation fails) and the screenshot tool. Watching production between deployments is deferred. | | [080](080-incoming-trace-context.md) | Incoming Trace Context Is Ignored Unless `trust_remote_spans` Is On | Proposed | Outcome of #1390: an incoming `traceparent`/`tracestate`/`baggage` is ignored by default and every request starts a new trace. With `instrumentation.trace.trust_remote_spans` on, the caller's context is extracted ahead of the server span so it joins the caller's trace; the caller's sampled flag is trusted too, so the setting is for ZITADEL behind a trusted proxy or mesh. | | [081](081-customer-hosted-login-and-oidc-provider.md) | The Login Lives in the Customer's App and Becomes Its OIDC Provider | Proposed | The customer's app hosts the login at every integration level; Zitadel stays a backend API, and a prebuilt Zitadel login is rejected in favor of a login-only setup mode and a compose example. Links sent outside a browser request open a per-project link target. Later, once the project turns it on in its release, the scaffolded login becomes the sign-in page of an authorization server whose issuer is the app's primary or loopback origin, never a preview: the scaffold reserves only `/.well-known/openid-configuration` and `/.well-known/oauth-authorization-server` (404 until OIDC ships); browser endpoints live under `/__nextgen`, the back channel on the server's origin. Every response that leaves the app goes through the login page; codes carry their flow's deployment, and refreshes move to the newest without widening. Consent, account choice and a relying-party mode follow in package releases; generated code gets no credential, protocol or CSRF logic. Removes one of ADR 077's reasons. Amended 2026-10-31: no project default target. | -| [082](082-oauth-and-oidc-server.md) | Zitadel as an OAuth 2.1 and OpenID Connect Server | Accepted (amended) | The server runs the protocol, the server SDK is its front door in the customer's application, `` renders sign-in, account choice and consent, and config decides what tokens contain. OAuth 2.1 with OpenID Connect: the code flow for every client, with PKCE required for public clients and optional for confidential ones, client credentials, rotating refresh tokens; no implicit or hybrid flow or password grant, and introspection per API comes later. An Application is one document whether a file in the release (`.zitadel/applications/.json`) or `POST /applications` writes it, as an IdP connection is: the developer's own applications are declared, a customer's and dynamically registered clients are data. An application holds its clients and the APIs it serves, and each access token names one API through `resource`. Claims come from the user schema's `x-claim`, rules and a signed hook per API in the customer's backend, never the browser. The first release serves a confidential web application through an OAuth server; OpenID Connect follows, then public clients, protected APIs and MCP, whose open registration is off by default and needs a login-only issuer. Every developer decision has a file, a command and an SDK call. | +| [082](082-oauth-and-oidc-server.md) | Zitadel as an OAuth 2.1 and OpenID Connect Server | Accepted (amended) | The server runs the protocol, the server SDK is its front door in the customer's application, `` renders sign-in, account choice and consent, and config decides what tokens contain. OAuth 2.1 with OpenID Connect: the code flow for every client, with PKCE required for public clients and optional for confidential ones, client credentials, rotating refresh tokens; no implicit or hybrid flow or password grant, and introspection per API comes later. An Application is one document whether a file in the release (`.zitadel/applications/.json`) or `POST /applications` writes it, as an IdP connection is: the developer's own applications are declared, a customer's and dynamically registered clients are data. An application holds its clients and the APIs it serves, and each access token names one API through `resource`. Claims come from the user schema's `x-claim`, rules and a signed hook per API in the customer's backend, never the browser. The first release serves a confidential web application through an OAuth server; OpenID Connect follows, then public clients, protected APIs and MCP, whose open registration is off by default and needs a login-only issuer. Every developer decision has a file, a command and an SDK call. Amended 2026-11-25: in every project, a token issued for a user on behalf of another principal carries `act` and no token hides its actor; a delegation (a user's consent, a token exchange, or an operator's act-as the user did not grant) has one `delegation_id` that consent, tokens and events share; no impersonation. | | [083](083-session-cookie-host-prefix.md) | Rename the Session Cookies and Use `__Host-` on https | Accepted | Rename the server cookie to `__Host-zitadel_session` wherever it is `Secure`, and to `zitadel_session` on loopback http for Safari; SDKs and dev proxies add the project suffix. The preview is unpublished, so all readers and writers change together: no legacy-cookie authentication or migration, dual writes, compatibility window, adoption counter, or later removal release. Existing development sessions require sign-in again. SDKs send one canonical upstream cookie and preserve project isolation under both schemes. | | [084](084-hosted-cloud-business-systems.md) | The Hosted Cloud's Business Systems Run Beside the Server | Proposed | What exists because we sell Zitadel runs beside the server: screens in the console's add-on, a Next.js service `apps/cloud-functions` under `/cloud/` (RPC for the add-on on the console's session, BotID's check in front of the sign-in widget's flow writes, Stripe webhooks, Workflow SDK workflows on Vercel Queues), and Stripe and HubSpot as systems of record keyed by Zitadel's ids. Sign-up stays the platform project's `register` flow; provisioning (HubSpot contact and company, a Stripe customer per team) runs as a workflow, triggered by the add-on today and by the platform project's `GET /events` once it is a normal project. Usage is pulled hourly as counts (MAU as first activity of the month) into `sum` meters, never pushed per event. The server gains only generic features: the platform project as a project, email, usage aggregates with an operator credential, quotas, team roles. Scaffolded on mocks; amends ADR 078 §5 and Console ADR 0006. | | [085](085-which-release-serves-a-request.md) | Which Release Serves a Request | Accepted | A request is served exactly one release or refused: its `Origin` passes the project's origin check (a console origin that would not pass on its own may only open a flow), and it gets the release of that origin's newest deployment, or with no `Origin` of the project's newest primary deployment; nothing deployed answers `409 rel.not_deployed` or `rel.no_default`, a revoked release `409 rel.revoked`. A flow keeps the release it opened with. Every runtime read is a revision the release pins, with no fallback to the newest stored revision. So every project has a release: `setup` deploys, `zitadel deploy` and the console deploy to `primary`, and bootstrap deploys the platform project at each start, unless a newer server already has. Amended 2026-11-05: `setUserPassword` resolves its release from `Origin` as the flow does, so a preview URL gets its preview's policy; only `createAuthAttempt` keeps to the newest primary deployment. | diff --git a/docs/design/api/events-for-people.md b/docs/design/api/events-for-people.md index eba0189273..871360893a 100644 --- a/docs/design/api/events-for-people.md +++ b/docs/design/api/events-for-people.md @@ -189,7 +189,8 @@ With it: what a key did, with no index on `token_id`. **LOCKED (2026-11-25): a call made for a user names who acts** -([ADR 033 §3](../../adrs/033-internal-permission-management.md#3-delegation)). +([ADR 082 §7](../../adrs/082-oauth-and-oidc-server.md#7-tokens); +[ADR 033 §5](../../adrs/033-internal-permission-management.md#5-audit-trail-and-grant-provenance)). Its events map the delegation onto these fields: | Field | Holds | diff --git a/docs/design/api/identity-model.md b/docs/design/api/identity-model.md index 7ba2ce0152..2020e3f294 100644 --- a/docs/design/api/identity-model.md +++ b/docs/design/api/identity-model.md @@ -11,7 +11,7 @@ > > **Amended 2026-11-25:** an agent is an application, and a client can act as > itself or for a user; there is no separate agent kind, and no impersonation -> ([ADR 033 §3](../../adrs/033-internal-permission-management.md#3-delegation)). +> ([ADR 082 §7](../../adrs/082-oauth-and-oidc-server.md#7-tokens)). > > 1. The authorization principal type `agent` becomes `client`. In the event > `actor_type` and the three `*_by_type` enums, `agent` is removed and diff --git a/docs/design/glossary.md b/docs/design/glossary.md index 4413a77e0c..858c0ef974 100644 --- a/docs/design/glossary.md +++ b/docs/design/glossary.md @@ -100,7 +100,7 @@ How a permission check is framed and resolved. Long-form in [ADR 032](../adrs/03 | **principal** | Whatever presents a credential to be checked in a permission decision: a user token, a client (an agent acts through its application's client), a service token (`sk_proj_…`, `sk_team_…`), or an origin-bound browser nonce. | | **scope** | The resolved project/team/resource boundary a permission check runs against, produced by `resource_scope_index` before authorization runs. | | **`resource_scope_index`** | A global lookup table mapping a globally-addressable resource id to its project/team scope, consulted by middleware before authorization runs. See [`api/url-architecture.md`](api/url-architecture.md). | -| **delegation** | Authority to act for a user: the user's consent to a client, a token exchange, or an operator's act-as that the user did not grant. It has one `delegation_id` that the consent, the tokens and every event share, and no token hides who acts. Distinct from silently inheriting everything the user could do; there is no impersonation. See [ADR 033 §3](../adrs/033-internal-permission-management.md#3-delegation). | +| **delegation** | Authority to act for a user: the user's consent to a client, a token exchange, or an operator's act-as that the user did not grant. It has one `delegation_id` that the consent, the tokens and every event share, and no token hides who acts. Distinct from silently inheriting everything the user could do; there is no impersonation. See [ADR 082 §7](../adrs/082-oauth-and-oidc-server.md#7-tokens) for the rule, and [ADR 033 §3](../adrs/033-internal-permission-management.md#3-delegation) for what the management API does with a delegated call. | --- From 59257a7a7bdb6d9697728266fc10a59df53d2e05 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 30 Nov 2026 13:20:59 -0800 Subject: [PATCH 3/3] test(docs): raise the llms-full.txt size cap to 750,000 characters Main's docs now make llms-full.txt 650,605 characters on a preview host, over the 650,000 cap, so every PR's docs deployment check fails. Operations leaking back in would still multiply the size about twentyfold. --- apps/docs/tests/pages.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/tests/pages.spec.ts b/apps/docs/tests/pages.spec.ts index 3e6863da81..3231c2d135 100644 --- a/apps/docs/tests/pages.spec.ts +++ b/apps/docs/tests/pages.spec.ts @@ -384,7 +384,7 @@ test("llms-full.txt carries every page but the API operations", async ({ request operations.filter((page) => full.includes(`(${origin}${page.url})`)).map((page) => page.url), "API operations in llms-full.txt", ).toEqual([]); - expect(full.length).toBeLessThan(650_000); + expect(full.length).toBeLessThan(750_000); }); test("scripts and styles load from /docs/_next/", async ({ request }) => {