ADR-049: Identity Plane Split — canopy-identity Issues Every Internal Token; the IdP Only Signs Workers In
Status: Accepted (2026-09-30); effective 2026-10-12, with the switch (Amendment 25); amended by Amendment 1 (2026-09-30, #2498), Amendment 2 (2026-10-01, #2516), Amendment 3 (2026-10-02, #2549), Amendment 4 (2026-10-04, #2641), Amendment 5 (2026-10-05, #2692), Amendment 6 (2026-10-05, #2712), Amendment 7 (2026-10-05, #2720), Amendment 8 (2026-10-06, #2729), Amendment 9 (2026-10-06, #2740), Amendment 10 (2026-10-07, #2752), Amendment 11 (2026-10-07, #2761), Amendment 12 (2026-10-08, #2777), Amendment 13 (2026-10-08, #2786), Amendment 14 (2026-10-09, #2792), Amendment 15 (2026-10-09, #2800), Amendment 16 (2026-10-09, #2806), Amendment 17 (2026-10-09, #2813), Amendment 18 (2026-10-09, #2819), Amendment 19 (2026-10-10, #2824), Amendment 20 (2026-10-10, #2829), Amendment 21 (2026-10-10, #2833), Amendment 22 (2026-10-11, #2840), Amendment 23 (2026-10-11, #2847), Amendment 24 (2026-10-11, #2855), Amendment 25 (2026-10-11, #2864) and Amendment 26 (2026-10-13, #2891)
Issue: #2485
Ruling: the maintainer, 2026-09-29/30. The rulings:
-
split the identity plane;
-
host the issuer in canopy-security;
-
synchronous calls act as the user, per hop;
-
background work uses purpose-scoped system tokens, and the broad service token goes;
-
keys are per-replica ES256 keys generated in memory;
-
no KMS or HSM unless a jurisdiction mandates one;
-
RFC 8628 device flow for native clients;
-
canopy mints its own subjects;
-
the IdP profile is deployment configuration;
-
no backward compatibility and no timing constraint.
Amends: see ADR classification.
Relates to:
Context
ADR-048 makes the external identity provider the one issuer for everything:
-
worker sign-in and refresh at canopy-web;
-
both RFC 8693 exchange hops of every worker write;
-
every service’s receivers;
-
every service token, since each service mints its own bearer by
client_credentials(ADR-019).
Its §5 exchange topology is Keycloak’s standard token exchange:
-
hop 1 mints a token for two audiences,
canopy-eligibilityandcanopy-eligibility-exchanger; -
hop 2 mints a token for an audience that the input token lacks.
The maintainer’s goal is Kanidm as canopy’s default human IdP, with ZITADEL and Keycloak as first-class, tested alternatives. Read against each product’s source and documentation on 2026-09-29, that goal cannot be met while the IdP is the internal issuer.
-
Kanidm 1.11.2 cannot be the internal issuer. Source:
server/lib/src/idm/oauth2.rsat https://github.com/kanidm/kanidm/blob/v1.11.2/server/lib/src/idm/oauth2.rs.-
Every OAuth2 client has its own issuer and signing key (lines 976-980).
-
RFC 8693 exchange accepts only a service-account subject, and its audience must equal the caller (lines 1747-1850).
-
Access tokens carry only standard claims; claim maps reach only the id_token and userinfo (lines 2040-2111).
-
client_credentialstokens are JWE (lines 1858-1976). -
The access-token lifetime is fixed at 900 s.
-
There is no password grant.
Neither exchange hop can be served, and no receiver could read a role from its access tokens.
-
-
ZITADEL 4.19.3 does not advertise the exchange grant. It only narrows exchange audiences unless the caller holds the impersonation permission. Its lifetimes are instance-wide (
internal/api/oidc/token_exchange.goat v4.19.3). -
Keycloak 26.x still serves §5. canopy has compiled Keycloak’s rules into its own code:
-
the
aud-<target>scopes (services/canopy-portal/src/tokens.rs,services/canopy-eligibility/src/orchestrator.rs); -
the hop-2 audience pair (
crates/canopy-auth/src/receiver.rs); -
the password grant in the test harness (
crates/canopy-test-lib/src/auth.rs, used by about 90 files), in the e2e helpers, in k6 and in canopy-cli.
-
Four more problems belong to the same design:
-
Confused deputy.
-
Every service token except the portal’s carries the broad
canopy-internal-serviceaudience and aservice:*role. -
Any service can call any other as itself, and receivers cannot tell a user-initiated call from a background one without side channels.
-
-
The exchange audit sits on the sender side.
-
A sender posts
auth.token_exchangeafter the IdP has granted the token (crates/canopy-auth/src/exchange_audit.rs), so anyone holding an exchanger secret can mint per-target tokens with no audit row. -
The audit ingest also serializes every worker write behind canopy-security’s global chain lock.
-
-
Shared client secrets. Confidential clients authenticate with
client_secret_basic, a secret the IdP also holds. -
The IdP gates the fleet’s boot. Every service refuses to boot unless the IdP advertises the exchange grant (
crates/canopy-auth/src/discovery.rs).
Custody of a canopy signing key was researched separately, covering Cosmian/Eviden KMS, PKCS#11 HSMs and canopy-signing today. No Pub 1075 or program rule requires a KMS or HSM for canopy’s own token keys, and FIPS 140 is a per-jurisdiction choice.
Decision
1. Two layers, one issuer each
-
At the edge there is exactly one upstream OIDC identity provider per deployment. canopy-web is its only client.
-
Internally there is exactly one issuer, canopy-identity, and every receiver trusts only it.
-
ADR-048 §2 is restated per layer: one upstream at the edge, and one internal issuer.
-
ADR-048’s trigger 4 becomes "a second upstream at the edge, or a second issuer at receivers".
-
ADR-048 §5 retires, together with its ZITADEL and authentik findings. An upstream now owes OIDC sign-in only.
-
No human passwords. canopy never verifies a human’s password; there are no local accounts.
The name canopy-identity is kept. ADR-019 used it for a contract that any external issuer could meet. It now names canopy’s own issuer.
2. canopy-identity is a module of canopy-security
canopy-security already hosts the signing-key registry and the worker directory (ADR-046). canopy-identity is a module of that service, not a new service.
-
ADR-019. Option 2 (canopy signs its own service tokens) and option 3 (an identity service) move from rejected to adopted, in modified form.
-
Option 4’s "canopy-identity is a contract, not a service container" is superseded.
-
Option 2 was rejected as a parallel auth system that confuses canopy-signing’s determination role and makes services validate two kinds of token. Under this decision it is the only internal auth system, determination keys and their lifecycle stay separate (D9), and receivers validate one kind of token.
-
Option 3 was rejected for latency, a single point of failure and operational footprint. The answers: signing happens in-process with no remote key, there are at least two replicas in production, system tokens stay cached (ADR-037), it is a module and not a new container, and a capacity test runs before the cut-over (Amendment 10 (2026-10-07, #2752) — the capacity model and production sizing: the load model, the harness and its gates). Discovery alone cannot provide per-hop delegation or purpose-scoped tokens across the upstream products.
-
-
Isolation inside canopy-security. The issuer has a dedicated database pool. Minting never takes the audit chain’s advisory lock.
-
Bootstrap. canopy-security boots through an issuer-host bootstrap:
-
its own receivers read the in-process key registry;
-
it depends on its own database and nothing else: no RabbitMQ, no upstream IdP.
-
-
Cold start order:
-
Postgres;
-
migrations;
-
canopy-security, which reports ready once its first key’s publish lead has elapsed (D9);
-
the other services, which accept an empty but valid key set until then;
-
canopy-web.
-
-
Edge. canopy-web stays the only internet-facing edge. It forwards canopy-identity’s public endpoints: device authorization, and the token endpoint for native and machine clients.
-
Configuration. The issuer identifier and its internal URL are deployment configuration.
-
Split trigger. See Reopen triggers, trigger 1.
3. Credentials
Every token canopy-identity signs has these properties:
-
it is a compact JWS signed ES256, the only algorithm, pinned in code;
-
its
kidis the key’s RFC 7638 thumbprint; -
it carries one fixed claim layout:
iss sub aud exp iat nbf jti client_id sid roles programs act purpose scope auth_time.
The per-jurisdiction claim contract moves to the federation boundary (D6). The credential types:
-
Session.
-
An opaque, client-bound credential, stored hashed in canopy-security. It is never a JWT.
-
A web session comes from federation (D6); a native session comes from the device grant (D7).
-
Delegation tokens are minted from a session.
-
-
Delegation token (
typ: at+jwt, RFC 9068).-
One audience, plus the RFC 8693
actchain of hops. This reverses ADR-043 A2’s unusedact. -
Lifetime at most min(now + 300 s, the subject credential’s
exp, the session’s end). This keeps today’s sender-side subject-expcheck (crates/canopy-auth/src/token_exchanger.rs). -
Roles and programs may narrow on a hop, but never widen.
-
-
System token (
typ: at+jwt).-
subis the client, and it carries apurpose, one audience and thescopes that purpose allows. -
Lifetime at most 600 s.
-
It carries no user. The actor of a background write is the service; an originating human is recorded as a referent, never as the actor. ADR-043 Amendment 1 holds.
-
-
Removed:
-
the
canopy-internal-serviceaudience; -
the
service:*roles; -
the
aud-*scopes; -
receiver-side introspection.
-
-
Routing rule. User-specific data is read and written by delegation. Background work and process-wide data, such as caches and the directory’s display names, use system purposes.
-
Sender-side reuse. A sender reuses a delegation token only within the request it serves (ruling R4,
ExchangeCacheincrates/canopy-auth/src/token_exchanger.rs), so no ambient user token outlives its request.-
The reuse key is a digest of the exact subject credential plus the normalized request. Today’s
subject_scoped_keykeys on audience, scopes and purpose, and re-checks roles on each hit. Delegation adds the narrowed roles and programs to the key, so a narrower request never receives a broader token. -
A reuse re-checks expiry.
-
4. Policy is code
Two compiled tables in canopy-auth are part of canopy’s architecture, not jurisdiction configuration:
-
the call graph, saying which caller may delegate to which target;
-
the purpose registry, mapping each (client, audience) pair to its allowed scopes.
The issuer applies both. Receivers re-check aud, typ and the last hop of the act chain.
5. One trust root per credential
Each credential kind has exactly one trust root. The key registry verifies only canopy-identity’s own tokens.
| Credential | Verified against | Binding |
|---|---|---|
canopy-identity token at a receiver |
the key registry (JWKS) |
|
subject token at delegation |
the key registry |
a delegation token (a user |
session credential |
its hash in canopy-security’s session store |
presented only by the client that opened it (D6, D7); unrevoked and fresh (D6) |
client assertion (RFC 7523) |
the client registry |
|
upstream id_token |
the upstream profile’s JWKS |
|
DPoP proof (RFC 9449) |
the embedded JWK |
its thumbprint equals the native session’s binding; |
|
the portal’s applicant key |
the portal carve-out, as today |
6. Worker sign-in
canopy-web is a confidential client of the upstream. It uses the authorization-code flow with PKCE S256, state and nonce. The upstream profile names the client authentication method, for example client_secret_basic for Kanidm.
Federation.
-
canopy-web validates the id_token. It then presents it to canopy-identity’s federation grant (RFC 8693, subject token type
id_token), authenticated withprivate_key_jwt. -
canopy-identity validates the id_token again, against the profile’s trust anchor.
-
It projects roles, programs and the username through the profile’s claim contract (
ClaimContract::project). -
It links or mints the subject (D8), checks suspension (D12), and opens a session.
The userinfo profile. canopy-web also sends the upstream access token, as the upstream_access_token parameter.
-
canopy-identity calls userinfo with that token.
-
It projects claims only when userinfo’s
subequals the verified id_token’ssub(OIDC Core §5.3.2).
Refresh.
-
Re-federation. canopy-web re-federates after each upstream refresh, and at least every 900 s. The refresh is single-flight across canopy-web replicas.
-
Refreshed id_tokens. Each profile declares whether refresh returns an id_token. A refreshed id_token must:
-
match the session’s
iss,aud,suband originalauth_time; -
carry a newer
iat; -
repeat the original
noncewhen present (OIDC Core §12.2).
A profile without refreshed id_tokens renews through userinfo, as above.
-
-
Freshness is enforced by canopy-identity. It refuses to mint from a session whose last upstream validation is older than 900 s plus the grace.
-
Grace. An upstream refusal ends the session. An upstream that is unavailable (network error, timeout or 5xx) grants at most 30 min of grace, capped at 60 min in code (narrowed to failures the upstream provably did not process: Amendment 2). The grace is audited.
Logout.
-
Logout revokes the session.
-
Where the upstream advertises an end-session endpoint, logout uses RP-initiated logout.
-
Otherwise it revokes the upstream refresh token (RFC 7009), and the next sign-in sends
prompt=login. -
(2026-10-13, #2905: logout revokes the upstream refresh token wherever one is held, beside RP-initiated logout as well as in its place. An end session need not end its session’s refresh tokens, and ZITADEL’s does not.)
Step-up. Device approval and security administration require an auth_time within 10 minutes. canopy-identity’s device-approval grant and canopy-security’s security-admin routes enforce it: they refuse a token whose auth_time is older. canopy-web’s max_age only triggers the re-authentication. The new id_token opens a session carrying the new auth_time. A native session, whose auth_time is its approval, therefore cannot perform security administration once 10 minutes have passed.
AC-8 and MFA.
-
canopy-web renders the system-use (AC-8) banner.
-
MFA stays the upstream’s obligation (ADR-048 §4). canopy does not read
amr, because not every upstream emits it. (2026-10-13: Amendment 26's AL4 names where each supported upstream enforces it. 2026-11-11: Amendment 27 lets a deployment requireamrvalues of a sign-in.)
7. Native and machine clients
Native clients (canopy-cli, and a later TUI) use RFC 8628 device authorization at canopy-identity.
-
Approval. A signed-in worker approves the user code in canopy-web, under D6’s step-up.
-
The native session. A rotating refresh credential, bound to a device key by DPoP (RFC 9449).
-
Per-target tokens. They come from the refresh grant with an RFC 8707
resource. -
Phishing resistance (RFC 8628 §5.4).
-
User codes have high entropy (§6.1) and live 10 minutes.
-
Code entry and polling are rate-limited (§5.1, §5.2).
-
The approval screen names the requesting client and when the flow began, and asks the worker to confirm that they started it.
-
-
Revalidation.
-
The step-up sign-in at approval gives canopy-web an upstream grant dedicated to the native session.
-
canopy-web re-federates it the way it does a web session, at least every 900 s, until the native session ends or is revoked. A native session ends after at most 8 h, capped at 24 h in code.
-
D6’s freshness rule applies, so upstream deprovisioning ends native issuance within the same bound.
-
-
No password grant. The password grant goes from canopy-cli and from every other caller.
canopy-cli is a caller in the compiled call graph (D4). Its per-target tokens are user delegation tokens, so routes that accept only a user serve it, and ADR-007 Amendment 1’s parity exception retires.
Machine clients use client credentials with private_key_jwt, and receive system tokens.
Access tokens stay bearer tokens. Only the native refresh credential is sender-constrained.
8. Subjects
-
Minting. canopy mints a UUID v7 subject on the first federation of an upstream (
iss,sub) pair it has not seen before.-
It matches that exact pair only, never an email address or a username.
-
The link is stored beside ADR-046’s directory, which re-keys on the canopy subject.
-
-
Attribution uses the canopy subject. Changing IdP product therefore re-links; it does not re-key.
-
Seed links and re-links are security-admin writes, and they are audited. The seed’s fixed subject UUIDs become canopy subjects, linked to the devstack upstream’s persons (Amendment 11 (2026-10-07, #2761) — the cut-over’s staging and the devstack identity plane K5, K8).
-
Sign-in depends on canopy-security. This reverses ADR-046 item 2.
9. Keys
Generation.
-
Each canopy-security replica generates its ES256 key in memory (
p256SigningKey::random(&mut OsRng)). The key is never persisted. -
It is used through a
KeySignertrait in canopy-signing. Determination signing shares that trait, but keeps its provisioned, retained keys (ADR-036).
The registry.
-
Ownership. A table owned by a NOLOGIN owner role, migrated through
MIGRATION_DATABASE_URL. That is the owner/runtime split canopy-reporting already uses. -
Grants. The runtime role has INSERT and SELECT only.
-
Timestamps. A trigger with no bypass setting stamps
created_atand sets:-
sign_from=created_at+ 60 s; -
sign_untilat mostcreated_at+ 24 h (default 6 h); -
publish_until=sign_until+ 720 s: the 600 s longest-lived token, plus 60 s leeway and 60 s clock skew.
-
-
Refusals. The trigger refuses:
-
a 65th concurrently published row, checked under a table lock (serialized by an owner-held guard row instead: Amendment 1);
-
every UPDATE and DELETE.
-
-
No maintenance setting. Unlike
signing_key_history, the registry has no maintenance bypass.
Revocation and the JWKS.
-
Revocation is a separate INSERT-only table.
-
The JWKS (published keys minus revoked keys) is served from the database, not from per-replica copies.
-
It stays under canopy-auth’s 64 KiB body cap.
Receivers.
-
They enforce the JOSE
typ,exp−iat≤ 600 s, andiat≤ now + 60 s. -
They refresh the internal JWKS every 300 s. They also refresh whenever they meet an unknown
kid, at most once per 30 s, as today; the 60 s publish lead covers that debounce. -
They fail closed for canopy-identity once their key set is 720 s stale.
-
Today’s cache keeps keys after a failed refresh with no bound (
crates/canopy-auth/src/jwks.rs). -
With the bound, a retired or revoked key stops working within it, even during a JWKS outage.
-
Replica lifecycle.
-
A replica publishes its key as its last boot step.
-
A replica’s first key after boot signs for at most 10 minutes. Once the replica has served that long, it rotates to the default lifetime. A crash-looping replica therefore holds only a few published rows.
-
A replica inserts its next key at least 60 s before its current key’s
sign_until, so it never stops minting. -
Revoked rows count toward the 64-row cap until their
publish_until(a revoked row frees its slot instead: Amendment 1). Reaching the cap raises an alert. -
A replica cannot become ready while the database is down.
Compromise response. Amendment 1 adds two steps for the issuer credential.
-
Revoke every key row published since the compromise may have begun. For a replica compromise, that is the replica’s own rows. For a runtime DB credential, it is every row inserted since then.
-
Rotate the runtime database credential.
-
Restart every replica, which generates new keys.
Hardening. The process is non-dumpable, core dumps are off, the root filesystem is read-only, and production RBAC grants no exec.
Optional backends.
-
A PKCS#11 HSM sidecar or a KMS backend behind
KeySigneris built only when a jurisdiction’s SC-12 or SC-13 assignment requires one. -
FIPS 140 is per jurisdiction.
-
Eviden/Cosmian KMS is not used: it is BUSL-1.1 and its client requires OpenSSL.
10. Client authentication is private_key_jwt
Every confidential client of canopy-identity authenticates with private_key_jwt (RFC 7523): every service, canopy-web, the portal and machine clients. No shared secret remains between canopy’s clients and canopy-identity. canopy-web’s upstream client authentication is whatever the upstream profile names (D6), for example a client_secret_basic secret provisioned through SecretProvider.
-
Keys. Each client has ES256 keys provisioned through SecretProvider (ADR-017), with no file fallback.
-
Registration. Up to two public keys per client, for rotation, are held in deployment configuration.
-
Assertions. An assertion’s
expis at most 60 s. Itsjtiis single-use across replicas. -
Not adopted: mTLS client certificates (RFC 8705) and platform-issued workload tokens. The trigger to revisit is a deployment with service-mesh PKI that asks for sender-constrained internal tokens.
11. The applicant portal
The portal keeps its own applicant authentication. Its per-target tokens become system tokens with portal purposes and scopes.
The X-Canopy-Applicant ownership claim stays portal-signed with its own key, as a named carve-out from "every receiver trusts only canopy-identity". Its separation of two secrets is the threat model recorded in crates/canopy-signing/src/applicant_claim.rs: a stolen narrow bearer cannot mint claims.
12. Revocation
canopy-security owns four kinds of revocation:
-
subject suspension (new: the directory has no disabled flag today);
-
session revocation;
-
client disablement;
-
key revocation.
Every mint checks subject suspension, session revocation and client disablement. An in-flight token therefore stays acceptable for at most 300 s (delegation) or 600 s (system), plus the 60 s leeway and 60 s skew.
Key revocation works differently. A token forged with a stolen key never passes through a mint, so the bound is the receivers' refresh: at most 300 s, or 720 s during a JWKS outage (D9).
The admin routes require a security-admin role. They are surfaced in canopy-web, and every change is audited.
13. Issuance audit
-
The log. Every mint and every refusal appends a row to an INSERT-only issuance log in canopy-security’s database, with group commit.
-
Fail-closed release. A credential is released only after its row commits. This keeps the audit-before-release contract of
crates/canopy-auth/src/exchange_audit.rs, but moves it to the issuer, where a stolen client key cannot bypass it. -
Export. The log is exported through ADR-041's audit-export channel.
-
No cold-start cycle. canopy-security mints its own tokens in-process.
14. Time and tests
-
Clock. The issuer, the receivers and every sender cache read the wall clock (
chrono::Utc::now()), never the test offset ofcanopy_common::clock. The devstack’s test clock moves decision time, not token time. -
No test-only grant. The battery signs in through the devstack’s upstream with a headless driver and federates as canopy-web does. It runs on the production images that CI promotes (ADR-040).
-
Conformance. Each upstream profile has a conformance suite. Playwright covers the default upstream, plus an
@identitysubset for each alternative. -
No password grant. It is removed everywhere.
Threat model
The source, CI configuration and this design are public (Kerckhoffs). Security rests on keys, not obscurity.
| Threat | Bound |
|---|---|
A stolen delegation token |
One audience, at most 300 s plus leeway, never past its subject’s |
A stolen system token |
One audience, one purpose’s scopes, and at most 600 s plus leeway. |
A stolen session credential |
Useless without the client’s |
A stolen client key |
Mints only that client’s purposes and call-graph edges, and every mint is audited at the issuer. canopy-web’s key also authenticates federation, which still needs a valid upstream id_token no older than 5 minutes. The key is revoked by client disablement and key rotation. |
A compromised service |
Can delegate only along its call-graph edges, from subject tokens addressed to it, never widening. It cannot mint system tokens outside its purposes. |
A compromised canopy-web |
Can act as, and open sessions for, any worker whose session, id_token or upstream grant it holds. This lasts until canopy-web’s client is disabled (D12) and those upstream grants are revoked. It cannot reach a worker who has no live grant at canopy-web, and it cannot mint system tokens beyond canopy-web’s purposes. |
A compromised upstream IdP |
Can sign in any linked worker, with any roles and programs the profile projects, security administration included. It can no longer mint service identity or bypass the issuance audit. |
A stolen runtime DB credential of canopy-security |
Can publish keys that forge any token, bypassing D4 and D13, each valid up to 24 h + 720 s after insertion. The compromise response (D9) revokes every row inserted since the compromise, rotates the credential and restarts every replica. This is the accepted cost of in-process keys; a two-tier root is the fallback (reopen trigger 2). |
A memory read or core dump of a canopy-security replica |
Exposes that replica’s key for its 60 s publish lead, its sign window and 720 s, plus the receivers' refresh lag: at most 300 s, or 720 s under a JWKS outage. After revocation the key lasts at most 300 s, or 720 s. Hardening (D9) closes the usual paths. |
A JWKS outage used to prolong a revoked key |
Receivers fail closed after 720 s of staleness. |
Device-code phishing (RFC 8628 §5.4) |
A worker persuaded to approve an attacker’s code gives the attacker a native session as that worker. It lasts at most 8 h (24 h cap), is revocable (D12), and cannot perform security administration after 10 minutes. Codes are short-lived, high-entropy and rate-limited, and the approval screen names the requesting client and the start time (D7). |
The residual risks accepted:
-
canopy owns a security-critical authorization server, which needs its own review, fuzzing and hardening;
-
an upstream outage stops new sign-ins;
-
a canopy-security outage stops issuance: new worker writes fail at once, and background work stops once its cached system tokens expire.
Alternatives considered
-
Kanidm as the one issuer (ADR-048 unchanged). Impossible on 1.11.2: per-client issuers, no user-subject exchange, no claims in access tokens (see Context).
-
Keep Keycloak as the internal issuer and broker Kanidm upstream into it.
-
Keycloak stays mandatory everywhere, and "Kanidm default" becomes nominal.
-
A JVM stays on every worker write.
-
The confused-deputy and sender-side audit problems remain.
-
-
Receivers trust several issuers (#2342 as first written). It needs per-issuer exchangers, receivers and attribution. It still cannot serve Kanidm, whose exchange is unusable for users.
-
Drop audience restriction and forward the IdP’s access token. This abandons per-target least privilege. Kanidm’s access tokens carry no roles in any case.
-
Key custody.
-
A SOPS-provisioned key file: humans and CI would hold a fleet-wide minting key, and rotation would be manual.
-
A software signer sidecar: the same compromise bound as in-process keys, with more moving parts.
-
A KMS such as Eviden/Cosmian: BUSL-1.1, an OpenSSL client, ES256 keys that are software keys inside the KMS, and an HA cluster on the hot path.
-
Two-tier keys (a pinned root certifying short-lived keys): sound only if every receiver pins the root. Kept as the fallback if an HSM is mandated and cannot meet latency.
-
A PKCS#11 HSM sidecar: built only on a mandate (D9).
-
Consequences
-
Effective at the I3 cut-over (epic &133), staged as Amendment 11 (2026-10-07, #2761) — the cut-over’s staging and the devstack identity plane K1 states. Until then, ADR-048 and the ADRs bannered below describe the running system, as ADR-041 did for ADR-014. (2026-10-12: effective with the switch; Amendment 25 records it as built.)
-
canopy owns an authorization server. That brings a threat model (above), proptests and an evil-input corpus for every new parser, and an external security review before the cut-over merges. (2026-10-11: Amendment 25's R24 moves the external security review and the issuance log’s retention to a production deployment’s gate; the switch merges once green.)
-
Dependencies. canopy-security becomes a boot dependency of every service, and a dependency of worker sign-in.
-
Deprovisioning bound. Upstream deprovisioning ends issuance within 900 s plus the grace, for web and native sessions alike. canopy-side suspension takes effect at the next mint.
-
The battery depends on the default upstream, which it drives headlessly. Each alternative has its own conformance suite.
-
Onboarding a jurisdiction means choosing an upstream profile (ADR-050) and registering clients. It is configuration, not code.
-
Corrections to earlier ADRs. Each ADR classed amended in ADR classification carries a dated banner now. Its detailed amendment lands with the stage that makes it true. (2026-10-12: each banner is replaced by the detailed amendment its row names.)
-
Issues absorbed into the program’s stages:
-
epic &131 (canopy-identity core): #2343;
-
epic &132 (the user plane): #1447 and #1448;
-
epic &133 (the cut-over): #2344, #2345, #1595, #1869 and #1901;
-
epic &134 (alternative upstreams): #2347 and #2349, superseded by the per-IdP conformance suites, and #2342, re-scoped to a second upstream at the edge. (2026-10-13: #2342 leaves &134 and waits for reopen trigger 3; Amendment 26.)
-
-
Closed on acceptance:
-
#2335: obsolete, because canopy-minted subjects already store the upstream issuer (D8);
-
#2351: receiver introspection is deleted (D3);
-
#513: canopy never verifies human passwords (D1).
-
-
Out of scope, tracked:
-
key and secret loaders that fail open outside development (#2489);
-
the operator tools' credential encoding (#2427);
-
canopy-web’s session-write races (#2224). Its cross-replica refresh single-flight is also an I3 requirement.
-
Reopen triggers
This decision is reopened when any of these is observed:
-
Separation of duties or load. A jurisdiction’s separation-of-duties or ATO rule requires the issuer outside canopy-security, or issuance load degrades canopy-security’s other work (measured as Amendment 10 (2026-10-07, #2752) — the capacity model and production sizing P7 states). Either moves canopy-identity to a service of its own.
-
A mandated HSM or FIPS module. A jurisdiction’s SC-12 or SC-13 assignment requires HSM custody, or a FIPS 140-validated module, for token signing. That adds a
KeySignerbackend under an ADR-scoped exception. -
A source no single upstream can broker. A mandated identity source that no single upstream can broker, or cross-jurisdiction federation, needs a second upstream at the edge (#2342).
-
DPoP-bound access tokens (added 2026-11-03, #2888). D7 sender-constrains only the native refresh credential, so
canopy_auth::identity_dpoprefuses a proof that carriesnonceorath. A change that binds an access token to a DPoP key (RFC 9449 §6) also has to build:-
athacceptance, each proof’sathchecked against the token it is presented with (§4.3, §7); -
server-provided nonces, signalled with
use_dpop_nonce, at canopy-identity’s token endpoint (§8) and at every resource server that accepts the token (§9). Without them, whoever holds the device key can pre-generate proofs for any futureiat, and an exfiltrated proof then works without the key (§11.2); -
nonces that every replica recognises, and the
jtisingle-use record kept, at every server that accepts proofs, for as long as a nonce is accepted (§11.1). That is the same cross-replica guaranteeidentity_dpop_proofsgives the token endpoint today.
-
ADR classification
The ADRs that grep -ril "keycloak\|issuer\|client_credentials\|exchange" finds in the ADR directory, plus ADR-044. An amended ADR has a decision that becomes false at the cut-over. It carries a dated banner now, and its detailed amendment lands with the stage that makes it true. A mentioned ADR names the old model only as context. An unaffected ADR matches the search for another reason.
2026-10-12: the switch made every amended row true. Each row names the dated amendment that replaced its banner, and states what that amendment changes.
| ADR | Title | Class | Why |
|---|---|---|---|
001 |
Program service isolation |
unaffected |
"canopy-exchange" is a service name. |
004 |
Legally-scoped data tenancy |
unaffected |
RabbitMQ exchanges and data exchange only. |
005 |
Modular deployment profiles |
mentioned |
Names the devstack IdP; an IdP stays required in every profile. |
006 |
Jurisdiction-agnostic rulesets |
unaffected |
canopy-exchange only. |
007 |
CLI/API/UI parity |
amended |
canopy-cli moves from the password grant and its audience exchange to the device flow, and its delegation tokens reach 14 services (D7); Amendment 1’s human-only exception retires. Amendment 4. |
008 |
Applicant portal |
mentioned |
Applicants have no IdP account (unchanged, D11); Amendment 5’s portal |
009 |
PostgreSQL session storage |
mentioned |
canopy-web still holds upstream OIDC state. |
012 |
Layered YAML config |
mentioned |
A Keycloak client secret appears only as an example. |
015 |
Containerized integration tests |
mentioned |
A historical devstack Keycloak note. |
016 |
Forward-only migrations |
unaffected |
"In exchange for" in prose. |
017 |
Encrypted secrets at rest |
amended |
Clients of canopy-identity use |
018 |
Persistent outbox |
unaffected |
RabbitMQ exchanges only. |
019 |
Service identity and on-behalf-of |
amended |
canopy-identity becomes canopy’s own issuer; options 2 and 3 are adopted; service tokens become system tokens and on-behalf-of becomes onward delegation (D2, D3, D10). Amendment 3. |
020 |
Chaos observability |
mentioned |
A mock issuer URL in a test fixture. |
022 |
Composition override storage |
mentioned |
Amendment 2’s shared- |
023 |
OIDC at services, citizen-upload isolation |
amended |
Decision 1 holds against canopy-identity. Decisions 2-6: delegation replaces IdP exchange, system tokens replace service-class credentials, revocation and audit move to canopy-security (D3, D12, D13). Amendment 1. |
026 |
Privacy-first applicant portal |
mentioned |
A historical devstack realm note. |
027 |
Worker fact authoring |
mentioned |
"Keycloak subject" becomes the canopy subject; humans remain the only authors. |
034 |
Per-program context mapping |
unaffected |
canopy-exchange only. |
035 |
Per-member determination |
unaffected |
"Exchange" in prose. |
037 |
Signing-key-aware service-token acquisition |
amended |
The cached IdP token becomes a canopy-identity system token signed by registry-bounded keys (D3, D9). Self-validation gives way to the sender’s bounded cache and one resend after a receiver refuses the bearer (Amendment 16 (2026-10-09, #2806) — senders E6). Amendment 2. |
043 |
OIDC program amendments |
amended |
A1, A2, A3’s codes, A5, the |
038 |
Concurrency-safe applicant finalization |
mentioned |
Outside the grep. §7’s applications-only gate moves from the |
044 |
Worker program scope is a required IdP claim |
amended |
Outside the grep, but amended: programs are projected at federation, and the revocation delay becomes the session’s revalidation bound (D6). Amendment 2. |
045 |
Blind-broker exchange partner evidence |
unaffected |
canopy-exchange; its caller binding survives through system-token purposes. |
046 |
Worker directory |
amended |
Keyed on the canopy subject under canopy-identity’s issuer; sign-in needs canopy-security (D8). Addendum 3. |
048 |
OIDC-only identity |
amended |
§1 gains the issuer, §2 restated per layer, §3 moved to the federation boundary, §4 introspection and §5 topology removed, trigger 4 restated (D1). Amendment 1. |
Amendment 1 (2026-09-30, #2498) — the registry as built
Status unchanged (still Accepted). Plan I1a builds D9’s registry
(plan I1a, U3). The runtime writes
it through a dedicated login, canopy_identity_issuer, which owns nothing and
holds INSERT and SELECT only; every registry object is owned by the NOLOGIN
canopy_identity_owner. Four points of D9 change:
-
A revoked row frees its slot. D9 counted a revoked row toward the 64-row cap until its
publish_until. The cap now counts only unrevoked rows whosepublish_untilis still ahead. Otherwise an attacker who filled the cap with forged keys would block the compromise response from publishing fresh keys for up to 24 h + 720 s. Revocation cannot become a loop that lets an attacker publish more, because the response shuts the issuer login out before it revokes (below). -
The cap is serialized by an owner-held guard row, replacing "checked under a table lock". The issuer login holds no privilege that permits
LOCK TABLEin a mode that excludes other inserters, and granting one would widen it. Instead the BEFORE INSERT trigger,SECURITY DEFINERand owned by the owner role, increments the single row ofidentity_signing_key_cap_guardbefore it counts. Concurrent inserters queue on that row lock under READ COMMITTED, or fail with40001under REPEATABLE READ. The count usesclock_timestamp(), so rows inserted earlier in the same transaction count; a 65th row is refused with SQLSTATE54000. -
Staleness is measured from the key set’s generation time. The JWKS memoizes per replica for up to 5 s and sends the memo’s age in the standard
Ageheader (RFC 9111 §5.1). A receiver measures its key set’s staleness from request start −Age, so the 300 s refresh and 720 s fail-closed bounds hold as stated even though a fetched set may be up to 5 s old. -
The compromise response shuts out live sessions. Rotating a password leaves sessions already logged in usable. For the issuer credential the response is therefore: make the login
NOLOGIN; terminate every issuer session (pg_terminate_backend) and wait until none remains; revoke the rows inserted since the compromise may have begun; set a new password and restoreLOGIN; restart every replica. The runbook is in Security Operations.
Until #2501 moves canopy-security’s main pool to a least-privilege login,
the main credential is the migration superuser, and it can act as the
registry’s owner. The main-pool boot probe refuses such a credential unless
CANOPY_SECURITY__ALLOW_BROAD_DB_ROLE=true accepts the risk, and the
database-enforced invariants bind only the issuer login until then.
Erratum (2026-10-24, as-built): #2501 landed. The main pool connects as the
canopy_security_runtime login, which owns nothing, is a member of no role
and holds only the main pool’s grants (migration 20270124000000), so the
main-pool probe admits it with no override and the database-enforced
invariants bind it too. The devstack sets no override.
Amendment 2 (2026-10-01, #2516) — grace only for a refresh the upstream did not process
Status unchanged (still Accepted). Plan web-session-store (U2) classifies every answer to canopy-web’s upstream refresh by whether the upstream may have processed it. D6’s Grace bullet changes:
-
Grace narrows to failures the upstream provably did not process. D6 granted grace to an upstream that is unavailable: a network error, a timeout or a 5xx. A timeout, a connection lost after sending, or a 5xx can follow a rotation the upstream completed, and presenting that refresh token again is a replay, which revokes the whole session (ADR-050 §4). Grace now applies only when the request never reached the upstream (the connection never opened, a connect timeout included) or the upstream answered 408, 425 or 429. canopy-web bounds the connect below the refresh budget, so a stalled connect is a connect timeout; a connect still pending when the grant’s remaining budget runs out is a request timeout, and ends the session.
-
Every other failure ends the session, and its refresh token is never presented again: a refusal (any other 4xx), a 2xx whose body cannot be read or parsed, a timeout or a connection lost after sending, a 5xx, or any other status. The worker signs in again. ADR-050 §4 already accepts a re-login after a lost refresh response; this extends that to every answer that may hide one.
canopy-web applies the rule on its current refresh path (GrantOutcome,
services/canopy-web/src/auth/refresh.rs), and it carries over to I3’s
upstream refresh unchanged. The outcome table and its counter are in
IdP Integration › Refresh outcomes.
Amendment 3 (2026-10-02, #2549) — client authentication, purposes and system tokens
Status unchanged (still Accepted). Plan I1b builds canopy-identity’s client authentication, purpose registry, token endpoint and issuance audit. It records nine decisions, and A1 replaces D5’s binding for the client assertion:
-
A1. Assertion audience and type. A client assertion’s
audis the issuer identifier as its sole value, and anything else is refused. This follows draft-ietf-oauth-rfc7523bis-11 (in the RFC Editor queue) over D5’s "audequals the token endpoint", which D2’s internal and edge-forwarded token endpoints would make ambiguous. The JOSEtypmust beclient-authentication+jwtor absent; any othertypis refused, so an access token never passes as an assertion. -
A2. Purposes. D4’s registry is a compiled list of purposes, each a name, a client, an audience and a scope set. A (client, audience) pair has at most one purpose, so a client names only the audience and the issuer derives the purpose; its name is
<client-id>/<audience-service>, for examplecanopy-portal/canopy-applications. A request’sscopeis optional: when present it must be a subset of the purpose’s set, and when absent the token carries the whole set. Client ids are compiled (canopy-portalin I1b), so purposes stay code (D4). I1b seeds the portal’s purposes from its per-target scopes; each other sender’s arrive with its I3 cut-over. -
A3. Audiences. A request names its audience with an RFC 8707
resourceof the formurn:canopy:service:<service-name>, an absolute URI, and the token’saudis that URI. At I3 a receiver derives its own identifier from its service name, with no configuration. -
A4. System token claims.
iss sub aud exp iat nbf jti client_id purpose scope, withsub=client_id,nbf=iatand a space-separatedscope. D3’s user claims (sid roles programs act auth_time) are absent, not null: the claims type denies unknown fields, so a token carrying any of them is refused. The lifetime is 600 s under the headertyp: at+jwt; the validator also acceptsapplication/at+jwt, compared case-insensitively (RFC 9068 §4). -
A5. Stores. The jti store and the issuance log live in canopy-security’s database and are written by the issuer login, because the issuer depends on its own database and nothing else (D2). The log is INSERT-only by trigger, and the issuer cannot read either table. Expired jti rows go only through an owner-run
SECURITY DEFINERpurge the issuer may execute. The log grows until #1303 sets retention. -
A6. Audit before release. Every mint and every handled refusal waits for its log row to commit, through a bounded group-commit writer. A response that cannot be audited, because the queue is full, the write failed or the deadline passed, is a 503 that releases nothing; so an
issuedrow means a token was minted and released only after COMMIT, and a caller that gave up during the commit never receives it. A request the rate limiter refuses (429) never reaches the handler and is not logged. -
A7. Client disablement in I1. A client registry entry’s
enabled: false, or the client’s absence from the registry, refuses the client at every mint. The registry is read only at boot, so a change to it takes effect at the next restart. Runtime disablement is I2’s (D12). -
A8. The D13 export. The log carries a stable
record_id, aschema_versionand arow_digestthe database computes over the complete stored row,occurred_atincluded: the stable record id and complete-row digest ADR-041’s channel requires. ADR-041’s policy version is stamped by the export, which waits on #1301. The token endpoint answers a failure it can retry with RFC 6749’stemporarily_unavailable, extended from the authorization endpoint (§4.1.2.1). -
A9. JOSE headers. Both canopy-identity JWS validators, the client assertion’s and the receivers', accept exactly the protected headers
alg,kidandtyp, and refuse any other,crit,b64,jwk,jku,x5candx5uamong them (RFC 7515 §4.1.11). No extension is supported, so none can change what a validator verifies.
I1b stages three decisions:
-
D10. Client keys are configuration and client ids are compiled. A deployment registers up to two public keys per compiled client in canopy-security’s
identity-clients.yaml, each identified by its RFC 7638 thumbprint kid, computed and never configured, and cannot add a client. canopy-security holds the registered keys in memory and looks each one up by that kid; they are not published. The loader for a client’s private key reads it through SecretProvider with no file fallback, as D10 states; provisioning a real client’s key, and wiring the loader into a client, is I3’s. -
D12. Client disablement is restart-scoped (A7).
-
D13. Every mint and every handled refusal is audited before release (A6). The export through ADR-041’s channel waits on #1301 (A8); until then the issuance log’s database rows are the record.
Amendment 4 (2026-10-04, #2641) — clients, the call graph and the delegation token layout
Status unchanged (still Accepted). Plan I2a compiles every canopy-identity client and receiver, derives the service-to-service call graph from deployment settings and gates the compiled graph against it, and pins the delegation token’s claim layout. It records seven decisions, and B2 states what D5’s subject-token audience binding compares:
-
B1. Clients. Clients are compiled, in two kinds. A confidential client (
ConfidentialClient) authenticates withprivate_key_jwt(D10): canopy-web, canopy-portal and the 13 services that call another service (appeals, applications, caps, eligibility, enrollment, medicaid, notices, renewals, reporting, snap, tanf, verification and wic). A native client (NativeClient) is public: it has no registry keys and is bound by DPoP (D7); canopy-cli is the one. AClientis either, written as its bare id. A client assertion’sissandsubname a confidential client, so a native id never parses as an assertion, and the client registry refuses one as an unknown client. I1b’s one-variantSystemClientbecomesConfidentialClient, with no alias. -
B2. Receivers. The 16 services that serve another canopy caller are compiled as receivers (
CanopyService): appeals, applications, caps, eligibility, enrollment, medicaid, notices, persons, renewals, reporting, rules, security, snap, tanf, verification and wic. canopy-exchange joins when it serves a route. A receiver’s audience is its A3 URI, and only a receiver’s audience parses, back to that receiver. A confidential client that is a service runs as that service, so D5’s "audequals the authenticated client" means a subject token’saudequals the audience of the service the client runs as. -
B3. The call graph. D4’s call graph is one compiled table, one row per (caller, target), each row
Delegation,SystemorBoth. D4’s delegation edges are theDelegationandBothrows; theSystemandBothrows are the only (client, audience) pairs a purpose may name. An edge carries no cap on roles or programs: a mint narrows per request. An edge to a program service holds in every deployment, and a profile without the program carries no traffic on it (ADR-005). -
B4. Classifying an edge. D3’s routing rule, applied by tracing every call on an edge to its origin. A call inside a worker’s or a native client’s request, on that user’s data, is delegation, synchronous retries inside that request included. A call from a background or detached task, a durable or background retry that outlives the request, boot, or a request the portal made (a system token, no user) is system. Origins are traced transitively: when a background caller calls a service whose handler calls onward, the onward edge carries system work too. An edge with both is
Both. canopy-cli’s edges areDelegationonly (D7) and the portal’sSystemonly (D11). Program services call canopy-rules asSystem: rules evaluates the facts it is sent and holds no user record. -
B5. The delegation token layout. D3’s claims without
purposeandscope:iss sub aud exp iat nbf jti client_id sid roles programs act auth_time, under the headertyp: at+jwt, withnbf=iatand a lifetime of 1 to 300 s.subis a canopy subject (D8) andsidthe session’s public id, never its credential; both parse from any UUID version.rolesis a non-empty, sorted, duplicate-free set of names matching^[a-z_]{1,64}$; the issuer, not the parser, holds the vocabulary, so a rolling deploy survives a new role.programsis a non-empty, duplicate-free set of programs sorted by wire id in byte order.actis required (RFC 8693 §4.1): its outermost actor is the current one and equalsclient_id, its innermost is the session’s opener (canopy-web or canopy-cli), and every other actor is a confidential client that runs as a service. No actor repeats, and a chain holds at mostMAX_ACT_DEPTHactors. Both token layouts deny unknown fields, so a system token never parses as a delegation token, nor the reverse. -
B6. The depth bound.
MAX_ACT_DEPTHis the most actors a chain can hold along compiled delegation edges: the longest sequence of distinct clients that starts at a session opener, in which each client has a delegation edge to the next and the last has one to some target. A test computes it by search and pins it. The graph has cycles, so the no-repeat rule, not acyclicity, keeps chains finite; the target may be an earlier actor. -
B7. The census. Edges are observed from the deployment settings that hold peer URLs, since a service can call only a peer it has a URL for, and the compiled graph is gated against them. The census reads every non-test source file of every service and canopy-cli, and fails on any
urlfield orCANOPY*_URL*variable it cannot classify, so a new peer setting that follows that naming convention cannot escape it. A setting named outside the convention would; the convention is recorded in canopy’s coding conventions, and that is the limit of the guarantee. Route-level authority stays in the receivers' role bars and, for system tokens, purpose scopes.
Amendment 5 (2026-10-05, #2692) — the upstream profile and id_token verification
Status unchanged (still Accepted). Plan I2b builds the upstream half of federation that plan I2c’s grant calls: the deployment’s upstream profile and its TLS trust anchors, the upstream’s discovery and keys, the id_token validator, the userinfo client and the projection. It records nine decisions. C7 narrows D5’s id_token row, C8 amends D6’s federation step 3, and C9 sets userinfo’s grace:
-
C1. One profile file. The upstream profile is one file that no other tier layers over,
<CANOPY_CONFIG_ROOT>/identity-upstream.yaml, parsed by one canopy-auth type that refuses unknown fields; canopy-security reads it now and canopy-web at I3. D1 allows one upstream, so both readers must agree oniss, the client and the algorithms, and ADR-012’s layers are per service, so two services cannot read one copy. The file holds no secret: canopy-web’s upstream client secret stays in SecretProvider (D10). An absent file means no upstream is configured, with one boot warning; a file that exists and is unreadable or defective refuses the boot, naming the field. Boot reads and validates the file and its trust-anchor bundle but makes no request (D2). -
C2. Profiles in I2.
kanidmandoidc-genericonly.algorithmsis a non-empty subset ofES256,ES384,RS256,PS256andEdDSA;noneand everyHS*are refused. Each binds one key type: P-256, P-384, RSA of at least 2048 bits (both RSA algorithms) and Ed25519. Akanidmfile states onlyissuer,client_idand the optionaljwks_uri,userinfo_endpointandtls_trust_anchors, and is refused when it states a preset field. Its presets:ES256; claims from the id_token; a refresh that re-issues the id_token;client_secret_basic; roles at/rolesand programs at/primary_programs(canopy’s provisioning convention for Kanidm, not Kanidm built-ins); the username at/preferred_username. Anoidc-genericfile states every field but those three optional ones. (2026-10-13: Amendment 26's AL1 adds thekeycloakandzitadelpresets.) -
C3. Two meanings of "trust anchor". D6’s "the profile’s trust anchor" is D5’s "upstream profile’s JWKS". ADR-050 §2’s Trust anchors are TLS roots, which the profile names
tls_trust_anchors. -
C4. The TLS bundle replaces the built-in roots. When
tls_trust_anchorsnames a bundle, the upstream client trusts only it; without one it trusts the built-in roots. Replacing pins discovery, JWKS and userinfo to the deployment’s PKI, so a mis-issued public certificate cannot substitute the upstream’s keys. This narrows ADR-050 §2’s "extra trust anchors", as ADR-050 Amendment 2 records; an additive mode waits for a deployment that needs one. -
C5. Upstream key bounds. The upstream key cache keeps D9’s bounds and Amendment 1’s dating: a refresh every 300 s, an unknown
kidrefetched at most once per 30 s, fail closed once the set is 720 s stale, and the set dated by its fetch start less the response’sAge, the older of discovery and JWKS deciding. Each fetch sendsCache-Control: no-cache(RFC 9111 §5.2.1.4). An older cached copy never replaces a newer set, so a key the upstream removed stops verifying at most 720 s after its removal; a set born stale leaves the keys unavailable, and a malformedAgefails the fetch. The bound assumes that a cache in front of the upstream sendsAgeon a stored response, as RFC 9111 §5.1 requires: that is the deployment’s requirement. Unavailable keys are an outcome distinct from a refused token. -
C6. Issuer and endpoints. The
issueris an identifier: https (http only in development), no userinfo, query or fragment, and written in canonical form or as a bare origin, sinceissand discovery’sissuermust equal it byte for byte.jwks_urianduserinfo_endpointare endpoints: https (http only in development), no userinfo or fragment, a query allowed. Discovered endpoints must share the issuer’s origin (scheme, host and port); endpoints the profile names may sit elsewhere. Discovery need not advertise token exchange or refresh. -
C7. The id_token rules, narrowing D5’s row. An upstream id_token is at most 16 KiB. Its protected header holds
alg,kid, an optionaltypand an optionalx5torx5t#S256(ignored), each once, and nothing else;algis in the profile’s list and bound to the key thekidnames, and atypisJWTorapplication/jwt. Every time claim is an RFC 7519 NumericDate.expis afternow− 60 s;nbf, when present, no later thannow+ 60 s;iatno older than 300 s and no later thannow+ 60 s.auth_timeis required (D3, D6) and no later thaniat
60 s ornow+ 60 s; how old it may be is I2c’s step-up andmax_agepolicy, so canopy-web’s authorization request must ask for it (OIDC Core §2).subis anOidcSubject.audis exactly the client: an additional audience is refused,azpnotwithstanding, because the profile names no other audience the client trusts. This narrows D5’s "audcontains the client"; a trusted-audience list waits for a deployment that needs one. Anazpother than the client is refused. Thenonceis returned for canopy-web to check (D5), and neitheramrnoracris read. (2026-10-13: Amendment 26's AL2 admits ZITADEL’s project id beside the client.) -
C8. The projection, amending D6’s federation step 3. A verified anchor (
iss,sub,auth_time,nonce) and a claims payload, from the id_token or userinfo as the profile says, project to a federated identity: roles as B5’s role set, programs as B5’s program set, and a username of 1 to 256 bytes with no control character. Roles are the profile’s role names intersected with the vocabulary, with no service prefix (D3). The projection does not go throughClaimContract::project, whose retirement is I3’s. A refusal isNoRole(no_role),MissingPrograms(missing_primary_programs),MalformedPrograms(malformed_primary_programs) orNoUsername(no_username, a code new here). (2026-10-13: Amendment 26's AL3 adds ZITADEL’s object-keyed claim and its organisation pin.) -
C9. Userinfo failures and grace. Amendment 2 narrowed D6’s grace because a refresh the upstream may have processed may have rotated its token. A userinfo GET spends no credential, so that rationale does not apply. An unavailable userinfo (no connection, any timeout, a connection lost after sending, 408, 425, 429 or a 5xx) gets D6’s original grace when it renews an existing session; a refusal (any other 4xx) or an invalid answer ends the session. A sign-in has no session to extend, so a sign-in whose claims come from an unavailable userinfo fails.
Amendment 6 (2026-10-05, #2712) — the federation grant, subjects and web sessions
Status unchanged (still Accepted). Plan I2c builds canopy-identity’s federation grant: an upstream id_token is verified, projected and linked to a canopy subject, and opens an opaque, client-bound web session that canopy-web renews, may hold under a bounded grace, and revokes. It records nine decisions. F4 fixes the web session’s end, which D3 needs and which only D7’s native sessions had; F5 narrows C9’s "an invalid answer ends the session"; F6 specifies how D6’s grace is recorded and extends C9’s grace to an unavailable key fetch:
-
F1. The grant’s wire shape. The grant is RFC 8693 token exchange (
urn:ietf:params:oauth:grant-type:token-exchange) at the token endpoint, and only canopy-web may use it: any other authenticated client isunauthorized_clientbefore anything is looked up. Both of its forms request the token typeurn:canopy:params:oauth:token-type:web-session. An open presents the upstream id_token as the subject token (typeurn:ietf:params:oauth:token-type:id_token), plus the upstream access token asupstream_access_tokenexactly when the profile’s claims come from userinfo. A renewal presents the session credential as the subject token (type the web-session URN), plus exactly one of: the refresh evidence the profile names (upstream_id_tokenfor a refresh that re-issues id_tokens,upstream_access_tokenfor userinfo), orupstream_outcome=not_processed.resource,scope,audience,actor_tokenand any parameter of the other form are refused. Decoded values are capped: id_tokens at 16 KiB, the access token and the client assertion at 8 KiB each, and the session credential at exactly 43 characters. The encoded form’s cap rises to 64 KiB, which holds every cap at once even when the access token’s+,/and=are percent-encoded. With no upstream profile the grant isunsupported_grant_type, and the metadata does not advertise it. -
F2. The answer. RFC 8693 §2.2.1’s:
access_tokenis the session credential, which a renewal echoes (a web credential is never rotated, since only its opener’s key can present it);issued_token_typeis the web-session URN,token_typeisN_A, andexpires_inis the seconds untilfresh_until(at least 0). It addssidandsub(the session and the canopy subject, as UUID strings),auth_time,session_ends_atandfresh_until(integer NumericDates),rolesandprograms(string arrays) andusername. A defect in the request or its subject token isinvalid_request(400, RFC 8693 §2.2.2), and an upstream unavailable at an open istemporarily_unavailable(503). A refusal canopy-web must act on addscanopy_refusal, from a closed set: C8’s four projection codes,auth_time_too_old,subject_suspended,upstream_refused,grace_exhaustedandsession_ended.session_endedstands for an unknown, an ended and a revoked session alike, deliberately indistinguishable. -
F3. Sessions. The credential is 32 bytes from a CSPRNG, written as canonical unpadded base64url and stored only as its SHA-256. A session is a set of INSERT-only records owned by canopy-identity’s database owner: the session, its validations and at most one revocation, each written by an owner function. The issuer reads them and executes the functions. Each validation carries a version that the function allocates under the session’s row lock (the open is 1, each later one the latest plus 1, unique per session), and the latest validation is the highest version. When a validation was recorded is kept for audit only, since a wall clock can step back. Every state change commits its issuance-log row in the same transaction, so nothing takes effect unlogged (D13).
-
F4. Session terms. A web session ends at the upstream
auth_timeplusidentity_web_session_max_seconds(default 43200, between 1800 and 86400). An open whose end is under 900 s away (now judged in whole seconds, as the id_token validator judges it) is refusedauth_time_too_old, so canopy-web re-authenticates withprompt=login. A session is fresh until its last upstream validation plus 900 s, never after its end. The validation instant is the presented id_token’siatwhen the request carried one, else the arrival of the userinfo answer. Times arechrono::Utc::now()(D14). -
F5. Renewal. A session is bound to the upstream issuer and client it was opened under: a renewal under a profile whose
issuerorclient_iddiffers revokes the session (upstream_changed) before any upstream call, so a changed issuer’s equalsubnever renews an old subject (F7). A refreshed id_token passes C7, so itsaudis exactly the client, which the binding makes the session’s own. It must then match the session’siss,suband originalauth_time; carry a nonce equal to the original’s, or none (OIDC Core §12.2; a nonce where the original had none is a mismatch); and carry aniatnewer than the latest recorded. The latest id_token presented again (the same SHA-256) is a replay, and answers the current state. A userinfo renewal binds userinfo’s expectedsubto the session’s stored upstreamsub. Every renewal carries the version it read before its upstream work; a renewal that finds a later version committed is superseded and answers the current state, never overwriting it. Each recorded renewal re-projects, and the session takes the new roles and programs, whether they narrow or widen. The verdicts:-
a presentation defect (a malformed, mismatched or not-newer id_token, or an access token that is not a Bearer
b64tokenand so is never sent) or a deployment defect (no userinfo endpoint, or one whose URL the upstream client refuses, logged as such) refuses and leaves the session exactly as it was, so it lapses at its recordedfresh_until, which an earlier grace may hold to the last validation plus 900 s plus the grace; -
the upstream’s own verdict (userinfo refused, any other invalid userinfo answer, or a projection refusal) revokes the session. This narrows C9’s "an invalid answer ends the session" to the cases the upstream decided.
-
-
F6. Grace. A renewal records grace when canopy-web declares
upstream_outcome=not_processed(Amendment 2’s unprocessed classes, which only canopy-web observes), or when canopy-identity’s own userinfo call or key fetch is unavailable: C9’s grace, extended to keys. Under the session’s lock, and only when no later version has committed, a grace copies the latest successful validation’s instant, roles, programs and username, and setsfresh_untilto that instant plus 900 s plusidentity_session_grace_seconds(default 1800, between 0 and 3600), never past the session’s end. Repeated grace never extends it. Grace whose window has passed is refusedgrace_exhausted. At an open, unavailability fails the sign-in. -
F7. Subjects. A subject is a UUID v7, minted on the first successful open of an upstream (
iss,sub) pair not seen before, after the projection succeeds, so a refused account leaves nothing behind.issis stored exactly as the profile writes it. Matching is on that exact pair: a changed issuer (a renamed Kanidm client, for example) mints a new subject until a security administrator re-links it (I2e). Linking or minting is one owner function, so concurrent first opens yield one subject. -
F8. Suspension and revocation. I2c builds the suspension record (INSERT-only, the latest record wins) and checks it at open and at renewal. Its writer functions are granted to nobody, as key revocation’s is, until I2e’s routes call them. A suspended subject’s renewal revokes the session. canopy-web revokes its own session through RFC 7009 revocation at
POST /identity/revoke; revocation by an administrator is I2e’s. -
F9. Profile pairing and deadlines. A profile’s
claims_fromandrefreshmust name the same source (id_tokenwithreissues_id_token,userinfowithuserinfo); the profile parser refuses both mixed pairings. A token-exchange request has one absolute deadline, 13 s from its start, with a 3 s audit reserve. The form, client authentication and a renewal’s session read finish within 2.5 s of the start; at most three sequential upstream calls follow (discovery, the JWKS and userinfo), each bounded by the upstream client’s 2.5 s; the final transaction, or a refusal’s log row, runs in the reserve. The deadline is checked at compile time and exported for canopy-web. The upstream key cache runs each fetch in a task it owns, so neither a caller’s deadline nor a dropped request cancels a fetch, whether the validator’s key lookup or userinfo’s endpoint lookup started it.
Amendment 7 (2026-10-05, #2720) — delegation tokens and receivers
Status unchanged (still Accepted).
Plan I2d builds D3’s delegation
tokens: canopy-web mints a per-target token from a web session, and a
service delegates onward from a subject token addressed to it, extending
the act chain and never widening. Receivers validate the tokens, senders
request them with per-request reuse, and every mint checks the session and
is audited before release. It records ten decisions. G3 fixes the floor
D3’s lifetime needs to outlive its audit; G5 states how D6’s freshness and
D12’s checks are read at a mint; G10 adds the per-client limit D12’s
client disablement leaves open:
-
G1. The grant’s wire shape. RFC 8693 token exchange at the token endpoint, requesting
urn:ietf:params:oauth:token-type:access_tokenfor exactly oneresourcenaming a compiled receiver (A3), optionally withrequested_rolesandrequested_programs. A session form presents a web-session credential, and only canopy-web may use it; an onward form presents a delegation token of at most 8 KiB, and only a confidential client that runs as a service (B2) may. After authentication the form is identified byrequested_token_type, thensubject_token_type; a client not allowed that form isunauthorized_clientbefore its other parameters are judged; then the grammar; then aresourcethat is no receiver, or a target the client has no delegation edge to (B3), isinvalid_target; only then is the subject read. A delegation form refusesscope,audience,actor_token,actor_token_typeand everyupstream_*parameter; a federation form refusesresourceand bothrequested_*. Delegation is served whenever the issuer is configured, with or without an upstream profile, since a session outlives its profile, so the metadata always lists token exchange and a federation request with no profile isinvalid_request. -
G2. The answer. RFC 8693 §2.2.1: the token,
issued_token_typethe access-token type,token_typeBearerandexpires_in, with no refresh token and noscope. A subject-token or session defect isinvalid_request, wideninginvalid_scope, an unavailable store or key set 503. A refusal the sender must act on carriescanopy_refusal:session_ended,subject_suspended, orsession_stale, on which canopy-web renews the session and retries. -
G3. Claims and lifetime. Amendment 4’s B5 layout.
expis the least ofiat+ 300 s, the subject token’sexpand the session’s end. A mint is refused when that leaves under 5 s: the audit commits within 3 s of the mint, so a released token keeps at least a second, andexpires_inis computed when it is released.sub,sidandauth_timeare the session’s.actis[canopy-web]from a session; onward, the client before the subject’s chain, refused when it already appears (B6) or the chain would passMAX_ACT_DEPTH. -
G4. Narrowing. The base is the session’s current roles and programs from a session; onward, the subject token’s intersected with the session’s current, so a renewal’s narrowing reaches the next hop at once. A requested set, space-separated in any order and held sorted, must lie within its base, else
invalid_scope; an absent one takes the base; an empty base isinvalid_scope. -
G5. The session at every mint. One read gives the session, its latest validation, its revocation and its subject’s latest suspension. It refuses, in order: no session, a revocation or an end that has passed (
session_ended); an opener other than the chain’s innermost actor, or a subject other than the token’s; a suspended subject (subject_suspended); a freshness that has passed (session_stale). A suspension or revocation committing during a mint stops the next one; the token it races stays acceptable for at most D12’s 420 s. -
G6. The subject token, onward. Verified in process against the JWKS with the receiver’s rules for the client’s own service, so D5’s audience binding and the subject’s last hop hold, under the mint’s deadline. The log records the subject’s
jti, so every hop’s row points at its parent’s. -
G7. The issuance log, version 3. The log gains
subject_token_jti,rolesandprograms, and adelegationgrant whose issued rows carry the token, the session and what it granted. v2’s per-grant rules are restated to bind versions 2 and 3; v1 and v2 rows stay as history. -
G8. Receivers. A receiver’s validator is built for its compiled service. A delegation token passes when its JOSE form,
typ, key and signature verify, its claims are B5’s, itsissandaudare exact, its lifetime is 1–300 s within D9’s leeway, and its current actor has a delegation edge to the receiver. One entry point answers either a system token or a delegation token, verifying once. -
G9. The sender. A delegation source mints a fresh assertion per call. Its cache is made by the source, lives one request (ruling R4), and is keyed by the subject credential and the normalized request. The source compares a returned token’s
expwith its subject’s, two times on the issuer’s clock, keeping D3’s sender-side check without a local clock. -
G10. Budget and limits. A mint’s processing ends by the token exchange’s first phase (2.5 s) and its audit within 3 s more: a 5.5 s budget exported for senders, with no upstream call. Every token-route request spends from its client’s per-replica budget after authentication (a registry setting, default 6000 a minute); past it the answer is a logged 429. The revocation route spends nothing. The per-IP limiter’s 429 stays unlogged (Amendment 3, A6).
As built (2026-10-06, !1572). The ten decisions hold as written; the build adds this precision:
-
G1. The federation forms' profile check follows the client check, as I2c’s did; the onward form admits any confidential client whose
service()is set. -
G6. The subject token is verified by the receiver’s own validator for the client’s service, over canopy-security’s in-process source on the JWKS route’s memo, by the first phase. A set that is unavailable or has not answered by then is a 503 (
subject_keys_unavailable); a rejection isinvalid_requestundersubject_token_and the validator’s rule. A subject past itsexpbut inside the 60 s leeway verifies and is then refused by G3’s floor (subject_expiring). A refusal after the subject verifies logs itsjti. -
G9. The caller makes a cache per request from its source, and a source refuses another’s (
ForeignCache); an entry is served while itsexpis more than 5 s ahead of the sender’s clock, the cap itself comparing issuer-clock times only. -
G10. The budget is spent right after authentication, before
requested_token_typeis read, so a limited token exchange is logged astoken_exchangewhatever its form (G7’s boundary).rate_limit_rpmis a YAML integer from 1 to 600 000; any other value, an explicit null included, refuses the boot. -
Proof. canopy-security’s
tests/identity_delegation/end_to_end.rsopens a session by federation, mints through canopy-auth’s sender for three hops, validates each at its receiver over the published keys, and sees canopy-web’s revocation refuse the next hopsession_ended.
Amendment 8 (2026-10-06, #2729) — security administration
Status unchanged (still Accepted). Plan I2e builds D12’s admin routes: suspending and lifting subjects, revoking sessions, disabling clients at runtime, re-linking upstream identities (D8, F7) and revoking keys, under D6’s step-up. It records eight decisions. H6 replaces A7’s restart-scoped client disablement, and H4 narrows F3:
-
H1. The surface. Routes under
/identity/admin/, outside/v1, the Keycloak bearer middleware and the OpenAPI document: JSON in (at most 4 KiB), RFC 9457 problem details out, a per-IP limit of 60 a minute, a 5 s budget per request, and 503 while the issuer or the admin login is unconfigured. Every write creates its action record (H4), so each answers201 Createdwith{action_id, changed};changedis false when the state was already so. Reads give a subject by its upstream pair, a subject’s effective links, suspension and sessions, every compiled client’s registration and status, and every published key. -
H2. Who may call. A canopy-identity delegation token for canopy-security, as a bearer. It is validated as a receiver of canopy-security validates it (G8); its session is re-read and judged as a mint judges it (G5), and every client in its chain must be enabled and not runtime-disabled, so an administrator’s revocation or suspension ends their administration at once; it must carry the
security_adminrole, which the IdP emits by that exact name (the profile translates no names); and itsauth_timemust be at most 600 s old (D6’s step-up), else 401 with RFC 9470’sinsufficient_user_authenticationandmax_age=600. A missing bearer gets a bareBearerchallenge, a refused oneinvalid_token, a missing role 403insufficient_scope. -
H3. The admin login.
canopy_identity_admin, a separate least-privilege login: EXECUTE on the admin functions only, SELECT on what the routes read, no direct write. The issuer can call no admin function, and its ownidentity_revoke_sessionrefuses any reason but its five, so no change recorded as an administrator’s can be made through the issuer’s SQL privileges. The separation does not stop a stolen issuer credential at the HTTP layer: that credential can publish keys and forge any token (D9’s accepted cost), a security administrator’s included. Each change made with a forged bearer still records the token’skid, which the compromise response reviews once it has revoked the keys. Administration depends on the issuer (minting, the JWKS memo, session reads), so while the issuer login is shut out the routes are unavailable and recovery is SQL as the migration identity. -
H4. Every change audited with it. An INSERT-only
identity_admin_actionsrow (action, target, the actor’s subject, session, token jti, token kid and client, reason,changed) is written by the same owner function, in the same transaction, as the change it records. Each admin function runs only under READ COMMITTED. This narrows F3: an admin change commits its action row, not an issuance-log row; the issuance log stays the issuer’s record. -
H5. Suspension and session revocation. Suspend and lift go through F8’s writers, the actor’s subject as the actor; a repeat writes no event. An admin revocation has its own reason,
admin, and names the client the administrator came through. -
H6. Runtime client disablement. INSERT-only disablement events, the latest winning, read by every client authentication through a memo at most 5 s old that never serves an older set after a failed read. A disabled client is
invalid_client(client_disabled) after its assertion verifies and before its jti is spent. The registry’senabled: falsestays absolute. A disablement takes effect within 5 s on every replica; tokens already minted stay acceptable within D12’s bounds. -
H7. Re-linking. INSERT-only relink events make a pair’s effective link its latest relink, else its first link, which the open reads. A transaction advisory lock per pair, exclusive for a re-link and shared for an open, orders the two: an open waits for an in-flight re-link and opens as the new subject, and a re-link waits for in-flight opens and revokes the pair’s live sessions (
relinked). A subject holds at most one effective link per issuer. No subject is created by a re-link, so D8’s seed links are I3’s. -
H8. Key revocation. By route, through
identity_revoke_key, the actor’s subject as the actor and the admin login asrevoked_by. The JWKS drops the key within its 5 s memo and receivers within their refresh (D9). A replica keeps signing with its own revoked key until it rotates (#2738); the runbook restarts it. The issuer-credential compromise response is unchanged.
As built (2026-10-06, !1573). The eight decisions hold as written; the build adds this precision:
-
H1. The client and key lists answer
{clients: […]}and{keys: […]}; the key list shows the keys still in their publish window, revoked or not, at most 128. A path id must be a canonical lowercase hyphenated UUID, a client a compiled confidential client’s exact id (else 404client_not_found), a kid the registry’s thumbprint shape (else 400kid_invalid). No 4xx echoes its input or records an action. A write’s log line names its target by canopy id, client id or kid astarget_id, since the JSON formatter ownstarget. -
H2. The bound is
SECURITY_ADMIN_MAX_AGE_SECONDS: i64(600). The refusals carry codes:token_missing,token_malformed,token_rejected,session_ended,session_refused,client_disabled,insufficient_scopeandinsufficient_user_authentication; the 503sadmin_unconfigured,keys_unavailable,session_store_unavailableandclient_status_unavailable. -
H6. The memo is a
ClientStatusasked with the caller’s deadline, counting its 5 s from when its read was sent.ClientAuthenticator, the token endpoint’s and the admin routes' parts all require one, so nothing defaults to "none disabled"; the check sits once the assertion verifies, in the authentication the three paths share. The SQL path that re-enables canopy-web records the nil session, a fresh jti and the all-zero kidrepeat('A', 43), since every action names an actor. -
H7. The effective subject is read inline in each function, adding no helper; each relink names its action; the open takes the pair’s shared lock too, so it holds when called on its own; the action table checks the pair’s shapes. The re-link reads the pair’s effective subject once before the subject locks, to learn which to lock, and again after them.
-
Proof. canopy-security’s
tests/identity_admin/end_to_end.rssigns a security administrator in by federation, takes canopy-web’s delegation for canopy-security through canopy-auth’s sender, and observes each write at the token endpoint: a suspension, a session revocation, a re-link, a client disablement and a key revocation; a caseworker is refused 403 and an 11-minute-old sign-in the RFC 9470 challenge. The races of H7 are proven at the store, each test failing with its lock removed.
Amendment 9 (2026-10-06, #2740) — native clients
Status unchanged (still Accepted). Plan I2f builds D7’s issuer side: RFC 8628 device authorization for canopy-cli, approval in canopy-web under D6’s step-up, the native session’s revalidation through canopy-web, and its DPoP-bound (RFC 9449), rotating refresh credential. canopy-web’s pages and re-federation loop, canopy-cli’s client and edge forwarding stay plan I3’s. It records eleven decisions. N4 adds a D5 row, N7 adds a third exact-header validator beside A9’s two, and N9 narrows D6’s last sentence:
-
N1. Device authorization (RFC 8628 §3.1–3.2). A form at
POST /identity/device_authorizationon the token router, from a native client by itsclient_idalone. The device code is 32 CSPRNG bytes; the user code is 8 symbols uniform over 20 consonants (about 34.6 bits, §6.1), shownXXXX-XXXXand read case-insensitively; both are stored as SHA-256. They live 600 s, the polling interval is 5 s, and noverification_uri_completeis given (§5.4). The flow is served only with the issuer, an upstream profile and the verification URI configured, and spends only the per-IP limit. -
N2. Code entry (§5.1, §5.4).
POST /identity/device_verification, canopy-web only, carrying the worker’s web-session credential:describenames the device’s client and start time for D7’s approval screen, anddenyrecords a denial. Every describe, denial and approval spends one per-replica budget of 10 attempts per 10 minutes keyed by the worker’s upstream(iss, sub). An unknown, expired or decided code, or one whose client is disabled, is one refusal,user_code_invalid. -
N3. The device-approval grant (D6). canopy-web’s RFC 8693 exchange for the token type
urn:canopy:params:oauth:token-type:native-revalidation, presenting the step-up id_token and the user code. The id_token is verified as a federation open verifies it (C7–C9) and itsauth_timemust be at most 600 s old. One transaction then links or mints the subject (F7), opens a native session (kindnative, opener canopy-cli, B5) ending atauth_timeplusidentity_native_session_max_seconds(default 28 800, 1800 to 86 400), and records the approval; any refusal rolls it all back. -
N4. Revalidation. The native revalidation credential, 32 CSPRNG bytes, is the session’s stored credential. canopy-web alone presents it, by
private_key_jwt, to renew the session (F5), hold it in grace (F6) or revoke it; it mints nothing. D5 gains the row: native revalidation credential, verified against its hash in the session store, presented only by canopy-web, which holds the session’s dedicated upstream grant. D6’s freshness gates every native mint. A session approved but not redeemed when its device code expires is revoked (unredeemed) at canopy-web’s next renewal. -
N5. Redemption (§3.4–3.5). canopy-cli’s device_code grant, with a DPoP proof and a
resource, binds the session to the proof’s RFC 7638 thumbprint and returns refresh credential version 1 and a delegation token (act [canopy-cli],token_type: Bearer, RFC 9449 §5). A redeemed code presented again revokes its session. A poll under 5 s after the device’s last poll not itself slowed is answeredslow_down; the cumulative interval is the client’s duty. -
N6. The refresh grant (RFC 6749 §6, RFC 9700 §4.14.2). The current version rotates under the session’s lock and mints a delegation token for the
resource(G3’s bounds; narrowing narrows the token only). A superseded version under the bound key revokes the session; a proof under another key is refused and revokes nothing. -
N7. DPoP proofs. Header exactly
typ: dpop+jwt,alg: ES256and an EC P-256 publicjwk; claims exactlyjti,htm: POST,htuandiat;athandnoncerefused. At most 2 KiB;htuequals the public token endpoint after RFC 3986 §6.2.2 and §6.2.3 normalization;iatwithin 60 s;jtisingle-use per thumbprint across replicas. ADPoPheader is ignored everywhere but the two native grants. -
N8. Native revocation (RFC 7009). The revocation route also serves canopy-cli as a public client, by any version of its refresh credential, and canopy-web by a native session’s revalidation credential. D2’s forwarded endpoints gain the revocation route.
-
N9. Disablement, budgets, administration (D12, G10). Runtime disablement covers canopy-cli, and every native grant refuses a disabled one. canopy-cli has one per-replica budget,
identity_native_rate_limit_rpm, spent once a poll’s or refresh’s credential is found. The admin guard keeps refusing native actors: security administration stays canopy-web’s, so a native session never administers, even within 10 minutes of its approval. -
N10. Issuance log version 4. Grant types
device_authorization,device_verification,device_codeandrefresh_token; outcomesdescribedanddenied; columnsdevice_idandrefresh_version. Every native state change commits its row in its transaction (F3), and every poll’s answer is logged (D13). -
N11. Budgets and pool. Device authorization, verification and native revocation have 5 s; approval and native renewal F9’s 13 s; redemption and refresh
NATIVE_BUDGET, equal toDELEGATION_BUDGET(5.5 s). The issuer pool grows from 18 to 22. Redemption and refresh are served with or without an upstream profile, as delegation is (G1).
As built (2026-10-06, !1574). The eleven decisions hold as written; the build adds this precision:
-
N1. The form takes
client_idalone.scope,resourceor a client assertion is refused (parameter_refused, one cause the token exchange’s refused parameters now share); another client isclient_not_native, and a disabled canopy-cliclient_disabled. The store draws at most three user codes (USER_CODE_DRAWS) and answers 503 when every one is taken. The URI setting isidentity_device_verification_uri, a malformed value refusing the boot by name, and the metadata listsdevice_authorization_endpointwhile the flow is served. -
N2. The budget is a quota of 10 per 10 minutes: 10 attempts at once and one more each minute, so at most 20 in any 10 minutes, a logged 429 with
Retry-Afterpast it (user_code_attempts_exhausted). An approval keys it by the verified id_token’s issuer and subject as the worker’s web sessions store them. Each refused user code logs its own reason (user_code_malformed,user_code_unknown,user_code_expired,user_code_decided,device_client_disabled), and the worker’s web session must be live, fresh and unsuspended. -
N3. The approval verifies the id_token (and calls userinfo), then holds the 600 s bound (
auth_time_too_old), spends the attempt, reads the user code and checks canopy-cli’s disablement, in that order, before the store’s transaction. The answer is F2’s body under the native-revalidation type. -
N4. The unredeemed rule runs in a native renewal’s first phase, before any upstream call, its refused row committing with the revocation.
-
N5. The slow_down rule runs per replica on governor (a burst of one every 5 s), keyed by the device’s id; a refused poll leaves the device’s last admitted poll in place, and past 4096 devices a replica forgets those not answered within two intervals. A redemption’s order: canopy-cli and its target, the proof, the device, slow_down, the budget, the proof’s
jti, the device’s state, the session (G5’s judgement, so a stale session issession_staleand one ending within 5 ssession_ended), the signature, then the store, byNATIVE_TRANSACTION_END(4.5 s), the last second ofNATIVE_BUDGETkept for a refusal’s row. A native grant’s refusal of its session isinvalid_grantunder its own reason (native_session_ended,native_session_revoked,native_subject_suspended,native_session_stale). -
N6. A refresh holds the credential to the proof’s key before canopy-cli’s budget or the proof’s
jtiis spent, so a mismatched key (dpop_key_mismatch) spends nothing; a refresh’s refused row names the presented version. -
N7. The binding is
Kid::rfc7638of the embedded key, and a spentjtiis kept toiat+ 120 s. The metadata lists both native grants,noneamong the token endpoint’s auth methods, anddpop_signing_alg_values_supported: ["ES256"]. -
N8. canopy-cli names itself by
client_idwith neither assertion parameter; any other public client isinvalid_client(client_not_native) and a disabled canopy-cliclient_disabled. It needs no proof and spends no budget, since revoking only ends access. canopy-web’s revocation reads a native session by its revalidation credential after a web read finds none. The metadata addsnoneto the revocation endpoint’s auth methods. -
N9. Every native route asks the client status for canopy-cli directly;
GET /identity/admin/clientslists canopy-cli asnative, never registered. -
N10. A version-4 row of an earlier grant is held to version 3’s rules by the CHECKs restated for it.
-
Proof. canopy-security’s
tests/identity_native/end_to_end.rsdrives the lifecycle in process: a device flow started and described, polled pending then slowed, an 11-minute step-up refused and a fresh one approving, a DPoP redemption whose token verifies at its receiver over the published keys, a refresh for another target, an onward hop by canopy-eligibility, a native renewal, a superseded credential revoking the session, and canopy-web’s next renewal answeringsession_ended; a second test logs canopy-cli out. The store’s races are proven against the database, each test failing with its lock removed.
Amendment 10 (2026-10-07, #2752) — the capacity model and production sizing
Status unchanged (still Accepted). Plan I2g keeps D2’s promise that a capacity test runs before the cut-over, and sizes canopy-identity for plan I3, whose routing rule (B4) makes every call inside a worker’s request on that user’s data a delegation, reads included. It records ten decisions. P2 and P3 turn two constants into settings, P5 adds the first request-latency instrument, and P7 gives reopen trigger 1 a measure:
-
P1. The design load model. I3’s design point is the busy hour of Georgia’s statewide workforce on canopy; the peak is twice it. Every assumption is a flag of the harness (P6), so a deployment re-runs it with its own figures. Limits are sized for the peak with one replica down (R − 1).
Assumption Design Basis workers signed in at the busy hour
3000
the eligibility workforce across I3’s programs; UAT 150
requests a minute per worker
3
pages, htmx fragments and writes
distinct targets per request (fan-out)
3
case pages reach 4–6 services, fragments 1–2; R4 reuse removes repeats
onward hops per session-form token
0.3
eligibility’s orchestration; applications to persons
renewal interval
300 s
a 5-minute upstream access token (D6 caps it at 900 s)
opens, logouts, system tokens per second
5, 2, 1
half the workforce signing in over 5 minutes; system tokens cached 300 s per (client, purpose) per pod
Fleet-wide, the design point is about 600 requests a second: 450 session-form delegations (workers × requests × fan-out / 60), 135 onward delegations, 10 renewals, 5 opens, 2 revocations and 1 client-credentials grant. The peak is about 1200. canopy-web’s share at the peak is 934 a second (session-form delegations, federation and revocation).
2026-10-08: R − 1 is now two replicas carrying the peak, at a minimum of three replicas; see Amendment 13 T1.
-
P2. Per-IP limits are a backstop. Authenticated callers are bounded by their per-client budgets (G10, N9), anonymous internet traffic by canopy-web’s edge limit on the routes it forwards (D2). The token, revocation and device-verification routes take the setting
identity_token_rate_limit_rpm(1 to 600 000, default 30 000), at least 60 × canopy-web’s peak rate / (pods × max(R − 1, 1)), 28 020 for two pods and two replicas. Device authorization creates a row from aclient_idalone and its legitimate rate is a person’s, so it has its own limiter of 30 a minute. Each route sits under exactly one limiter, and both stay process-local: a shared counter would add the Redis dependency D2 forbids. -
P3. The issuer pool is a setting,
identity_db_max_connections(12 to 64, default 22). The floor is six background connections (the log writer, two sweepers, the key ring, the JWKS memo, the client status) and six for requests. canopy-security’s connections per replica on its own database are then 40: main 10, issuer 22, admin 4, archive worker 2, idempotency lease 2 (42 with the chain-v2 audit verifier). -
P4. Per-client budgets. The 6000-a-minute default stays: it covers every client whose peak over R − 1 replicas is under 100 a second. canopy-web’s entry is at least 60 × its peak rate / max(R − 1, 1) (60 000 at two replicas), and the busiest onward caller’s at least 60 × the onward rate / max(R − 1, 1) (18 000). The attempt budget (N2), slow_down (N5) and the admin limit are security bounds and stay.
-
P5. Latency by grant. The histogram
canopy_identity_request_seconds{route, grant, status}(5 ms to 10 s), recorded outside the token routes' limiters.grantis the issuance log’s grant vocabulary,nonebefore the handler knows it;statusisok,refused,limited(any 429) orunavailable(5xx). A limiter’s 429 stays unlogged (A6) but is now counted. -
P6. The capacity harness.
cargo xtask perf identityruns replicas of the token router, built for release, as their own processes on an ephemeral schema, through the issuer’s own login and pool, and drives them open loop (Poisson arrivals, latency from the scheduled start) with the production senders, each source on its own loopback address so the per-IP limiters run as deployed. Each cell runs three repetitions of a 30 s warmup and a 120 s window. -
P7. Reopen trigger 1, measured. Issuance load degrades canopy-security’s other work when G4 fails at the design point in a recorded run, or when, in production, canopy-security’s
/v1p99 over hours whose issuance rate (P5) is at or above the design point exceeds 1.2 × its p99 over hours below it. In the harness that other work is the audit chain’s live write path, the v1 append under the chain lock, at one audited write per signed-in worker a minute, inside each replica’s process. Chain-v2 staging is dormant and is not probed. -
P8. Today’s path, side by side. The harness drives the devstack Keycloak’s RFC 8693 exchange and a client-credentials grant at the same rates. It decides nothing: Keycloak is a dev container, audits nothing before release, and today serves writes only.
-
P9. Gates decide; records follow. Each gate is judged on the median of three repetitions. A failed gate is recorded and filed against the cut-over’s epic, not fixed in the plan that measures it.
# Cell Holds when G1
design, two replicas, audit probe on
p99 ≤ 50 ms for each delegation form, client credentials and revocation; ≤ 100 ms for federation open and renewal
G2
design
no 429, no 5xx; ≥ 99.5 % of scheduled requests answered within the window
G3
peak, two replicas
p99 ≤ 2 × G1’s; no 429; 5xx ≤ 0.01 %
G4
design against the probe alone
audit append p99 ≤ max(1.2 × idle p99, idle p99 + 2 ms); appends achieved ≥ 99.5 % of offered
G5
peak
each replica’s peak RSS ≤ 192 MiB
G6
peak
the issuer pool below its ceiling at every 1 s sample; the jti sweeper keeping up
G7
every cell
release build; generator lag p99 ≤ 5 ms; host CPU ≤ 80 %; the in-flight cap never hit. Otherwise the cell is INVALID
-
P10. Two bounds. The 64-key cap holds about 2R keys plus those of restarts in the last 6 h 12 m that followed a replica’s first rotation plus twice the restarts in the last 22 minutes; a replica restarting about every 10 minutes is an incident. The issuance log’s growth, its measured bytes per row times the model’s rows a day, is weighed against the 3-year audit floor; growth past the deployment guide’s disk within a year is #1303’s.
As built (2026-10-07, !1576). The ten decisions hold as written; the build adds this precision, and the recorded run its numbers:
-
P2. Device authorization’s own limiter is
DEVICE_AUTHORIZATION_RATE_LIMIT_RPM;token_endpoint::routertakes both limits asRouteLimits, each route under exactly one limiter and the cache headers outside both. -
P3. The setting is an
IssuerPoolSize, whichissuer_pool_opts,connect_issuer_poolandidentity::boottake. -
P5. The layer reads the grant from a response extension that
issuederives from what it decided, as the row names it, and the revocation and device handlers set for their own grant; a handler’s own 429 (a spent client or attempt budget) islimitedunder its grant, a limiter’s undernone. -
P6. Each repetition starts a fresh substrate and fleet. A replica reports through a periodic reader flushed on demand (the SDK’s manual reader is experimental). Sessions backing onward subject tokens are never logged out, so the onward hops are not refused for a revocation the model does not intend. A cell that offered no load has no lag for G7 to judge. A replica installs no log subscriber, xtask being a tool (ADR-041 A); the recorded run’s replicas still wrote JSON logs, so its CPU per request includes logging.
-
P7.
--audit-rateis the fleet’s, split evenly between the replicas, each appending throughstore::insert_audit_eventas the schema owner. -
The recorded run (commit
fab5e775e, seed 541770337227324816, one host: AMD Ryzen AI Max+ PRO 395, 32 threads, PostgreSQL 18.6 on btrfs over LUKS, a 1 ms relay; the recordtest-results/perf/identity-20261007T085203Z.json). G2, G3, G4, G5 and G7 held; G1 and G6 failed and are filed against the cut-over:Gate Measured (median of three) Verdict G1
delegation p99 55.1 ms (session), 55.3 ms (onward) at 603/s on two replicas; client credentials 48.4, revocation 41.5, renewal 43.0, open 35.8 ms
FAIL (delegation), #2759
G2
no 429, no 5xx, 100 % answered
PASS
G3
delegation p99 62 ms at 1206/s, the rest ≤ 54 ms; no 429, no 5xx
PASS
G4
audit append p99 3.0 ms under the design load, 4.7 ms with the probe alone; every append committed
PASS
G5
29 MiB peak resident memory a replica (30 MiB the most in any repetition)
PASS
G6
the issuer pool (22) at its ceiling in a median 65 samples; expired jti rows within one sweep
FAIL, #2760
G7
release; lag p99 1.9 ms; host CPU 9–17 %; the cap never hit
PASS
Each replica spent 0.6 ms of CPU a request (0.18 vCPU at the design point, 0.34 at the peak). One replica’s knee was 600 requests a second, the issuer pool its bottleneck, so it did not carry the peak alone. The security database committed about 4.3 times and wrote about 1 KB of WAL a request. The issuance log grew 379 bytes a row at 605 rows a second, about 6.6 GB a working day at the design point, so its retention (#1303) precedes the cut-over. The devstack Keycloak answered the same exchange rate at a 4 ms p99, auditing nothing. The deployment guide’s canopy-security sizing carries these figures and how a deployment re-runs the harness with its own.
2026-10-08: G1 and G6 pass at plan I3b’s defaults; the relay that measured these figures delivered about 3 ms for its stated 1 ms. See Amendment 12's as-built.
Amendment 11 (2026-10-07, #2761) — the cut-over’s staging and the devstack identity plane
Status unchanged (still Accepted). Plan I3a opens stage I3 (epic &133), the cut-over that makes this decision effective. The switch is atomic: canopy-web cannot hold a canopy-identity session and a Keycloak token at once, and the call graph (D4) connects every service, so a receiver or a sender flipped alone is refused by every peer not yet flipped, and only dual trust, which is a shim, would allow a per-service flip. The stage therefore ships as sequential plans: I3a, the devstack identity plane and the token broker; I3b, issuer readiness (#2759, #2760); I3c, receivers; I3d, senders; I3e, canopy-web; I3f, the portal, canopy-cli, the operator tools and the e2e harness; and I3g, the switch. A later plan may re-cut I3c–I3f. Plan I3a records nine decisions:
-
K1. Staging. Until the switch, an I3 plan lands only additive code and devstack infrastructure: library code no service wires, proven in process or against the devstack’s identity plane. The switch is one MR that wires every receiver and sender, moves the battery to the broker (K7) and deletes the Keycloak path. It merges only after the external security review (Consequences), #2759 and #2760. Main never holds a receiver trusting two issuers or a sender holding two credentials.
2026-10-11: Amendment 25's R24 moves the external security review and the issuance log’s retention to a production deployment’s gate; the switch merges once green.
-
K2. Kanidm in the default devstack (ADR-050’s default upstream). The
kanidmservice joins every devstack profile beside Keycloak, which goes at the switch.-
One issuer string holds on the host and in the compose network: the origin
https://idm.canopy.test:<P>, with Kanidm listening on port P inside the network under the aliasidm.canopy.testand published at P like every devstack service. Host-side clients pin the name to the daemon’s published address. -
Its database is a volume.
-
Its TLS is a devstack CA and leaf xtask generates together, valid 365 days and regenerated together within 30 days of expiry. The CA key is dropped once the leaf is signed and never written.
kanidmd cert-generate's 30-day CA cannot outlive a devstack. -
The conformance suite (plan I0) keeps a disposable server of its own,
kanidm-conformance.
-
-
K3. The cast. The devstack Kanidm holds every human worker of the devstack realm but
applicant.test(applicants have no IdP account, D11), plussec.admin, holdingsecurity_admin, the devstack’s first security administrator.-
A person’s Kanidm id is its realm id with the fourth group
0001, and its name its realm username, except the realm’sadmin, which iscanopy.admin, since Kanidm reservesadmin. -
Roles and programs follow the realm, except
fti.auditoranddata.steward, programless there, which hold the realm’s five programs, because federation refuses an empty set (C8).sec.adminholds the same five, andjane.unscopedstays programless, the refusal fixture. -
Passwords and TOTP are provisioned after bring-up, always on an empty Kanidm volume, into a file only the owner can read.
-
-
K4. The devstack issuer’s configuration is generated, never committed, since the repository ships neither file (D10): an ES256 key per confidential client,
identity-clients.yamlregistering each (P4’s budgets for canopy-web and canopy-eligibility), andidentity-upstream.yamlnaming Kanidm’s issuer and the devstack CA. canopy-security mounts them. A service receives its key at the switch. -
K5. Subjects by route, amending H7’s "no subject is created by a re-link" with an action that only creates. A security administrator creates a subject with a given non-nil UUID:
create_subject,POST /identity/admin/subjects. It is audited atomically like every H-family action, under the same guard, and idempotent (changed: falsewhen the subject exists). With H7’s link it is D8’s seed link, and how a deployment adopts subject ids its data already holds. A created subject grants nothing until a link makes it reachable, and both actions record the actor’s token kid. -
K6. The federation client. canopy-auth’s
identity_client::federationis canopy-web’s side of F1 and F2: open, renew and revoke, F2’s answer typed and a refusal read asCanopyRefusal. Its whole-request bound covers the grant’s deadline (F9). canopy-web wires it in I3e. -
K7. The token broker. canopy-test-lib’s
TokenBrokersigns a cast person in through Kanidm with the headless driver, federates as canopy-web with canopy-web’s devstack key, and mints delegation tokens from the session and system tokens with a client’s key: D14’s production grants, with no test-only grant. Sessions are shared across test processes, and one person’s sign-ins are spaced a TOTP step apart. -
K8. Seed links. After provisioning, the bring-up signs
sec.adminin through the broker. For every other cast person whose Kanidm(iss, sub)is not already effectively linked to the person’s realm id, it creates the subject at that id and links the pair to it (K5, H7). A cast worker’s delegation token therefore carries thesubits Keycloak token carries today, which the seed’s assignments already use. -
K9. CI. A prebuilt Kanidm image (ADR-050 §3), content-addressed, pushed from main and pulled by the Docker-in-Docker jobs.
As built (2026-10-08, !1578). The nine decisions hold as written; the build adds this precision:
-
K2. Kanidm’s reserved host port is also its container port (
docker::SAME_PORT_SERVICES). Every devstack bring-up runs in two phases around itsup: the files (the TLS pair, the issuer’s configuration) before, provisioning and the seed links after. A port recovery that moves Kanidm rewrites the upstream profile and restarts canopy-security. -
K3.
SeedPerson::realm_subjectnames a cast person’s realm id, the Kanidm id with its fourth group back to0000. -
K5.
identity_admin_create_subjectrefuses the nil UUID. -
K6. Each request’s bound is
FEDERATION_REQUEST_TIMEOUT, the grant’s 13 s deadline plus 2 s, and every call’s future isSend. -
K7. A session is reused while fresh for 120 s more, else renewed through Kanidm’s refresh, else reopened. A minting grant answered 503 is retried for up to 90 s, because the issuer’s first signing key signs 60 s after it boots. The compose in-network runner reads the broker’s inputs from a volume xtask fills before each run.
-
K8.
TokenBroker::link_castwrites the links, and a second run only reads.cargo xtask dev start,reloadandrestartsample new ports, which moves Kanidm’s issuer, so each links the cast again under the new issuer; the links under earlier issuers stay inert. -
K9. The tag hashes
devstack/kanidm/Dockerfile, anddocker-compose.prebuilt.ymldefaults the image to the source build. validate-in-network’s--with-devstackstill builds it (#2771).
Amendment 12 (2026-10-08, #2777) — issuer readiness
Status unchanged (still Accepted). Plan I3b fixes the two gates plan I2g’s recorded run failed, G1 (#2759) and G6 (#2760), which K1 makes preconditions of the switch. Delegation is sequential, and its tail is the wait for its issuance-log row: one writer gathered for 10 ms after a batch’s first row and then acquired from the shared issuer pool, in the same queue as requests, for a BEGIN, an INSERT and a COMMIT. At 750 requests a second on one replica that writer was starved, and 1764 tokens were refused as unaudited. The harness relay meanwhile delivered about 3 ms for its stated 1 ms round trip. Plan I3b records nine decisions:
-
S1. The writer has a pool of its own: one connection under the issuer login (
canopy-identity-writer), built throughcanopy_db::pool_options()from the issuer’s connect options, which the writer holds across batches, so requests never queue behind a batch and batches never queue behind requests. The per-replica budget gains that connection, and the issuer pool’s background holders drop from six to five. It registers no pool gauges: a held one-connection pool reads size = max permanently. -
S2. A batch is one autocommitted statement,
INSERT … SELECT FROM UNNEST, atomic as one implicit transaction. A6 and D13 are unchanged: a caller is answered only after its row commits, and every failure fails closed. -
S3. The writer never returns its connection to the pool. A connection idle for 1 s or more is pinged within the batch’s deadline before use. After any failure it is detached, which frees the pool’s slot at once, and closed within 1 s or dropped, so neither the #2538 release check nor sqlx’s release ping, both unbounded network calls, can hold the only slot.
test_before_acquirestays on. -
S4. The gather window runs from the batch’s oldest row (a row that has already waited it goes in the next batch at once) and becomes the setting
identity_issuance_gather_ms, 0 to 20 ms. -
S5. The writer reports its queue wait,
canopy_identity_issuance_queue_wait_seconds, from a row’s submission to its batch’s start; the commit histogram runs from that start to the statement’s end; both get millisecond buckets. -
S6. The harness relay delivers the round trip it states. It sets TCP_NODELAY and releases chunks from a timer thread. Over a window, each direction’s holds must have a median of at least half the stated round trip and a p95 at most half plus 0.25 ms, judged on the worst replica; otherwise the repetition, or the saturation step, is invalid (G7). The as-built reports a reconstruction of the round trip Amendment 10’s recorded run got.
-
S7. The record keeps what sizing needs: the effective settings and the relay’s round trip; each window’s pool in-use maximum, mean and at-ceiling count at 1 s and 10 ms; the writer’s commit, batch-size and queue-wait buckets; issuance failures by cause. The saturation cell runs the peak as a step of its own, and "carries the peak" is read there.
-
S8. Defaults come from stated rules, the gather window’s and the issuer pool’s (plan I3b’s Rule G and Rule P). The pool’s bounds stay 12 to 64.
-
S9. Scope under K1. K1’s additive-only rule binds the cut-over’s receivers and senders; I3b changes only the issuer canopy-security already serves, which no caller uses until the switch. Unchanged:
test_before_acquire(except under the plan’s triggered F2), the release check on every other connection,synchronous_commit=on, and the order jti before session (Amendment 7’s G1 and G10).
As built (2026-10-08, !1580). The nine decisions hold as written; the build adds this precision, and the recorded runs their numbers:
-
S1–S3.
WriterPool::lazytakes the issuer’s connect options, so the writer’s connection carries the login, TLS and the 5 s timeouts under its own name;registry::writer_poolbuilds it from the issuer pool. A disposal detaches the connection before the batch’s callers are answered and closes it on a task of its own; shutdown awaits the close, so the writer’s finish allows 4 s. Under autocommit a statement that reaches the server commits even past its deadline, which only stops the writer waiting for the answer: a row for a caller told it failed, the case A6 already allows, never the reverse. -
S4. The window runs from the batch’s earliest submission, not its first queued row, since a caller stamps its row before waiting for room; once the window has passed no later row joins.
-
S5. The commit histogram starts where the queue wait ends, so it includes the connection’s check or opening.
-
S6. One hold count per direction, shared by the relay’s connections; quantiles are integer per-mille ranks compared in whole microseconds; a saturation cell stops at, and reports, a step whose relay is off. The old relay, re-run at commit
a50f6b978(one design repetition, the recordtest-results/perf/identity-20261008T124435Z.json), delivered a 3.05 ms p50 and 4.45 ms p95 round trip for its stated 1 ms, with delegation p99 55.1 and 55.4 ms, Amendment 10’s own figures; the new relay on the same code 1.15 ms and 28.4 and 28.6 ms (…T125344Z). Most of #2759’s margin was the harness. -
S7.
RunSettingsalso records the gather window;acquire_testreadsalwaysoroff, F2 not having landed. -
S8. Rule G and Rule P ran at commit
c4e49c025, seed 541770337227324816, on Amendment 10’s host, which another project’s devstack and test battery shared through the day. G7 sees CPU, not disk, so a disk stall can leave a cell valid; each run disturbed that way was re-run and is listed below. Rule G chose 2 ms and Rule P 28 (F1 and F2 not triggered);GatherWindow::DEFAULTandIssuerPoolSize::DEFAULTcarry them from commitfda1f7082. -
The attribution chain (median of three; design 603/s and peak 1206/s on two replicas, saturation on one; records under
test-results/perf/):Run (commit, window, pool) Design delegation p99, session / onward Peak delegation p99 G6 Saturation (one replica) Amendment 10’s run (
fab5e775e, 10 ms, 22, the old relay)55.1 / 55.3 ms
62 ms
fail
knee 600/s, collapsed at 750/s
Baseline (
3ecb7fd05, 10 ms, 22)28.7 / 29.0 ms
28.8 ms
pass
knee 300/s: the writer starved for its connection at 450/s, the host disturbed
After S1–S3 (
678c5031e, 10 ms, 22)23.3 / 23.5 ms
22.0 ms
pass
knee 1800/s, carries the peak
Rule G (
c4e49c025, 10 / 5 / 2 / 0 ms, 22)20.3 / 20.5, 18.9 / 19.3, 12.4 / 12.7, 10.5 / 10.9 ms
—
—
—
Rule P (
c4e49c025, 2 ms, 22)—
14.5 ms
pass
knee 1050/s: the pool full at 1200/s
Rule P (
c4e49c025, 2 ms, 28)—
13.7 ms; 12.3 ms re-run
pass
600/s on a disk stall (commit p99 100 ms), re-run: knee 1650/s, carries the peak
Final (
fda1f7082, 2 ms, 28, no overrides)12.4 / 12.8 ms
15.1 ms
pass
knee 1050/s: the pool full in bursts at 1200/s; the one re-run 750/s, the same at 900/s
The windows trade a little latency for commits: from 0 to 10 ms the writer’s batch grew from 1.3 to 4.2 rows and the database’s commits fell from 3087 to 2769 a second at the design point; WAL stayed near 0.6 MB/s. After S1–S3 the writer’s commit p50 fell from 7.5 to 2.0 ms (one statement on a held connection, no acquire, BEGIN or COMMIT).
-
The final run (commit
fda1f7082, the defaults, no overrides; the recordtest-results/perf/identity-20261008T203743Z.json; its saturation re-run…T205918Z):Gate Measured (median of three) Verdict G1
delegation p99 12.4 ms (session), 12.8 ms (onward) at 603/s on two replicas; client credentials 9.7, revocation 16.0, renewal 17.9, open 15.8 ms
PASS
G2
no 429, no 5xx, 100 % answered
PASS
G3
delegation p99 15.1 and 15.4 ms at 1206/s, the rest ≤ 22.5 ms; no 429, no 5xx
PASS
G4
audit append p99 2.9 ms under the design load, 4.5 ms with the probe alone; every append committed
PASS
G5
29 MiB peak resident memory a replica
PASS
G6
the issuer pool (28) never at its ceiling in a one-second sample (at it in a median 21 of the 10 ms samples, summed over both replicas); expired jti rows within one sweep
PASS
G7
release; lag p99 ≤ 1.2 ms; host CPU 10–17 %; every relay within its bounds (1.15 ms round trip); the cap never hit
PASS
carries the peak
one replica gave out at 1200 requests a second, a step short of the peak’s: the issuer pool filled in bursts (in 303 of the step’s 10 ms samples) though it averaged 13.5 of its 28 connections, and p99 reached 753 ms; the writer kept up (queue-wait p99 7.5 ms, no failures). The one re-run gave out at 900/s the same way. Across the five single-replica runs on the writer’s own connection at pools of 22 and 28, the disk-stalled one aside, the knee ranged from 750 to 1800/s
FAIL, #2760
Each replica spent 0.58 ms of CPU a request (0.17 vCPU at the design point, 0.35 at the peak) and held an issuer connection about 10.5 ms a request. The security database committed about 4.9 times and wrote about 1 KB of WAL a request. The devstack Keycloak, informational, answered the exchange rate at a 3.6 ms p99, auditing nothing and reached with no relay. At a 3 ms round trip (informational;
…T205118Z, the host disturbed, CPU 31 %) design delegation p99 was 41.7 and 42.5 ms, client credentials 28.2, renewal 71.9, open 58.0 and revocation 75.8 ms. G1 (#2759) and G6 pass; one replica carrying the peak alone does not, so the switch (K1) still waits on #2760, which now names the issuer pool’s bursts under one replica’s load, not the writer.2026-10-08: #2760 is closed by Amendment 13's three-replica minimum, the issue’s own alternative.
Amendment 13 (2026-10-08, #2786) — the three-replica minimum
Status unchanged (still Accepted). Amendment 12’s final run passed every G1–G7 gate, but one replica alone did not reliably carry the peak. Across five single-replica runs its knee ranged from 750 to 1800 requests a second, and each give-out had the same shape: the issuer pool filling in bursts while it averaged under half its connections, with the writer and CPU healthy. One give-out was an 8 s WAL-flush stall on the shared host’s disk. The others left no trace in the writer’s commits, and the record judged the harness’s relay only to its p95. Two replicas at the peak, the one-down case at three replicas, passed G3 and G6 in every valid run, with the pool averaging about 6.5 of its 28 connections. #2760 allowed either answer: "one replica carries the peak, or the guide’s replica count rises to one that does". The maintainer chose both, staged: plan I3b2 closes #2760 on the second now and widens one replica’s margin without blocking. It records five decisions:
-
T1. Minimum three replicas. R − 1 is two replicas carrying the peak, which the peak cell measures (G3, G6). The saturation cell stays informational: one replica’s knee is recorded, not gated. This replaces the one-replica reading of R − 1, which came from P2 and P4’s arithmetic at R = 2 and from plan I3b’s maintainer call. A deployment runs
max(3, ⌈peak ÷ 603⌉ + 1)replicas. -
T2. The defaults stand: the issuer pool at 28 and the gather window at 2 ms. P2’s rate-limit defaults, sized at R = 2, are conservative at R = 3. At plan I3’s peak, with two canopy-web pods, the per-IP limit needs 14 010 (default 30 000), canopy-web’s registry limit 28 020 (60 000) and the onward caller’s 8 100 (18 000). The pool stays 28 because plan I3b2 measures one replica against it.
-
T3. The issuer pool tests a connection only once it has idled 1 s or more, through sqlx’s
before_acquireand a canopy-db pool option. That saves about two round trips a delegation. The admin pool and the writer keep their own tests. This amends Amendment 12 S9. After a database restart or failover, a broken connection idle under 1 s is lent and the operation on it fails (503) instead of being replaced. When that operation is a shared memo’s single-flight read, such as the client-status or JWKS memo, every caller waiting on it fails with it, admin requests included. sqlx closes a broken connection on release, so each one fails once, within the failover window. -
T4. G7 sees past p95, and the disk. Each relay direction’s p99 must be at most half the stated round trip plus 1 ms. The host’s IO pressure over the window (
/proc/pressure/io'sfulltotal) must be at most 1 % of it, a bound plan I3b2 calibrates from healthy windows only, capped at 5 %. An unreadable PSI is not judged. One G7 predicate judges both cells and saturation steps. The record keeps each direction’s p99, its holds at or past the 7 ms bucket limit, and both IO-pressure shares. This amends Amendment 12 S6. -
T5. K1’s preconditions. #2759 and #2760 are closed. The switch still waits on I3c–I3f, the external security review, and retention or archival of the issuance log (#1303), which the deployment guide makes a cut-over prerequisite.
2026-10-11: Amendment 25's R24 moves the external security review and the issuance log’s retention to a production deployment’s gate; the switch merges once green.
As built (2026-10-09, !1581 and !1582). The five decisions hold as written. The build adds this precision, and the recorded runs their numbers:
-
T1. !1581 closed #2760 on the three-replica minimum.
-
Renewals (#2785). A renewal now draws from a rotation: a session is marked renewed in the second its turn is taken, and a newly opened session joins behind those already renewed. When every live session was renewed in the current second, a renewal waits for the next. The record counts those waits (
renewals_waited), which were 0 in every run. -
T3. The setting is canopy-db’s
AcquireTest::IdleFor(1 s).DbPoolOpts::to_pool_optionsbuilds the pool options thatconnect_withuses. A server-ended connection fails at once, so of several concurrent callers only those already waiting on the failed read share its failure, and later ones read afresh: one operation fails per broken connection. Each request’s issuer connection time fell from 10.5 ms to about 8 ms at the design point (7.95 ms) and 8.3–9.2 ms at the peak, the two round trips predicted. -
T4. One predicate judges every repetition and every saturation step by all of G7’s conditions. The IO bound was calibrated from healthy windows to 2.25 %, twice the 1.127 % that the peak cell’s own load reached (rounded down): the 1 % first set was exceeded by canopy’s own peak. A window’s PSI average cannot see a stall of a second or two. One saturation step gave out at 750/s under such a stall (IO
full1.02 %, 9 relay holds past 7 ms, 4 commits over 100 ms) and still counted as valid. The record keepsover_limitand the writer’s commit buckets for reading such steps. -
The readiness runs. Seed 541770337227324816, on Amendment 10’s host, which another project’s devstack and battery shared:
-
The first run (
test-results/perf/identity-20261008T232849Z.json) was INVALID on the then 1 % bound. Its peak cell’s healthy windows set the calibration. One design window, disturbed (IO 2.60 %, a 411 ms p99), stays INVALID under the new bound. -
The restarted run (
…T001248Z) gave the design cell. Its peak cell was INVALID at 4.10 % IO, and the re-run (…T005429Z), started once the host had quieted, gave the peak cell:Gate Measured (median of three) Verdict G1
delegation p99 12.5 ms (session and onward) at 603/s on two replicas; client credentials 11.5, revocation 19.3, renewal 19.7, open 19.5 ms
PASS
G2
no 429, no 5xx, 100 % answered
PASS
G3
delegation p99 37.4 and 37.3 ms at 1206/s (one repetition 88 ms, one 10 ms), the rest ≤ 62 ms; no 429, no 5xx
PASS
G4
audit append p99 5.1 ms under the design load, 4.2 ms with the probe alone
PASS
G5
29 MiB peak resident memory a replica
PASS
G6
the issuer pool (28) never at its ceiling in a one-second sample; expired jti rows within one sweep
PASS
G7
release; lag p99 ≤ 1.4 ms; host CPU ≤ 21 %; every relay within its median, p95 and p99 bounds; IO
full0.94 % and 1.23 %, within 2.25 %PASS
-
-
One replica, informational.
…T002409Zheld to 1200/s at about 11 ms p99, then its peak step was INVALID (IO 3.42 %).…T003050Zgave out at 750/s under the short stall above.…T003403Zwas INVALID at its first step. The issuer pool’s short bursts persist with two replicas too: the peak re-run’s first repetition was full in 282 of its 10 ms samples, though in no one-second sample. Neither the relay’s tail nor IO pressure, as G7 now reads them, explains them, so their source is filed (#2790).
Amendment 14 (2026-10-09, #2792) — receivers
Status unchanged (still Accepted). Plan I3c builds canopy-identity’s receivers: a principal, a composable guard, the axum layer that authenticates a bearer and inserts the principal, a key refresher, and receiver settings. None of it is wired until the switch (K1). It records seven decisions. L3 adds a system token’s counterpart to G8’s last hop, L5 refines D9’s refresh without changing its bounds, and L7 stages the routes the switch must re-authorize:
-
L1. The principal.
Principalis a user, holding theVerifiedDelegationso plan I3d’s sender can delegate onward from it, or a system caller, holding theSystemTokenClaims.-
client()is the system token’s client, or the delegation’s current actor. -
actor()keepsEffectiveUser::actor's signature:Humanwith the canopy subject’s hyphenated form, which K8’s seed links keep equal to the realm ids that rows already hold, orServicewith the client id. -
attribution_sub()gives the string the existing string consumers write (idempotency keys, ledgers, export and FTI records): the canopy subject, or a system token’ssub, which is its client id (A4). A service’s value today is its Keycloak service-accountsub. -
Programs are carried but not enforced; no receiver enforces them today.
-
-
L2. One composable guard:
Admission. A route’s admission is a const value built from arms, never empty, andprincipal.admitjudges it:-
system: any confidential client but the portal, or the listed ones;
-
portal: canopy-portal’s system token, holding the route’s scope;
-
user: a delegation token holding a listed role, from any actor G8 admits;
-
user via: the same, only when the token’s current actor is listed. It carries the user to a route a service reaches inside a worker’s request, without opening the route to every delegation caller.
A refusal is a 403 whose code follows a fixed order. A portal caller is refused for the missing arm (
portal_on_non_portal_route) or scope (portal_scope_missing). A system caller is refused for the missing arm (service_class_on_user_onlywhere a user arm exists, elseportal_only_route) or for not being listed (service_not_allowlisted). A user is refused for the missing arm (system_caller_requiredwhere a system arm exists, elseportal_only_route), then for an actor no user arm admits (actor_not_allowed), then for holding none of the roles (required_role_missing). Every code butsystem_caller_requiredandactor_not_allowedkeeps its meaning today. Ownership (D11) stays a step after admission, binding only the portal.
-
-
L3. A system token’s edge. The validator refuses a system token whose client has no
SystemorBothedge to the receiver (B3), checked last, as G8 checks a delegation token’s last hop. D4’s receivers re-check the last hop of either kind; purposes and scope subsets stay the issuer’s. -
L4. The layer. It reads exactly one
Authorizationheader with aBearerscheme, compared case-insensitively, and one token (RFC 6750 §2.1). It refusesX-Canopy-Actorbefore any key lookup, validates at the wall clock (D14) within a 2 s key budget, and verifies anX-Canopy-Applicantclaim for the portal only (D11). Only a token failure answers 401, always with its challenge (RFC 9110 §15.5.2):token_missingwithBearer,token_rejectedwithBearer error="invalid_token". The actor header is a 400 (actor_header_retired, RFC 6750 §3.1). An applicant claim from a caller other than the portal, with no verifier configured, or that fails verification is a 403. Keys unavailable, or the budget passed, is a 503. A refusal logs its validator rule, never the token. -
L5. A receiver’s keys refresh on a timer. D9’s refresh ran only on a lookup, and a lookup that found a refresh due waited for it. So an idle receiver could hold a set past 300 s, and a hung issuer stalled every receiver for up to the 10 s fetch timeout, every 30 s, though its keys were trusted until 720 s.
-
The refresher. A refresher ticks every 30 s and fetches once the set is 240 s old, so while the JWKS answers, a revoked key stops verifying within 300 s, idle or busy.
-
The no-wait rule. A lookup answers from a set aged 300–720 s without waiting only while the refresher is live (it ticked within 60 s) and the latest completed fetch failed: evidence of the outage D9 bounds at 720 s. Otherwise D9’s rule holds.
-
Its lifecycle. The refresher’s own task clears its liveness when it ends, for any reason, so a source kept past its runtime waits as before.
-
Scope. The upstream key source (C5) starts no refresher.
-
-
L6. Receiver settings.
identity_url's rules move to canopy-auth, and canopy-security’s issuer settings keep them unchanged. A receiver is built from its issuer and the issuer’s internal URL, which name the settingsidentity_issuerandidentity_internal_url. TheServiceSettingsfields come at the switch, beside their first reader: a key accepted before anything reads it would be silently ignored (#1773). -
L7. Routes the switch re-authorizes (the maintainer, 2026-10-09). canopy-web’s and canopy-cli’s edges are delegation only, and B4 makes every service call inside a worker’s request delegation. Yet many such calls send the caller’s own service token today, to routes whose bar refuses a user: about 50 from canopy-web, 18 on the delegation side of service edges, and 34 from canopy-cli. Plan I3c2 (#2799) gives each such route an admission with a user arm, under two rules:
-
Visibility is preserved. A user arm admits the roles canopy-web shows that surface to. A reader bar is
CASEWORKER_OR_ABOVE_ROLESplusanalystandstudio_adminwherever canopy-web shows them the surface. -
In-request service routes admit users via. A route that services reach inside a worker’s request admits users only through the arm listing those services, plus canopy-web or canopy-cli where they call it.
The switch waits on plan I3c2.
-
As built (2026-10-09, !1583). The seven decisions hold as written; the build adds this precision:
-
L2. Each
and_method sets its arm and replaces one already set, so a route names each arm once. A system token’shas_scopenever holds an empty scope, so the empty element of an empty or doubly spacedscopeclaim grants nothing.ReceiverDenial's codes are today’s guards' (PolicyDenial's,ReceiverContract'sservice_class_on_user_only, a handler’sservice_not_allowlisted) plus the two canopy-identity adds. -
L3.
Rejection::SystemEdge; canopy-security’s onward-subject reason table gainssubject_token_system_edge. -
L4. The claim checks run: a caller other than the portal, then no verifier, then a repeated or non-UTF-8 claim, then a refused one. The verifier’s error text is never logged, unlike the Keycloak path’s.
-
L5.
REFRESH_AHEADis 240 s andREFRESHER_LIVE60 s. Liveness is stamped as the refresher is spawned, and the guard that clears it moves into the task’s future, so even a task dropped before it first runs clears it. A fetch whose task panics counts as failed. The refresher ends at its first tick after its source is dropped. -
L6.
identity_endpointmoved withidentity_url; the settings' names areISSUER_SETTINGandINTERNAL_URL_SETTING. -
Proof.
crates/canopy-test-lib/tests/identity_receiver_test.rsreaches a probe behindIdentityReceiver::over_httpfor canopy-persons with the token broker’s real tokens: jane.doe’s delegation as her realm subject and roles, the portal’s system token holdingportal:persons:read, another receiver’s token refusedtoken_rejected, and no bearertoken_missing.
Amendment 15 (2026-10-09, #2800) — delegated routes
Status unchanged (still Accepted).
Plan I3c2 (#2799) re-authorizes the
routes the switch would otherwise break. Today canopy-web, canopy-cli (under
canopy login service) and services inside a worker’s request call many
routes on their own service token. After the switch each such call carries
the user’s delegation token: canopy-web’s edges and canopy-cli’s are
delegation only, and B4 makes every in-request service call delegation. So
each such route’s judgment moves from its service arm to its user arm, and
it breaks where that arm is missing or admits fewer roles than the caller
lets through. The maintainer ruled (2026-10-09):
-
R1. Visibility is preserved (L7): a route canopy-web calls admits every role canopy-web shows that page to.
-
R2. In-request service routes admit users via (L7), only through the arm listing those callers.
-
R3. The admissions are a compiled table, and the inventory page is generated from them and gated.
-
R4. Audit reads: admin, studio_admin and auditor read freely; case roles only through case- or resource-scoped queries.
-
R5. Enrollment’s household gate stays: a delegated read follows the worker’s own assignment.
-
R6. canopy-cli’s operators are admitted by each route’s effect, and the CLI’s notice mark-read verb goes (#2805).
It records six decisions:
-
M1. Scope. A route is listed when a delegation caller reaches it today on its own service token and the admission I3c’s table translates from today’s guard does not already admit every user that caller lets through. Every other route translates by that table alone. The one exception is applications' day-30 shadow findings, whose canopy-web call is meant to carry its identity but sends none today (#2803).
-
M2. Formation. A listed route’s admission is the translation plus one via arm: the callers that reach it on a service token, with the union of what each caller’s own gate lets through (canopy-web’s by its session gates, a service hop’s by the admission of the route it serves inside, transitively, canopy-cli’s by the route’s effect). Portal arms remain. A system arm remains unless no client holds a system edge to the service (appeals, wic, reporting), where L3 already refuses every system token.
-
M3. Role sets.
CASE_READER_ROLES(CASEWORKER_OR_ABOVE_ROLESplus analyst and studio_admin),WORKER_READER_ROLES(that plus auditor),AUDIT_READER_ROLES(admin, studio_admin, auditor) andSUPERVISOR_VIEW_ROLES(supervisor, studio_admin), beside the two caseworker bars. A row’s roles are the smallest of these containing M2’s union; the all-alerts feed keeps its literal supervisor, admin and studio_admin. canopy-cli’s reads takeCASEWORKER_OR_ABOVE_ROLES, writes the writer bar, destructive calls supervisor and admin, operations admin, audit reads the audit set. -
M4. Deliberate service-only bars. snap’s hearing view admits users (its projection holds no sealed data, and Web→Snap is delegation-only). snap’s snapshot admits users via eligibility for its dry-run only; direct reads keep admin and QC. applications' record-determination admits writers via canopy-web, its signed provenance unchanged. snap’s operation envelope, canopy-web’s worker-name refill, its workers-observed post and the exchange-audit ingest stay system; notices' mark-read stays the portal’s.
-
M5. Rules the switch implements beyond admission: case roles reach security events and fact history only through scoped queries, and canopy-web’s dashboard audit-events panel scopes its query; applications' household-ids lookup names the caller’s own subject unless supervisor or admin;
persons:batchGet's SSN projection stays system-only; a fact’s author comes from the bearer; the rep-disqualification cancel admits writers via appeals only forhearing_overturned; the eligibility scoped feed drops canopy-web’s service arm; enrollment’s household gate applies to delegated reads. -
M6. The compiled table.
delegated_routes()in canopy-auth lists each route’s admission, held by tests to the call graph (every via actor holds a delegation edge, a kept system arm has a system caller). xtask generates the authorization inventory’s table from it, gates drift, and checks each row’s method and path against its service’s registrations. The switch admits each listed route by its constant.
Plan I3c2’s inventory also found a pre-existing canopy-web defect: case tab fragments skip the composition’s role filter, so an auditor reaches case reads by URL (#2804).
As built (2026-10-09, !1584). The six decisions hold as written; the build adds this precision:
-
M2. The system arm is dropped wherever no client but the portal holds a system edge, since a system arm never admits the portal, so notices' three rows drop theirs too and keep their portal arm. tanf’s and medicaid’s
GET /v1/determinationsare listed with the unscoped list’s admission; their handlers keep themonth(federal universe) query system-only (#1249). -
M3. The four sets are literal slices in
claims.rs; a test holdsCASE_READER_ROLESandWORKER_READER_ROLESto their definitions. -
M6.
DelegatedRoute { service, method, path, admission }has 119 rows.Admissiongains read accessors (system_arm,portal_scope,user_arm,via_arm) in their own impl block, andSystemArmis public.cargo xtask delegated-routes check, the validate stage right aftercall-graph, reads the inventory’s table back and holds each row to asyncensus of the receiving services' production routers (pluscanopy-overpaymentsfor snap, tanf and medicaid), which resolves a path throughv1_route!, literals and a plain, grouped, renamed or qualified contractpathsimport. Each service has a census floor at about four fifths of what it resolves today (386 in all). The 18 registrations it cannot resolve are listed, not failed: canopy-identity’s own routes, and snap’s redact route, whose constant snap’s contracts re-export from eligibility’s.
Amendment 16 (2026-10-09, #2806) — senders
Status unchanged (still Accepted). Plan I3d builds canopy-identity’s sender side, unwired until the switch (K1). canopy-auth already holds the pieces: the client assertion minter (A1), the system token source and the onward delegation source (G9). What it lacks is a purpose for any client but the portal, a client key setting, the token endpoint in the settings, and the choice B4 makes for each call: delegation onward from the request’s user, or a system token. The maintainer ruled (2026-10-09):
-
R1. Each service purpose holds one scope. Receivers keep checking a system token’s edge (L3) and the route’s client list (L2).
-
R2. The verification adapter routes' decisions (#2648) are made now, and SOLQ’s admission is compiled. The switch moves the routes and deletes the shared key.
-
R3. I3d is the sender library only. The shared clients and their call sites move at the switch.
It records eight decisions:
-
E1. Service purposes. Every non-portal
SystemorBothedge (46) has exactly one purpose,<client>/<target>(A2), whose one scope is its own name. The scope is informational: a receiver checks a system token’s edge (L3) and the route’s client list (L2), never this scope. This amends B7’s last sentence: for a service caller, route-level authority is the route’s client list, and only the portal’s purpose scopes carry route-level authority. -
E2. One settings type. The receiver and the sender read the same two settings (L6), so
ReceiverSettingsbecomesIdentitySettings, which also derives the token endpoint,/identity/tokenunder the internal URL. -
E3. The client key. A service’s client key is the secret
CANOPY_<SERVICE>__IDENTITY_CLIENT_PRIVATE_KEY, read only through SecretProvider with no file fallback (D10). The devstack hands each service its key at the switch (K4). -
E4. The sender. One
IdentitySenderper process, for a confidential client that runs as a service, owning one system token source and one delegation source over one key. canopy-web’s and the portal’s senders are I3e’s and I3f’s. -
E5. Origin and kind (B3, B4). A call’s origin is its request’s principal: a user is delegated onward from, and a system principal (the portal’s included), a detached or background task, a durable retry and boot are system. The edge decides the kind:
-
no edge is refused locally, sending nothing;
-
a
Systemedge takes a system token whatever the origin; -
a
Delegationedge delegates onward, never narrowed, and refuses a system origin locally; -
a
Bothedge goes by origin.A caller may ask for a system token where B4 makes an in-request call system (bookkeeping, process-wide data), on a
SystemorBothedge only.
-
-
E6. Budget and rejection. An acquisition is bounded by G10’s 5.5 s plus 1 s for signing and the round trip. After a receiver’s 401 the caller drops the target’s tokens and retries once. The sender never retries on its own and never fails open.
-
E7. Bearers. A bearer is read only for its call; an owned copy for a task the request spawns zeroizes on drop. No error carries a token, assertion or body.
-
E8. The adapter routes (#2648):
-
SOLQ joins the delegated table (M1). Eligibility reaches it inside a worker’s determine on its own credentials, so it admits system tokens from canopy-eligibility (CMD orders) and, via canopy-eligibility, the writer bar that determine admits.
-
IEVS admits system tokens from canopy-snap, its one caller, whose task is detached.
-
SAVE has no production caller (#2811), so it admits system tokens from the shared key’s holders, canopy-eligibility and canopy-snap.
-
At the switch the four routes move behind the receiver at their own paths, and the key goes.
-
The delegated-route gate reads
/internal/v1/paths.
-
As built (2026-10-09, !1585). The eight decisions hold as written; the build adds this precision:
-
E1. The registry is one 55-entry array, the portal’s nine first.
service_purpose!spells out the audience prefix, sinceconcat!takes only literals, and the naming test catches a drift. A test holds the other 46 to the call graph’s system edges one for one. -
E2.
IdentitySettingsalso answersissuer_url(), a client assertion’saud.IdentityReceiver::over_httplives beside the layer. -
E4. Both constructors refuse a client that runs as no service, and
from_secretsdoes so before it reads any key. -
E5.
Bearer::is_delegation()names a bearer’s kind; itsDebugprints the kind and never the token. -
E6.
SENDER_BUDGETis 6.5 s. A cached delegation token records its target, whichDelegationCache::forgetdrops by. -
E7. Compile-time probes hold
OwnedBearerto noDebug,DisplayorClone, andBearerto noDisplayorClone. -
E8. Before the change the census read
/internal/v1/ssa/solqunder/v1; it now resolves it as registered, and still resolves 386 registrations. -
Proof.
crates/canopy-test-lib/tests/identity_sender_test.rskeys canopy-snap’s and canopy-eligibility’s senders from the devstack’s generated keys through a secret provider. Snap’s system token for canopy-verification carriescanopy-snap/canopy-verificationand that one scope. Eligibility delegates jane.doe onward, and SOLQ’s compiled admission admits her through canopy-eligibility after canopy-web. Snap’s call on its System edge inside her request carries a system token.
Amendment 17 (2026-10-09, #2813) — canopy-web’s upstream relying party and I3e’s staging
Status unchanged (still Accepted). Plan I3e1 opens I3e, canopy-web’s cut-over. canopy-web signs workers in through a hand-rolled public client today: no secret, no nonce, no id_token validation (#2344), and a refresh lead sized to the Keycloak exchanger (#2345). The maintainer ruled (2026-10-09):
-
R1. I3e splits into sequential plans, each planned when its predecessor lands; I3e1 is the first.
-
R2. The staging is the architecturally correct one, with no shortcuts, no backward compatibility and no fig leaves. Protocol code is library code in canopy-auth wherever it lands, and is proven now against the devstack’s identity plane. canopy-web’s own integration replaces its Keycloak path rather than sitting beside it, and lands with the switch.
It records seven decisions:
-
W1. Staging (R2). Amendment 11’s I3e is re-cut, as K1’s stage list allows.
-
The I3e plans are canopy-auth library stages: this relying party; then canopy-web’s sender and session engine; then the device-approval and security-admin clients; then the edge forwarder. A later plan may re-cut them.
-
canopy-web’s integration lands with the switch, replacing its Keycloak path: its session store, extractors, handlers, pages, AC-8, step-up, logout, forwarding mount and panel-cache key (#2647), and reading the profile and the client secret at boot.
-
canopy-web therefore holds no dormant module, no code kept public only to escape the dead-code lint, no devstack-only mount and no preparatory migration. The switch replaces its schema outright.
-
-
W2. The relying party’s endpoints. The profile gains four optional overrides:
authorization_endpoint,token_endpoint,revocation_endpointandend_session_endpoint. Each one named wins over discovery, as C6’s overrides do, so a provider whose endpoints sit off the issuer’s origin stays usable.-
Discovery reads the four in a separate, lenient pass. None of their values ever refuses the document, or canopy-security’s key fetch.
-
Each is judged only when the relying party asks for it. A value it does not override must pass C6’s endpoint rule and sit on the issuer’s origin. Otherwise it is a fault, and the relying party fails closed.
-
-
W3. Form posts. The upstream client posts a form, authenticated by the profile’s
client_auth_method(client_secret_basicorclient_secret_post). It keeps its 2 s connect bound, its refusal of redirects and its trust anchors, and takes a per-call request bound. -
W4. Scopes. The profile gains
scopes, a list of RFC 6749 scope tokens holdingopenid, with no duplicates. Thekanidmpreset isopenid profile, and akanidmfile statingscopesis refused (C2).oidc-genericmust state it. canopy-security parses it and ignores it. -
W5. The relying party is canopy-web’s confidential client of the one upstream (D1, D6), in canopy-auth.
-
Authorization. An authorization request carries:
-
a fresh 256-bit
stateandnonce; -
an S256 PKCE challenge;
-
the profile’s scopes;
-
auth_timerequested as an essential claim on every request, since a provider sends it only when asked (OIDC Core §2) and C7 requires it; -
prompt=loginandmax_ageonly when the caller asks (D6, F4, H2; Amendment 9’s N3).The
state,nonce, verifier andmax_ageare kept together for canopy-web’s flow store.
-
-
Redemption. One 10 s deadline covers discovery, the code exchange and the key fetch. Before any request it checks the returned
state. It then validates the id_token (C7) and checks that itsnonceis present and equal, and, whenmax_agewas asked, thatauth_timeis within it plus 60 s. canopy-identity validates the id_token again at federation, but only canopy-web knows the nonce (D5). -
Refresh applies Amendment 2’s partition within one deadline, covering discovery, that is the caller’s remaining budget.
-
A failure before the token is presented grants grace. So do a refused or stalled connect and a 408, 425 or 429.
-
Every other failure ends the session, and the refresh token is never presented again.
canopy-identity judges a reissued id_token at renewal (F5).
-
-
Logout. RFC 7009 revokes the refresh token. RP-initiated logout runs at a discovered end-session endpoint, with the
id_token_hintomitted when canopy-web has no live, CSRF-checked session. Each runs within 2 s. With no end-session endpoint, D6’s revocation and the next sign-in’sprompt=loginapply. -
The client secret is read through SecretProvider, with no file fallback. No error,
Debugor log carries a token, code, secret, verifier,stateornonce.
-
-
W6. The refresh lead (#2345) derives from the grant’s own lifetime.
-
The lead is a quarter of the lifetime, clamped to 30–300 s.
-
A lifetime of 30 s or less is a named short-lived condition, never a refresh storm.
-
The session engine takes the earlier of this and canopy-identity’s freshness lead (D6, F4).
-
-
W7. The devstack redirect. The proof reads the code from Kanidm’s redirect without following it, as the broker does (K7). canopy-web’s browser-reachable redirect belongs to the switch.
As built (2026-10-09, !1587). The seven decisions hold as written; the build adds this precision:
-
W2. The four members are captured as raw JSON text, the way the key fetch’s own pass skips them, so a value that pass stepped over (a lone surrogate escape, an out-of-range number, deep nesting) faults only its own member. The faults are
Null,NotAString,Repeated,Refused(the endpoint rule),CrossOriginandUnreadable. -
W3.
client_secret_postreads the secret throughServiceCredentials::client_secret_for_body. -
W5. A token endpoint’s refusal carries the existing typed
TokenEndpointError. A redemption’s token request has its own bound set 1 s past the deadline, so a stall always ends as the deadline. Thestateandnonceare compared in constant time. The secret, the pending authorization, the refresh token and the grant have noDebug,Display,SerializeorClone, which compile-time probes hold. A reissuing profile’s refresh answered without an id_token isAcceptedUnreadable. A 2xx other than 200 isAmbiguous. With less than the 2 s connect bound left of the caller’s budget, a connect still pending at the deadline is a request timeout, which ends the session as Amendment 2 requires. -
W6. The due instant is always after receipt.
-
Proof.
crates/canopy-test-lib/tests/upstream_relying_party_test.rsruns against the devstack’s Kanidm:-
Kanidm accepts the essential
auth_timeclaim request; -
jane.doe signs in through the relying party, and her id_token’s nonce is checked;
-
the grant opens a canopy-identity session, and a refresh renews it with
fresh_untiladvancing; -
Kanidm refuses a revoked refresh token (
invalid_grant), ending the next refresh; -
Kanidm advertises no end-session endpoint.
-
Amendment 18 (2026-10-09, #2819) — canopy-web’s session engine
Status unchanged (still Accepted). Plan I3e2 builds canopy-web’s session engine: the protocol that keeps a worker’s web session fresh. The engine runs an upstream refresh, then a canopy-identity renewal, single-flight across canopy-web’s replicas. It also completes a sign-in and signs a worker out. Like I3e1, it is canopy-auth library code, unwired until the switch. The maintainer ruled (2026-10-09):
-
R3. Amendment 17 W1’s second stage splits. I3e2 is the session engine; I3e3, planned once I3e2 lands, is canopy-web’s sender.
-
R4. The engine’s single-flight state sits behind a store trait in canopy-auth. canopy-web’s Postgres store implements it at the switch, replacing
web_session, and canopy-auth gains no database dependency.
It records seven decisions:
-
V1. Staging (R3, R4). The I3e stages are now: the relying party (I3e1); the session engine (I3e2); canopy-web’s sender (I3e3); the device-approval and security-admin clients; then the edge forwarder. canopy-web’s store, extractors and handlers stay the switch’s (W1).
-
V2. The record and its store.
-
A session’s record holds:
-
the federated session;
-
the upstream issuer and client it signed in under;
-
the upstream refresh token;
-
the latest upstream id_token, for logout’s hint;
-
when it is next maintained.
-
-
The store contract follows canopy-web’s refresh claim (#2224):
-
a claim at a version, with a lease on the store’s clock;
-
a commit under the claim, which steps the version;
-
a release only while the claim is live;
-
ends only under the claim, and an end that answers the record it ended;
-
an end reason the engine can read back.
-
-
A lapsed claim is never cleared, and an ended session is never live again.
-
A contract suite in canopy-auth holds any implementation to this contract, canopy-web’s included.
-
-
V3. When a session is maintained.
-
The next maintenance is the earliest of three times, and never sooner than 30 s from now:
-
the upstream grant’s refresh lead (W6);
-
120 s before canopy-identity’s
fresh_until; -
780 s from now, which keeps D6’s "at least every 900 s" whatever freshness an answer extends to.
-
-
F2 does not mark canopy-identity’s own grace (F6). An answer fresh beyond 900 s plus D9’s 60 s leeway cannot come from a validation now (F4), so it is treated as grace and retried in 30 s.
-
A session is maintainable while it holds a refresh token and more than 15 s remain to its end, even when its freshness is capped at the end, as a grace’s is.
-
It is served while fresh for 15 s more.
-
-
V4. Serving. Each request has one absolute deadline covering every read, poll, wait and cleanup.
-
A fresh session is served. When it is due, one detached leader maintains it, and the request does not wait.
-
A stale session is led within the deadline, or the request waits for another replica’s live claim.
-
Otherwise the request answers that maintenance is pending.
-
A session bound to another upstream issuer or client ends before anything is presented.
-
A lapsed claim ends the session, fresh or stale, since its holder may have spent the token.
-
-
V5. Maintenance. A leader holds the claim. The lease (60 s) outlasts every store write it makes.
-
Amendment 2’s partition and the renewal answers (IdP integration, "How canopy-web treats each renewal answer") decide the outcome:
-
a successful refresh always keeps its rotated token, whatever the renewal answers;
-
a refresh the upstream did not process asks for grace only when freshness is near its end, since repeated grace never extends (F6);
-
canopy-identity’s session-ending refusals end the session;
-
an upstream refusal ends the session.
-
-
Every end the engine writes revokes the canopy-identity session within 2 s, so an upstream refusal stops minting at once (G5). The exception is an end canopy-identity itself refused.
-
A successor token whose session ended under it is revoked only after a sign-out or an operator’s end, as canopy-web does today.
-
-
V6. Sign-in completion. The engine redeems the code, then opens a federated session, recording its upstream binding and its maintenance time. It sends the access token only under a userinfo profile. A failed open revokes the grant’s refresh token.
-
V7. Sign-out. The local session ends first, and that end answers the record, so no leader’s commit falls between a read and the end. The engine then:
-
revokes the canopy-identity session;
-
uses RP-initiated logout with the hint where the upstream advertises it, and otherwise revokes the refresh token (D6) (2026-10-13, #2905: revokes the refresh token in either case, and reports both legs in
UpstreamSignOut); -
with no record, or one bound to another upstream, still offers
end_sessionwithout a hint.
-
As built (2026-10-09, !1588). The seven decisions hold as written; the build adds this precision:
-
V2.
Claimed::Recordboxes its record, as canopy-web’s claim boxes its grant. The contract suite’s lapse checks use a 500 ms lease, so that a networked store’s next round trips still find it live. Five deliberately broken stores prove the suite names the row each one breaks. -
V3. The lease covers one more store call than the plan counted: a foreign row’s end-reason read before its end. That makes 42 s of a leader’s writes, against a 60 s lease.
-
V4. Every store call is also wrapped in a
tokiotimeout, so a store that overstays its own bound still cannot carry a request past its deadline. -
V5. The foreign-row rule covers every path after a presented token. Whenever the claim is gone and the row is live, or its end reason cannot be read, the session ends as refresh-lost. That holds for an end under the claim as well as for a commit. Re-reads are capped at three in all, as canopy-web’s are. Identity revocation follows every end a request or leader writes and sees acknowledged.
-
V7.
SignedOut'sDebugnever prints the end-session URL, which carries the id_token as its hint. -
Proof.
crates/canopy-test-lib/tests/web_session_engine_test.rsruns against the devstack’s Kanidm and canopy-identity, one cast worker per test:-
a sign-in’s record is served;
-
a due session’s detached maintenance renews it;
-
eight stale requests share one maintenance under Kanidm’s rotating refresh;
-
a sign-out revokes both sessions;
-
an upstream refusal ends the session and stops canopy-identity minting from it.
-
Amendment 19 (2026-10-10, #2824) — canopy-web’s sender
Status unchanged (still Accepted). Plan I3e3 builds canopy-web’s sender over the session engine (Amendment 18). It mints per-target delegation tokens from a worker’s web session, renews a stale session, and takes canopy-web’s system tokens. Like I3e1 and I3e2, it is canopy-auth library code, unwired until the switch. The maintainer ruled (2026-10-10):
-
R5. A request’s concurrent calls share one per-request cache, with single-flight per target, and receive owned bearers.
-
R6. canopy-web’s sender is its own type;
IdentitySenderstays the service-only sender E4 describes. -
R7. The sender renews a
session_stalesession itself, once per request. -
R8. Narrowing takes the architecturally correct answer, recorded as X3.
It records eight decisions:
-
X1. Staging. The sender is library code. canopy-web’s roster, its exchange wrappers and its panel-cache key (#2647) move at the switch (W1).
-
X2.
WebSender. It mints with canopy-web’s key, read through the secret provider alone underCANOPY_WEB__IDENTITY_CLIENT_PRIVATE_KEY(D10). -
X3. Routing; no narrowing. B3’s "a mint narrows per request" becomes "a mint may narrow", and canopy-web’s never does.
-
Inside a request, a
DelegationorBothedge mints from the session (G1’s session form). M4’s in-request system call and detached tasks take system tokens, onSystemandBothedges only. -
By G4, an edge’s narrowing becomes the ceiling for every onward hop. canopy-web would have to encode each downstream chain’s transitive role needs, failing closed whenever a downstream policy changed.
-
D4 keeps policy compiled and judged at every receiver against the session’s current roles. Least privilege comes from structure: one audience, at most 300 s, reuse within one request, the
actchain, and freshness.
-
-
X4. The session form’s sender-side check (D3, G9). A token minted from a session must name the session’s
subandsid. Itsexpmust be no later than the session’s end, as the onward form’s already is. -
X5. The per-request outbound (R5).
-
Each target has one slot for the request, never removed, with single-flight per target and owned, zeroizing bearers (E7).
-
Invalidation is by generation: a receiver’s 401 bumps the slot’s epoch, and a renewal bumps the request’s. No queued caller is served a rejected or pre-renewal token, and a token minted across a change is not cached.
-
Callers queued during a failed attempt share its failure, a cancelled attempt included, while a
session_stalesends them to the shared renewal instead. -
Each mint is bounded by the lesser of the sender’s budget and the request’s deadline, amending E6’s per-acquisition bound for canopy-web.
-
This shared state is interior mutability, which the coding conventions allow only with an ADR. This decision is that ADR, following
SystemTokenSource, and scoped to one request.
-
-
X6.
session_stale(R7, G2).-
One renewal per request, which concurrent calls share, runs within the request’s deadline less a mint’s reserve. Each stale call then retries its mint once, with the echoed credential (F2).
-
A renewal that does not advance the session’s freshness answers pending, with no retry.
-
session_endedandsubject_suspendedend the local record. A suspended subject’s canopy-identity session is revoked, since F8 revokes it only at a renewal. -
Every other refusal, a 429 included, is a typed error, never retried and never failing open (E6).
-
-
X7. Forced maintenance. The engine gains
maintain_now. It leads at the served version even when the local record looks fresh, because canopy-identity’s freshness has spoken.-
It stays single-flight through the claim at the version.
-
It defers to V4’s ordinary decision once another leader has moved past that version.
-
It holds V3’s retry spacing while the local freshness is near its end.
-
The engine also gains
end_refused.
-
-
X8. A receiver’s 401 (E6).
rejectedbumps the target’s epoch and invalidates its system token, and the caller retries once.
As built (2026-10-10, !1589). The eight decisions hold as written; the build adds this precision:
-
X4. The session form’s check also reached the capacity harness (
xtask/src/cmd/perf/identity/senders.rs), whose sessions now keep F2’s whole answer, as canopy-security’s two end-to-end tests now do. -
X5.
-
A token minted across a 401 or a renewal is forgotten from its target’s cache. The cache’s own epoch pair already makes such a token unservable to the next caller.
-
A failure is shared only with the callers queued behind its attempt; a later call to the target mints again.
-
-
X6.
-
The request’s renewal cell holds only the outcome.
-
Callers queued behind an ending refusal answer
SessionEndedwithout minting, and only the caller that met the refusal ends the record. -
A renewal canopy-identity itself refuses as ended answers
SessionEnded.
-
-
Proof.
crates/canopy-test-lib/tests/web_sender_test.rsruns against the devstack’s Kanidm and canopy-identity, one cast worker per test:-
a bearer for canopy-persons is admitted as the worker through canopy-web;
-
concurrent bearers get one token per target;
-
canopy-security takes a delegation in a request, and
system_bearera system token admitted as canopy-web; -
rejectedmints anew; -
after sign-out a fresh bearer is
SessionEnded.
-
Amendment 20 (2026-10-10, #2829) — the security-admin client
Status unchanged (still Accepted). Plan I3e4 builds the client canopy-web’s admin pages will use for canopy-security’s admin routes (Amendment 8, H1–H2), and the wire types it shares with them. Like I3e1 to I3e3, it is canopy-auth library code, unwired until the switch. The maintainer ruled (2026-10-10):
-
R9. W1’s "device-approval and security-admin clients" stage splits: I3e4 is the security-admin client, and I3e5 covers device approval and native sessions.
-
R10. The admin wire types live in canopy-auth, shared by canopy-security’s routes and the client, so the wire contract has one source.
-
R11. A step-up asks for
max_age300 s, half the server’s 600 s bound.
It records five decisions:
-
Y1. Staging (R9). The client is library code. The switch builds canopy-web’s admin pages on it; I3e5 and the edge forwarder follow.
-
Y2. The shared wire module,
canopy_auth::identity_admin(R10). Not one byte on the wire changes.-
ADMIN_PATHand the 4096-byteADMIN_BODY_LIMITmove there, with no re-export from canopy-security. -
The request bodies keep
Stringfields, so the server keeps each field’s code and their order. The lookup query keeps today’s lenient parse. -
The input rules move as checked types:
AdminReason,CheckedPair,NewSubjectId,AdminKidandcanonical_uuid. The server calls each where it calls today’s check, and the client’s methods take only them, so it never sends what the server refuses. The migrations' CHECK constraints stay the store’s own. -
The response views carry the ids as
SubjectId,SessionIdand a newActionId, all transparent. A session’s opener and a client’s id stay text, so a client one side does not compile never fails a read. -
The module has no database dependency. canopy-security keeps its rows and maps each onto its view.
-
-
Y3.
AdminClient. It has one method per route over the request’sWebOutbound(Amendment 19), its bearer a delegation on canopy-web’sBothedge to canopy-security (X3).-
Each attempt is bounded by the lesser of the server’s 5 s budget (H1) plus a 1 s transport margin, and what remains of the request’s deadline. A write body over
ADMIN_BODY_LIMITis refused before it is sent: the checked types bound each field, not the escaped whole. -
A 401 whose challenge or body names
insufficient_user_authentication(RFC 9470) isStepUpRequired, carrying the challenge’smax_age. Any other 401 invalidates the target (X8) and retries once, unless less than a second remains. The guard runs before every handler, so a retried write is never applied twice. -
Every other answer maps onto a typed
AdminError, carrying no token, body text or reason. A problem body that is not JSON reads as no code.
-
-
Y4. Step-up (R11).
step_up_options()asks formax_age300 s withoutprompt=login.-
The relying party admits an
auth_timewithinmax_ageplus its 60 s leeway (W5). A stepped-up session is therefore at most 360 s old, leaving at least 240 s of admin work under the server’s exact 600 s. Aconstassertion holds the sum under the bound. -
The session a step-up replaces ends through the engine’s new
supersede, neversign_out.supersedeends the record asSupersededand revokes only its canopy-identity session; the upstream is sent nothing.sign_outcould revoke the old upstream refresh token, and an overlapping leader that findsSignedOutrevokes its rotated successor. An issuer that revokes related tokens could then end the session that replaced it.
-
-
Y5. The shared types' users. canopy-security’s routes, canopy-test-lib’s broker and the server’s admin tests use them in place of local mirrors. The broker keeps its own transport, which holds no
WebOutbound.
As built (2026-10-10, !1590). The five decisions hold as written; the build adds this precision:
-
Y2.
-
The checked types sit in
identity_admin/checked.rs, their bounds public. Each refusal’sDisplayis the message the server answers with it. -
The
DebugofAdminReason,CheckedPairandLinkViewprints no reason and no upstream subject, which canopy-security never logs. -
ClientKind::of(Client)andAdminProblem::read(body)serve both sides.
-
-
Y3.
-
RETRY_FLOOR(1 s) is public, and a second 401 also drops the target’s token. -
A transport failure drops its URL, since the lookup’s query carries an upstream subject.
-
The bearer’s acquisition keeps the sender’s own bound, outside the attempt’s.
-
-
Y4.
supersedeanswersReplaced { ended, identity_revoked }, and a store fault revokes nothing. -
Proof.
crates/canopy-test-lib/tests/admin_client_test.rsruns against the devstack’s Kanidm and canopy-security:-
sec.admin, stepped up, reads the keys, the clients and its own subject by its upstream pair; -
it creates a scratch subject under a fresh v7 UUID, then suspends and lifts it, each recorded as a change;
-
jane.qcisForbidden.Every call waits out the admin routes' shared per-IP limit. The seed links' test now counts only actions on the cast’s realm ids.
-
Amendment 21 (2026-10-10, #2833) — device approval and native sessions
Status unchanged (still Accepted). Plan I3e5 builds canopy-web’s side of D7. A worker approves canopy-cli’s device flow under D6’s step-up. canopy-web keeps the native session the approval opens fresh through its dedicated upstream grant until it ends. The issuer’s side is Amendment 9’s. Like the earlier I3e stages, the canopy-web side is canopy-auth library code, unwired until the switch. The maintainer ruled (2026-10-10):
-
R12. Approval and native-session maintenance land in one plan.
-
R13. The approver owns the native session: its canopy subject must be the approving worker’s web session’s, and a mismatch fails the approval.
-
R14. The kind is the engine’s. A native wrapper builds the session engine with kind native over its own store, sharing the store contract, and keeps a native engine out of canopy-web’s sender by type.
It records nine decisions:
-
Z1. Staging. Library code. The switch brings canopy-web’s device page, step-up redirect, native table and sweep task. canopy-cli’s device client is I3f’s. The devstack serves the device flow now (K1).
-
Z2. The devstack’s device flow. canopy-security’s
identity_device_verification_uriishttps://web.canopy.test/device, the origin of the Kanidm client’s redirect. -
Z3. The federation client’s native operations.
-
It takes its endpoints from
IdentitySettings, which gains the revocation and device-verification endpoints. -
It gains code entry (
describe_device,deny_device, within 6 s), the approval grant (approve, carrying the user code and the approver’sweb_session), and a renewal by kind. Each answer’s issued type must be the one asked for. -
A 429 carries its
Retry-After.
-
-
Z4. The engine’s kind (R14). The engine holds a session kind. Its renewal presents that kind’s token types, and its schedule’s lead and Z8’s revocations read it. Nothing else does.
-
Z5.
NativeSessions.-
Code entry:
describeanddenysend the approver’s web credential. -
Step-up:
step_upasks formax_age300 s and leaves the worker’s web session untouched, since the step-up’s grant is the native session’s alone (D7). -
Approval:
complete_approvalruns in this order:-
it redeems the code;
-
a grant with no refresh token approves nothing, since the session could never be re-federated;
-
it calls
approve, and any failure revokes the grant’s refresh token; -
it builds the record for canopy-web to insert.
A lost answer leaves the outcome unknown. An orphaned native session that is never renewed stops minting within 900 s. canopy-web keeps a backstop: an answer naming another subject has its native session revoked before the approval answers.
-
-
Revoke:
revokeends a deviceSignedOutand revokes canopy-identity’s session, then the upstream grant. It never uses the end-session endpoint, which would sign the browser out.
-
-
Z6. Due sessions.
DueSessionsextends the store contract withdue(now, limit, within): live rows whose maintenance time has come, earliest first. A web store needs none of it. -
Z7. The sweep. A native session gets no requests, so canopy-web sweeps every 30 s.
-
A pass: each pass has an absolute deadline, which also bounds its
duequery. Each key’s step runs as an independent task holding a permit from a semaphore the wrapper owns (16 per replica). The step reads the row and takesdecide: it leads, ends as a request would, or skips. A row that no longer decodes endsRefreshLost. -
Cancellation: cancelling a pass, or reaching its deadline, detaches its steps and never aborts a leader. An aborted leader would lose a rotated successor and leave its claim to lapse.
-
Schedule and capacity: a native session is scheduled 300 s before its freshness ends. A
constassertion holds the interval, a full batch’s queueing (256 at 5 s through 16 slots) and one leader’s run inside that lead. -
Fairness: while the store answers, every outcome moves a row’s maintenance time or ends it, so the batch’s head turns over.
-
-
Z8. Native ends. A native session ends as a web one does. Its upstream grant is its alone, so the web engine’s reason for sparing a grant does not apply.
-
The rule: every end of a record bound to the engine’s own upstream revokes each refresh token the engine holds for it, best-effort, whatever the reason.
UpstreamEndedis included, since a refresh that failed before the upstream processed it also reads as ended. -
Bound elsewhere: a record bound elsewhere sends the configured upstream nothing.
-
-
Z9. The issuer holds an approval to its approver (R13; amends N3). A check in canopy-web after the approval commits cannot hold R13: canopy-cli can redeem the approval first, and revocation cannot recall a delegation token already issued.
-
The parameter: the approval grant therefore gains a required
web_session, checked as code entry checks it, before the attempt is spent. -
The comparison: the approval’s transaction compares the subject the step-up resolves to with the web session’s. A mismatch rolls everything back, refused
approver_mismatch, and its row is logged. The device stays pending, so no poll can redeem it.
-
As built (2026-10-11, !1591). The nine decisions hold as written; the build adds this precision:
-
Z3.
-
Code entry and the approval sit in
identity_client/federation/device.rs. A describe naming no compiled native client, or a start after its expiry, isSessionDefect::Device. -
Limited { retry_after }readsRetry-Afteras delay-seconds only.
-
-
Z5.
-
approve_nativeandend_nativesit inengine/sign.rs, andNativeEndedreports each leg of a worker’s revoke. -
The backstop for an answer naming another subject revokes that native session within its bound, then the step-up’s refresh token.
-
-
Z7.
-
A step reads its row within
STORE_OP_TIMEOUT, and bounds a request-style end by aSTEP_BUDGET(5 s) of its own, not the pass’s, since it may run on detached past the pass; each store call stays withinSTORE_OP_TIMEOUT.ServeAndMaintainleads asLeaddoes. -
The deadline is checked once a permit is held, so no step starts once it has passed.
unfinishedcounts rows no slot freed for, as well as steps left running. -
A row whose times are past chrono’s range, as well as an undecodable one, is ended
RefreshLost; when the end still answers its record, its sessions are revoked as any end’s are.
-
-
Z8. The leader carries what an end revokes as
Ending { credential, stored, upstream }, path by path. -
Z9. The issuer checks the approver’s web session through code entry’s own worker check, after
auth_timeand before the attempt is spent. A mismatch isApproveOutcome::OtherApprover, rolled back in the approval’s transaction. -
Proof. canopy-test-lib’s
native_session_test.rsruns approval, redemption, a sweep’s renewal, canopy-cli’s logout ended by the next sweep, a worker’s revoke after a refresh, a denial and an approver mismatch against the devstack.
Amendment 22 (2026-10-11, #2840) — the edge forwarder
Status unchanged (still Accepted).
Plan I3e6 builds D2’s edge
forwarder, the last I3e stage W1 names. canopy-web passes canopy-identity’s
public endpoints through to canopy-security for native and machine clients,
which bring their own credentials (DPoP proofs, refresh credentials,
private_key_jwt assertions), so the forwarder holds none. Like the earlier
I3e stages, it is canopy-auth library code, unwired until the switch. The
maintainer ruled (2026-10-11):
-
R15. The edge forwards the three POSTs (device authorization, token, revocation), plus the metadata and the JWKS, so every URL the issuer’s metadata advertises resolves at the edge.
-
R16. The issuer records the forwarded client. The client-IP rule becomes one source, shared by the limiters, the issuance log and the forwarder.
-
R17. The edge passes every form through. It never parses a form; the issuer authenticates every grant.
It records seven decisions:
-
Q1. Staging. Library code. The switch brings:
-
canopy-web’s mount;
-
canopy-web’s address in canopy-security’s
CANOPY_TRUSTED_PROXIES; -
the issuer identifier at canopy-web’s public origin;
-
an ingress in front of canopy-web that overwrites
X-Forwarded-Forand never appends to it. canopy-web keys on the leftmost hop, so an appending ingress would let a client choose the address canopy-web forwards.The devstack identifier stays internal until then.
-
-
Q2. The client-IP rule, one source (R16).
canopy_common::http::client_ipholdsTrustedProxies:-
resolve(peer, headers)is the peer, or the leftmostX-Forwarded-Forhop only from a listed peer; -
client_ip, the limiters' form, answers 127.0.0.1 with no peer, as before.Entries stay exact addresses. An unparseable entry is warned, since a mistyped proxy puts every proxied client in one bucket.
-
-
Q3. The issuer records the forwarded client (R16). The token router’s routes, code entry included, log
resolve(peer, headers)aspeer_addr. A request with no peer still logs NULL. canopy-web sends noX-Forwarded-Foron its own calls, which keep logging canopy-web. -
Q4. The forwarded routes (R15; amends D2 and N8).
-
Routes: POST device authorization, token and revocation; GET the JWKS and the metadata. A HEAD is served by the GET handler, sending GET upstream, so it advertises the representation’s true length.
-
Targets: each goes to its twin under the internal URL.
-
Shared constants: the five paths and the form cap move to canopy-auth, so the edge’s routes cannot drift from the issuer’s.
-
Never forwarded: code entry, the admin routes, any other path or method, and any query string.
-
-
Q5. The request at the edge (R17).
-
Body: read within 2 s into a zeroizing buffer, capped at the issuer’s 64 KiB. An oversized body answers 400
invalid_request, as the issuer does, and a slow one answers 503. -
Headers sent:
Content-Type, everyDPoPvalue in order (the issuer judges one or several), andX-Forwarded-Forset to the client canopy-web resolves by Q2, overwritten, never appended. Nothing else: no cookie, noAuthorization, no forwarding header, noAccept-Encoding. -
No peer: a request without one is answered 503, never forwarded under a made-up address.
-
-
Q6. The answer.
-
Relayed: the status, the body (64 KiB at most), and only
Content-Type,Cache-Control,Pragma,Retry-AfterandAge(the JWKS answer’s contract). -
Answered 503
temporarily_unavailableinstead (A8’s retryable answer): a call with no answer within 6.5 s, a transport failure, an answer over the cap, an encoded answer, or any 3xx. ALocationnever reaches the internet. -
The bound covers the grants an internet client sends: the native grants and delegation (5.5 s) and client credentials (5 s). The issuer’s own budget normally answers first. canopy-web’s own federation form (13 s) or a JWKS read waiting on a key fetch may get the edge’s 503 instead.
-
-
Q7.
EdgeForwarder. A cheap handle whoserouter()serves Q4’s routes alone. At the switch, canopy-web merges it outside its session and CSRF layers, since the routes take no cookie and change no canopy-web state, and under its edge limiter, which P2 relies on to bound anonymous traffic. CIDR ranges inCANOPY_TRUSTED_PROXIESare #2846’s.
As built (2026-10-11, !1592). The seven decisions hold as written; the build adds this precision:
-
Q2.
TrustedProxiesalso offerstrusts(peer), and names its variableTRUSTED_PROXIES_VAR. A blank entry is skipped silently; only an entry that is no address is warned. -
Q3.
TokenEndpoint::client_ofapplies the rule to the socket peer on the token, device-authorization, code-entry and revocation routes; the metadata route logs nothing. -
Q4. The five paths and
MAX_FORM_BYTESareidentity_url's, exported at canopy-auth’s root.metadata_url()is the internal URL with its path set toMETADATA_PATH. -
Q5. An unreadable body answers 400
invalid_request, as the issuer answers one. An empty data frame reserves nothing. Beyond the three sent headers, only the transport’s ownHost,Content-LengthandAcceptreach the issuer. -
Q6. Any
Content-Encodingbut identity, in any spelling or list, is refused, and each relayed header keeps every value. -
Q7. The forwarder’s two bounds are private fields its tests shorten.
-
Proof. canopy-test-lib’s
edge_forwarder_test.rshosts the forwarder in front of the devstack canopy-security: the metadata and the JWKS, a machine client’s grant, and canopy-cli’s device flow through the edge.
Erratum (2026-10-23, as-built): Q2’s "Entries stay exact addresses" is
superseded by #2846. An entry may also be a CIDR range, IPv4 or IPv6, and
trusts(peer) holds for a peer inside a listed range of its own family. A
range with host bits set (10.0.0.1/8) is warned and ignored as an
unparseable entry is, since it may mean the one address or the whole range.
Amendment 23 (2026-10-11, #2847) — the Rust clients
Status unchanged (still Accepted). Plan I3f1 builds I3f’s Rust clients: canopy-cli’s device client, the portal’s sender and the operator tools' deploy gate. Like the I3e stages, these are library code and devstack work, wired by the switch (K1). The maintainer ruled (2026-10-11):
-
R18. I3f is two plans: I3f1, the Rust clients; and I3f2, the test harness (the TypeScript broker, Playwright sign-in and k6).
-
R19. canopy-cli keeps its DPoP device key in an owner-only file, one per profile.
-
R20. The device client is canopy-auth library code. canopy-cli’s commands move onto it in the switch MR.
It records eight decisions:
-
O1. Staging (R18). The switch MR moves three callers:
-
canopy-cli’s commands onto the device client;
-
the portal onto its sender;
-
sweep-finalize-orphansonto the operator’s device session.It also deletes the Keycloak
identity verifyand canopy-cli’s notice mark-read verb (#2805). The verb works only underlogin serviceuntil then, so removing it earlier is not additive.
-
-
O2. One owner-only writer. canopy-cli’s writer moves to canopy-common.
-
Cleanup failures are returned for the caller to report, not printed.
-
The directory is fsynced after a rename or a removal, so an acknowledged write survives a crash.
-
A lock file is opened only as a regular file.
-
-
O3. A persistable device key. canopy-signing generates a P-256 key as zeroizing PKCS#8 PEM.
LocalP256Keykeeps its no-serialization guarantee. -
O4. The device store (R19). It is one directory per profile.
-
session.jsonholds the issuer, the key and the refresh credential. It is zeroized in both directions and written by a durable rename. -
session.lockis never removed. Its exclusive lock, bounded at 15 s, serializes every refresh, login and logout across processes, so no credential is presented twice (N6). -
Mutations run as detached tasks. Each holds the lock through its last write, so cancelling a caller never aborts one.
-
-
O5. The device client (R20). It is built from
IdentitySettings.-
Login polls per RFC 8628:
-
the interval defaults to 5 s, and
slow_downadds 5 s each time; -
connection failures back off, and the whole poll is bounded by the expiry;
-
a pending login is bound to its issuer;
-
a failed login keeps the prior session, and only success replaces it.
-
-
A refresh carries a fresh DPoP proof and a
resource.-
Its 200 is held to the delegation client’s checks.
-
The successor is stored before anything is answered, even when the access token fails a check.
-
-
Refusals:
session_staleandsubject_suspendedkeep the credential. Any otherinvalid_grantends the stored session.
-
-
O6. Bounds. A call is bounded by 10 s, above both of the edge’s phases (2 s and 6.5 s) and a second of transport. An answer lost past every bound spends the credential, and the session ends on its next refresh.
-
O7. The portal’s sender. The portal’s key mints its system tokens for its nine edges. Any other target is refused locally. The applicant claim stays portal-signed (D11).
-
O8. The operator tools.
cargo xtask identity checkis canopy-identity’s deploy gate. It checks:-
the metadata and its endpoints;
-
the JWKS;
-
one client-credentials mint, whose validated principal must name the expected client, purpose, scopes and kind.
The devstack key file is used only on a proven devstack pair: the devstack issuer, loopback, and the recorded canopy-security port.
sweep-finalize-orphanstakes the operator’s device session at the switch.
-
As built (2026-10-11, !1593). The eight decisions hold as written; the build adds this precision:
-
O2. A write answers the stale staged files it could not remove (
Stored::leftovers), and a failed write’sOwnerOnlyError::Storecarries its own. Directories the writer creates are fsynced into their parents.open_owner_only_lockcompares the file’s device and inode before and after the open. -
O4.
ProfileNamealso refuses:, a trailing dot or space and a name over 128 bytes. A session the format cannot hold (an empty field, or a file past 16 KiB) is refused before any write asStoreError::Unstorable, so whatever is written reads back. -
O5. Answer parsing (
identity_device_client::answer) sits apart from the HTTP client (client).intervalis capped at 1800 s asexpires_inis, and the expiry check cannot overflow, so a hostileRetry-Afterexpires the login. A form is encoded into a zeroizing buffer sized for its worst-case encoding, so no growth frees an unwiped copy. A refusal other thaninvalid_grantkeeps the session (Refused). A redemption’s 200 carrying a well-formed refresh credential stores its session and revokes the prior one even when its access token fails a check (Malformed), as a refresh stores its successor: the device code is spent. A login that fails otherwise, a 200 without a credential included, leaves the stored session untouched. -
O7.
PortalSender::over_httptakes a signer, as the other senders do. -
O8.
--clientdefaults tocanopy-eligibility, and a client with no compiled purpose is refused before anything is sent. The devstack proof also admits the devstack’shttpURLs; without it both must behttps. The metadata check reads the issuer and the token, revocation, JWKS and device authorization members only. -
Proof. canopy-test-lib’s
device_client_test.rs:jane.supervisorapproves a device client’s login, whose tokens for two targets verify as the worker; two clients refresh at once; and after logout a restored session file is refused. The portal’s sender mints its nine targets.cargo xtask identity checkpasses against the devstack for canopy-eligibility and canopy-portal.
Amendment 24 (2026-10-11, #2855) — the test harness
Status unchanged (still Accepted). Plan I3f2 builds I3f’s test harness (R18): the TypeScript broker, Playwright sign-in and k6. Like the other I3 stages, it is devstack work proven against the identity plane, and the switch moves the battery onto it (K1). The maintainer ruled (2026-10-11):
-
R21. The TypeScript broker is canopy-test-lib’s
TokenBroker(K7), served over HTTP as a devstack service on the compose network only. Playwright and k6 get thin clients.-
There is one implementation of the Kanidm driver, TOTP, federation and delegation.
-
The service shares the Rust cache and its sign-in spacing.
-
Client keys never enter the e2e or k6 containers.
-
-
R22. At the switch, Playwright signs workers in headlessly. A helper intercepts canopy-web’s redirect to Kanidm, the broker authorises that query with the person’s UAT, and the browser follows to canopy-web’s callback. A Kanidm login page object drives one
@identityspec through Kanidm’s own pages. -
R23. I3f2 lands the service, the clients, the helper and the page object, each proven against the identity plane. The switch flips the callers.
It records eight decisions:
-
J1. Staging (R23). I3f2’s proofs verify tokens against canopy-security’s JWKS and obtain codes for canopy-web’s registered redirect; no service receives these tokens. The switch moves:
-
auth-setup onto the headless helper;
-
the
giventoken sites onto compiled client/edge pairs or delegations; -
k6’s profiles onto the new client.
It also rewrites the sign-out assertions, gives canopy-web its https origin and registers the cross-site redirect.
-
-
J2. The broker service (R21).
tools/canopy-token-brokeris an axum server overTokenBroker.-
It is unpublished, runs as uid 1000, and mounts the in-network runner’s inputs and cache, so the two share sessions and spacing.
-
The root image never builds it.
-
-
J3. The browser steps.
TokenBrokergains three methods:-
authorise_query; -
upstream, giving Kanidm’s origin, client, redirect and CA; -
ui_credentials, giving a password and a fresh TOTP code. The code is stamped under the person’s spacing, so no code is presented twice.The broker’s 503 retry also covers a shared failed acquisition, and federation.
-
-
J4. The HTTP API. JSON with unknown fields refused and a 16 KiB cap.
-
Error bodies carry a fixed detail and a public reason, mapped by an exhaustive table, so nothing in them echoes the request or a secret.
-
A UAT is kept per person and re-signed once on
AuthenticationRequired, except forprompt=login, which no UAT satisfies.
-
-
J5. The Playwright client has no retry and a budget equal to the broker’s. Its verifier applies the receiver’s checks, its time rules included.
-
J6. Headless sign-in. A fulfilled 3xx is not followed on a navigation, so the helper continues with a script redirect.
-
It refuses a foreign redirect and
prompt=login. -
canopy-web’s re-authentication moves with the sign-out migration, through the page object.
-
-
J7. Kanidm’s pages. The page object answers each login step by its form.
-
The
@identityspec’s Chromium is pinned to Kanidm’s leaf SPKI, verified first against the devstack CA. -
It is a leaf pin because Chromium’s ignore list matches any presented certificate, and the CA certificate is public.
-
-
J8. k6. A per-VU cache serves tokens for at most 300 s, the system cache’s revocation ceiling, with no narrowing. The proof profile is
identity-tokens.
As built (2026-10-11, !1594). The eight decisions hold as written; the build adds this precision:
-
J2. The broker’s builder installs
curlbesidemusl-dev, as the root builder does, forutoipa-swagger-ui's build script. The service is outside the fleet as well as e2e-only, so the devstack’s token-holder restarts and liveness probes skip it. It installs no log subscriber and is inventoried as an ADR-041 tool, so nothing it traces is written; a failed request’s answer is its body. Each bring-up’s input install builds its image first (run --build), since the fleet’s refresh never builds it. The in-network installer takes anInstaller(IntegrationorTokenBroker), so each fills the volume through its own image. -
J3. The retry is
while_retryable(predicate, call); system calls go throughmint_systemundersystem_retryable(is_unavailable()orSharedFailure).kanidm_driveranswers the driver and itsUpstreamtogether, so the CA is read once.TOTP_STEPis checked at compile time against Kanidm’sTOTP_STEP_SECONDS. -
J4. Each failure maps to a
Classthat carries its status, itserrorand its fixeddetailby exhaustivematch, so no class can lack one. -
J7. Kanidm 1.11 serves the first step, the username, at
/ui/oauth2itself, then/ui/login/totpand/ui/login/pw; it asks for no mechanism choice, so the page object answers those three forms and fails on any other. The@identityspec starts withprompt=login, the re-authentication canopy-web moves to these pages (J6). It reads the code and state from the callback’s request: Kanidm reaches canopy-web’s registered origin by a server redirect, which Playwright does not route, and that origin resolves nowhere before the switch. -
J8. The k6 cache answers
{token, expiresAt, issuedAt}and counts a token’s age from itsiat: the broker’s system tokens come from its source’s cache, so one may arrive up to 300 s old. A refreshed system token may therefore be the same token, and the profile asserts a newjtion refreshed delegations only; theirexpis no earlier, not later, since a delegation ends no later than its session. An iteration that throws fails a check.cargo xtask perf --profile identity-tokensbrings the broker up around the k6 container and removes it after, a failed bring-up included. -
Proof. canopy-test-lib’s
identity_broker_test.rsand the broker’s devstack test pass against the plane.cargo xtask e2e — --project identity-planepasses its ten tests, the headless sign-in waiting out a recent sign-in’s spacing.cargo xtask perf --profile identity-tokenspasses every check, with refreshes inside the window and no failed request.
Amendment 25 (2026-10-11, #2864) — the switch
Status unchanged (still Accepted). Plan I3g is the cut-over K1 stages. It is one MR that:
-
wires every receiver and sender;
-
moves canopy-web, the portal, canopy-cli and the operator tools onto their clients;
-
moves the battery onto the token broker;
-
deletes the Keycloak path.
The maintainer ruled (2026-10-11):
-
R24. The merge gate moves to deployment. The switch merges to main once green. The external security review (Consequences, #2884) and the issuance log’s retention (#1303) gate a production deployment, not main. This amends K1’s merge clause, T5 and the Consequences.
-
R25. One plan, over the plan cap.
-
R26. The switch branch stays local until it is green, with a bundle after each unit, then one push.
It records sixteen decisions:
-
SW1. Staging. Each unit is one signed commit, and every commit compiles. The Keycloak pieces stay in the bootstrap until the deletion unit. The branch merges once the pre-push battery passes.
-
SW2. The staged bring-up. Every bring-up path starts and provisions Kanidm before the stack, so canopy-web receives its upstream client secret at boot. canopy-web joins the readers restarted on a certificate or Kanidm-profile change.
-
SW3. The bootstrap.
-
ServiceSettingsgains the issuer pair, mirrored for canopy-security, and each service holding a client key reserves the key’s name. -
The bootstrap builds an HTTP receiver for every
CanopyServicebut canopy-security, whose receiver runs in process. It builds none for canopy-web or canopy-exchange. -
It builds a sender for the 13 service clients.
-
Every service depends on canopy-security.
-
-
SW4. Admission. Handlers admit by
PrincipalandAdmission:-
listed routes by named constants of the delegated table;
-
the rest by I3c’s translation.
A service-only route that no client but canopy-web or the portal reaches by a system edge admits canopy-cli’s operators by R6’s effect rule instead.
-
-
SW5. Senders. A
BearerSourcetrait and one retry helper carry every outbound call.-
A receiver’s 401 drops the target’s tokens and is retried once, within the caller’s deadline, but never for a step-up challenge.
-
The shared clients take a source per call.
-
Signing registration waits out the issuer’s first-key lead.
-
Verification’s adapter routes go behind the receiver, and the shared key goes (E8).
-
-
SW6. Origins (amends Q1’s proxy clause).
-
canopy-web serves at its https origin behind a devstack TLS ingress that overwrites
X-Forwarded-For, and canopy-identity’s issuer identifier moves to that origin. -
The devstack names no trusted proxy; the deployment guide states the production chain.
-
A port move re-mints every token and asks canopy-cli to sign in again. It ends no web session.
-
-
SW7. Audit. The exchange audit goes, superseded by the issuance log, and the audit ingest stamps an event’s source from the authenticated client (#2649).
-
SW8. canopy-web’s store. A new schema holds web and native sessions behind canopy-auth’s store contract. It keeps today’s replacement and logout semantics, so a sign-out wins a race with a step-up in either order.
-
SW9. canopy-web’s sign-in.
-
The AC-8 page renders the ruleset’s notice.
-
Sign-in is by navigation, and the handoff page stays.
-
A stale upstream sign-in is restarted once with
prompt=login. -
A security-administrator role is admitted.
-
Every call carries the worker’s delegation (#2647, #2803).
-
The IdP chooser and local login go (D1).
-
-
SW10. New pages. Security administration over
AdminClient, with step-up; device approval, with an ownership-checked revoke; and the edge forwarder, mounted outside the session. -
SW11. Studio. The identity tables leave
idp.toml, and Studio’s identity step goes (ADR-050 §2). -
SW12. Clients.
-
The portal moves onto its sender.
-
canopy-cli moves onto the device flow, losing the password grant,
login serviceand the mark-read verb (#2805). -
The operator tools move onto the device session, and
identity verifygoes.
-
-
SW13. The battery.
-
Rust, Playwright and k6 take broker tokens by a fixed mapping.
-
The broker gains canopy-cli device sessions on production grants.
-
Negative tests keep their properties.
-
The Kanidm lane’s oracle stays independent.
-
-
SW14. Deletion. The Keycloak devstack, xtask’s realm handling and canopy-auth’s legacy modules go in the same MR.
-
SW15. Settled issues.
-
Implemented: #2649, #2647, #2803, #2648, #2805, #2344 and #2345.
-
Superseded, each closed with its mapping: #1869, #1901, #1447 and #1595.
-
-
SW16. New input surfaces get evil-input cases.
As built (2026-10-12). The switch makes this decision effective (see the Status line). The sixteen decisions hold as written, except as follows; the plan’s Erratum (2026-10-12) lines are the full record:
-
Devstack (SW2, SW5, SW6).
-
The ingresses are
ingressandingress-xsite, and both run in every profile. -
xtask sets canopy-web’s redirects at Kanidm over REST on every bring-up, not in the static migration. It records them in Kanidm’s credentials file (
Credentials.redirect_uris), where the broker reads them (identity_broker::registered_redirect). -
Client keys and canopy-web’s upstream secret reach each service through a per-client compose
env_file, not interpolated variables. -
canopy-web-xsite is not among the restarted readers, since
cargo xtask e2eremoves it after every run.
-
-
Boot and senders (SW3, SW5).
-
The bootstrap builds the receiver and the sender before any connection, so a missing client key refuses the boot before migrations.
-
A request’s handlers send through
RequestOutbound, whichrequest_outbound_middlewareinserts inside the receiver, in place of aSharedOutboundeach handler builds. -
CallerContextgoes. Eligibility’s run carries the request’s outbound and the sender (DetermineConfig { source, system }), andEXCHANGE_TARGETSgoes. -
The retry narrows. Only a 401 whose
Bearerchallenge names no error orinvalid_token(refuses_the_bearer) is re-minted and resent. A step-up 401 and a route’s own 401, such as an applicant’s wrong credential, return as they came. canopy-web’sInternalClientkeeps its own loop under the same rule. -
The portal builds its sender at boot and mints lazily; its
/readyzmints the canopy-applications token.
-
-
Admission (SW4).
-
The snap and medicaid provenance gates and canopy-applications' determination context admit canopy-eligibility by
principal.client(), through its onward delegation or its system token. -
canopy-overpayments' list admits by its mounting service’s constant (
api::ListAdmission). -
canopy-reporting has no service-only route.
-
The QC write-gate sweep waives two write-verb routes that admit QC as reads: snap’s determination dry run and rules'
evaluate.
-
-
canopy-cli’s operator routes (SW4, #2886). SW4 gave appeals' service-only routes to canopy-cli’s operators, but the compiled graph held no canopy-cli edge to canopy-appeals or canopy-reporting, so those routes admitted no caller. #2886, landed on the switch branch, adds both delegation edges, their profile URLs, and
canopy appeal,canopy ipvandcanopy report. No route’s admission changes. -
Audit (SW7). The ingest’s
auth.token_exchangearm goes with every intake-side dedup producer. The chain-v2 drainer still honors a dedup key on rows staged before, and thededup_keycolumns stay. -
canopy-web (SW8–SW10).
-
web_session/evolves in place. -
Handlers keep
SessionData, admitted per request from the served session, in place of aSignedInWorker. -
Device approval stores the approving worker’s web-session id in
web_login_flow.replaces_session_id, because the upstream’s cross-site return carries noSameSite=Strictcookie. Its refusals adduser_code_invalidandapprover_mismatch. -
The sign-in routes' evil-input cases assert no echo, no stored return path and no 5xx, rather than a 4xx: a refused
return_tois dropped, and it is capped at 2048 bytes.
-
-
canopy-cli and the operator tools (SW12).
-
devstackis a reserved profile, derived from.ports.envon every run, and the--devstackswitch goes. -
token showbecomestoken <SERVICE>. -
identity rendergoes whole, withidentity verify.
-
-
The battery (SW13).
-
tokensaddsor_skip,castandsystem_caller, andportaltakes an optional scope.identity::devstack_senderserves in-process routers whose requests call live peers. -
The mock issuer drops its
/tokenroute whole. -
The broker service gains
POST /v1/tokens/cli. -
The stale-SSO single retry has no e2e test, because no browser run can stage an old upstream sign-in. canopy-web’s route test keeps it.
-
-
Deletion (SW14). Ten legacy
ServiceSettingsfields go (the exchanger pair counts as two), with everything the deletions left unreferenced,applicantinROLE_VOCABULARYamong it.identity checkcaps the issuer’s answers atJWKS_BODY_CAP.
Amendment 26 (2026-10-13, #2891) — the alternative upstreams
Status unchanged (still Accepted). Plan I4 is the last stage of the program (epic &134). It makes Keycloak and ZITADEL tested, supported upstreams beside Kanidm, as ADR-050 promised. D1 stands: a deployment trusts one upstream at a time.
The maintainer ruled (2026-10-13):
-
R27. ZITADEL is read through its native claims (no Actions webhook), and uses Login V2.
-
R28. Studio’s identity wizard stays out of this stage.
-
R29. An identity push runs every upstream’s conformance suite. The per-IdP browser tests run on demand and before a release.
It records twelve decisions:
-
AL1. Four profiles (amends C2).
ProfileKindgainskeycloakandzitadel. A vendor file states the common fields plus its vendor fields, and the preset fixes the rest.-
keycloak: ES256; claims from the id_token; a refresh that re-issues it;client_secret_basic; scopesopenid profile;/roles,/primary_programsand/preferred_username(canopy’s provisioning convention, AL5). -
zitadel: RS256; the same claim source, refresh and client authentication; ZITADEL’s project-roles and organisation scopes; roles and programs from the object keys of/urn:zitadel:iam:org:project:{project_id}:roles(AL3);/preferred_username. Azitadelfile also statesproject_idandorganization_id; any other kind stating either is refused.
-
-
AL2. ZITADEL’s audience (amends C7). For a
zitadelprofile,audmay be the client id alone, or exactly the client id andproject_id, withazpthe client id. Every other profile keeps C7’s exact rule. -
AL3. ZITADEL’s claim shape and organisation pin (amends C8). A claim pointer gains a shape,
arrayorobject_keys;object_keysis the zitadel preset’s alone. A key counts only when its value names the profile’sorganization_id, so a grant from another organisation grants nothing. Programs are the countedprogram_<wire id>keys. -
AL4. Where each upstream enforces MFA (D6’s AC-8 and MFA bullet). MFA stays the upstream’s obligation; each preset names where it is enforced, and the suites test it there.
-
Kanidm:
idm_all_personsrequires MFA. -
Keycloak: the server. The realm’s browser flow requires the OTP form for every user.
-
ZITADEL: Login V2, its trusted login client, because ZITADEL’s server leaves factor sufficiency to the login client. The login client’s credential is therefore a credential of the IdP, which a deployment protects as it protects ZITADEL’s admin credential. The test harness’s Session API driver acts as a login client and is never evidence of ZITADEL’s enforcement; Login V2’s MFA and freshness are tested in a browser.
-
-
AL5. Keycloak’s provisioning convention. A realm with an ES256 key, a TOTP policy, a browser flow whose OTP form is required,
primary_programsin the user profile and canopy’s role vocabulary as realm roles. A confidentialcanopy-webclient with PKCE S256, both origins' callback and post-logout redirects, and mappers that putrolesandprimary_programsin the id_token and userinfo only. -
AL6. The upstream harness, split from Kanidm. canopy-test-lib’s plain OIDC half, cast and credentials become vendor-neutral, and an
UpstreamDriverenum signs in and administers each vendor. The token broker and the battery run on whichever upstream the devstack runs. -
AL7. The devstack’s upstream.
cargo xtask dev start --idp kanidm|keycloak|zitadel, sticky across bring-ups. Each upstream is aliasedidm.canopy.test, and every bring-up path removes the others before starting the chosen one. Keycloak and ZITADEL start after PostgreSQL and its role reconciliation, and are provisioned before the stack. Their bootstrap secrets are generated into 0600 env files, and ZITADEL’s PATs move through a group-readable volume, never a world-readable file. -
AL8. Images on Alpine. Keycloak 26.8.1 on
alpine:3.23with OpenJDK 21; ZITADEL v4.19.4 onalpine:3.23; Login V2 onnode:24-alpine; annginx-unprivilegedfront. An image that fails its suite is replaced by the vendor’s, pinned by digest, with an Alpine exception recorded in ADR-050. -
AL9. A conformance suite per upstream. Shared cases (discovery, sign-in, freshness, refresh, revocation, an expired account, projection, sessions) plus each vendor’s own.
cargo xtask identity conformance --idp <idp>runs each from a fresh, opt-in graph. -
AL10. The identity matrix. The pre-push hook runs every upstream’s suite when a push touches the identity paths.
-
AL11. The release gate. A tag-only CI job runs the matrix, and the deployment guide’s release steps run it with the browser tests.
-
AL12. Playwright per upstream. The browser helpers use the upstream’s discovered endpoints, and each upstream’s own sign-in pages are tested for sign-in,
prompt=login,max_age, MFA and RP-initiated logout.
#2342 leaves the stage: a second upstream at the edge is reopen trigger 3, not an alternative upstream. #2347 and #2349 are superseded by the per-IdP suites, since the identity verify command they extend went with plan I3g.
As built (2026-10-13). Plan I4 built AL1–AL12, with these departures (each an erratum in the plan):
-
AL4, ZITADEL’s freshness. Login V2 v4.19.4 honours
prompt=loginbut ignoresmax_age, and so does ZITADEL’s core when a login client finalizes a request (zitadel/zitadel#12258). A request whosemax_agethe SSO session has outlived is answered from that session, with its earlierauth_time. This hit a plan STOP rule. The maintainer accepted ZITADEL with the defect on record, tracked by #2906. canopy-web’s relying party carries freshness on ZITADEL: it refuses anauth_timeoutside the step-up’smax_ageplus 60 s, then retries once withprompt=login. The ZITADEL suite and browser spec pin the defect, so a fix upstream fails them. -
AL5.
CONFIGURE_TOTPis disabled, not a default required action: it would let an account enrol its second factor on its password alone. An account without an OTP credential is therefore refused at the required OTP step, and enrolment is the deployment’s administrative step. Acanopy-direct-grantflow requires the OTP foradmin-cli's password grant too. Only the devstack realm accepts a TOTP code more than once a step. -
AL7. ZITADEL’s core runs as its own database login, never a database administrator. Its provisioning token has its own owner-only volume, apart from Login V2’s group-readable one, so Login V2 cannot read it.
-
Facts the suites now pin. Keycloak keeps every token of one browser sign-in in one session, so revoking one refresh token ends the others. ZITADEL’s end session leaves its refresh tokens valid (#2905 revokes them at every sign-out). ZITADEL refuses a reused TOTP code, and refuses a revoked or deactivated refresh
invalid_request.
Amendment 27 (2026-11-11, #2904) — a deployment may require amr values
Status unchanged (still Accepted).
D6 keeps multi-factor authentication the upstream's obligation and never read amr, because not every upstream emits it. Research for Amendment 26 found one gap that leaves: ZITADEL's login client can finalise an authorization request from a session with no second factor, and the id_token canopy then accepts says amr: ["pwd"]. AL4 treats that credential as part of the IdP's trusted computing base, so it is no defect, but the upstream offers evidence canopy could check.
The maintainer ruled (2026-11-04): not every jurisdiction requires MFA, so this is an operational choice, a setting the deploying jurisdiction configures, not a requirement canopy imposes.
-
The setting. The upstream profile (
identity-upstream.yaml) may staterequired_amr, a list of authentication method references (RFC 8176). Any profile's file may state it and no profile presets it,zitadelincluded: the ruling makes it the deployment's choice. -
The rule. With the setting, a sign-in's id_token must carry an
amrarray of strings holding every listed value; an absent or malformedamris refused asid_token_amr_missing, one lacking a value asid_token_amr_insufficient. Without it,amris not read, as before. -
Where it applies. At sign-in: canopy-web's relying party and canopy-identity's federation open. Not at renewal: an upstream need not repeat
amron a refreshed id_token, and a renewal is bound byauth_timeto the sign-in that was already held to the rule. -
The trade-off. Defence in depth against a misused login-client credential, for an upstream that reports
amr. A deployment that states the setting for an upstream that reports none (Kanidm, or Keycloak under canopy's realm) refuses every sign-in; that is the deployment's to get right, and the refusal names the rule.
References
Vendor sources for Amendment 26, read 2026-10-13:
-
Keycloak 26.8.1 release: https://github.com/keycloak/keycloak/releases/tag/26.8.1
-
ZITADEL v4.19.4 release: https://github.com/zitadel/zitadel/releases/tag/v4.19.4
-
ZITADEL, Claims: https://zitadel.com/docs/apis/openidoauth/claims
Vendor sources, read 2026-09-29/30:
-
Kanidm 1.11.2 OAuth2 implementation: https://github.com/kanidm/kanidm/blob/v1.11.2/server/lib/src/idm/oauth2.rs
-
ZITADEL 4.19.3 token exchange: https://github.com/zitadel/zitadel/blob/v4.19.3/internal/api/oidc/token_exchange.go
-
ZITADEL, Token exchange: https://zitadel.com/docs/guides/integrate/token-exchange
-
Keycloak, Securing applications › Token exchange: https://www.keycloak.org/securing-apps/token-exchange
Standards:
-
RFC 6749 (OAuth 2.0)
-
RFC 6750 (bearer token usage)
-
RFC 7009 (token revocation)
-
RFC 7523 (JWT client authentication)
-
RFC 7638 (JWK thumbprint)
-
RFC 8414 (authorization server metadata)
-
RFC 8628 (device authorization)
-
RFC 8693 (token exchange)
-
RFC 8707 (resource indicators)
-
RFC 9068 (JWT access tokens)
-
RFC 9110 (HTTP semantics)
-
RFC 9449 (DPoP)
-
RFC 9470 (step-up authentication challenge)
-
IETF draft, OAuth Transaction Tokens (a precedent for per-hop internal tokens)