Identity plane split, plan I3g: the switch (epic &133)
- Context
- Decisions (ADR-049 Amendment 25, SW1–SW16; land with U1)
- SW1. Staging and compilation (R24, R26)
- SW2. The devstack’s staged bring-up (K2, K4, K8)
- SW3. The bootstrap (L6, E2, E4)
- SW4. Admission
- SW5. Senders, sharing and the 401 retry (E5–E8)
- SW6. canopy-web’s origin, the ingress and the issuer (Q1, J1; amends Q1’s proxy clause)
- SW7. Audit through canopy-identity (#2649, #1869)
- SW8. canopy-web’s session store (R4: "replaces its schema outright")
- SW9. canopy-web signs in and calls through canopy-identity (W1, V1, X1–X8)
- SW10. canopy-web’s new pages (Y1, Z1, Q7)
- SW11. Studio and the IdP tables (ADR-050 §2)
- SW12. The portal, canopy-cli and the operator tools (O1, O5, O7)
- SW13. The battery (K7, J1)
- SW14. Deletion (K1)
- SW15. Settled issues
- SW16. New input surfaces
- Units
- Scope
- Risks
- Verification
- Review log
Status: Done (2026-10-12) — !1596
Epic: &133 (stage I3 of &130)
Issues: #2864 (U1, w3); #2865 (U2, w5); #2866 (U3, w5); #2867 (U4, w8); #2868 (U5, w3); #2869 (U6, w8); #2870 (U7, w8); #2871 (U8, w3); #2872 (U9, w8); #2873 (U10, w5); #2874 (U11, w5); #2875 (U12, w3); #2876 (U13, w3); #2877 (U14, w5); #2878 (U15, w5); #2879 (U16, w8); #2880 (U17, w8); #2881 (U18, w8); #2882 (U19, w8); #2883 (U20, w5); the external review #2884 (a deployment gate, R24).
MR: feat/identity-switch, "the switch (#2864 … #2883)", one commit per issue (K1); the branch stays local until green (R26).
This is a Design + Scope plan, over the ~300-line cap by the maintainer’s ruling (R25). GitLab owns tracking, and the plan freezes when U1 starts. SW1–SW16 are this plan’s decisions (ADR-049 Amendment 25); R24–R26 are the maintainer’s rulings.
Each issue carries priority::high, program::infrastructure, workflow::ready and planning::has-plan, plus the one type:: and one service:: its unit names.
Context
I3g is the cut-over itself (ADR-049 Amendment 11). Stages I3a–I3f landed every canopy-identity piece as library code or devstack infrastructure, unwired (K1).
The switch is one MR, because no state in between is coherent:
-
canopy-web can’t hold a canopy-identity session and a Keycloak token at once;
-
a receiver flipped alone is refused by every peer;
-
dual trust would be a shim.
What the switch does:
-
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;
-
settles #2649, #1869, #1901, #1595 and #1447.
Size (2026-10-11).
| Area | Count |
|---|---|
Handler |
~374 |
|
120 |
Service sender sites |
~110 |
canopy-web reads on its service token |
74 |
canopy-web exchanged calls |
37 |
Portal token sites |
22 |
canopy-cli token consumers |
44 |
Rust test files on Keycloak tokens |
138, ~540 calls |
Playwright files on Keycloak tokens |
35, ~116 calls |
Playwright storage states / projects fed |
9 / 31 |
k6 profiles on Keycloak tokens |
4 |
-
Deleted: about 15k lines of legacy canopy-auth, canopy-web’s 11k-line
auth/tree, about 3k lines of xtask, and the 1.9k-line realm. -
New product surface: the AC-8 sign-in page, the security-admin pages, the device-approval pages, and canopy-web’s https origin. None exists today.
The maintainer’s rulings (2026-10-11):
-
R24. The merge gate moves to deployment. The switch merges to main once green. The external security review (ADR-049 Consequences) and the issuance log’s retention (#1303, deployment guide › Prerequisites) gate a production deployment, not main. This amends K1’s merge clause, T5 and the Consequences bullet. U1 files an issue tracking the review.
-
R25. One plan, over the cap.
-
R26. A local branch with bundle backups. Every push runs the full battery, and no intermediate state can pass it. So
feat/identity-switchstays local until green, with a bundle after each unit, then one push.
Decisions (ADR-049 Amendment 25, SW1–SW16; land with U1)
SW1. Staging and compilation (R24, R26)
Each unit:
-
is one signed commit on
feat/identity-switch, through the pre-commit review; -
leaves
cargo check --workspace --all-targets --features canopy-portal/server,canopy-portal/previewpassing; -
ports every compile site its change breaks, tests included. U16–U18 own only the runtime token sites;
-
deletes what its change leaves unreferenced (dead-code warnings may span units, as in I3f1). U19 deletes what remains (SW13);
-
is followed by
git bundle create ~/backups/canopy-switch/NN-<slug>.bundle main..HEAD.
Integration may be red between units. The branch rebases onto main before its one push. It merges once the pre-push battery passes (the standing rule).
The Keycloak pieces stay until U19. The bootstrap keeps building them for consumers not yet moved:
-
BootstrapResult.auth,oidc_discovery,service_token_source; -
the nine
ServiceSettingsfields.
ApiServer installs only the identity layer from U4 on.
SW2. The devstack’s staged bring-up (K2, K4, K8)
canopy-web needs canopy-web’s Kanidm client secret at boot, and Kanidm mints it only when its migration creates the client (cast::provision, on an absent, unreadable, drifted or emptied cast). So every bring-up path stages Kanidm before the stack:
-
do_start(dev start,reload,restart); -
the guard’s cold start, prebuilt included;
-
auto_refreshwhenever it runs anup.
The stages:
-
before_up: files and the TLS pair, as today, plus the ingress leaf (SW6). -
The new
devstack_identity::kanidm_phase:-
up -d --no-deps --wait kanidm(--no-buildon the prebuilt path); -
cast::ensure, moved here fromafter_up; -
read
.devstack/idp/kanidm.json's client secret into the up env asCANOPY_WEB__UPSTREAM_CLIENT_SECRET, beside SW4’s keys.
-
-
The stack’s
upand health wait. -
after_up:-
restart_readers, whoseTLS_READERSgainscanopy-web,canopy-web-xsite(when running) and both ingresses; -
settle_profile, which on a Kanidm port move restarts canopy-web and canopy-web-xsite beside canopy-security; -
link_cast.
-
A re-provisioned cast’s new secret reaches canopy-web because its env changes and the stack’s up recreates it. Tests pin each path’s order: the Kanidm phase precedes the stack’s up, and the secret is in that up's env.
SW3. The bootstrap (L6, E2, E4)
Settings.
-
ServiceSettingsgains the requiredidentity_issuerandidentity_internal_url. The bootstrap is their first reader (L6). -
canopy-security’s
MIRRORED_KEYSgains both, so itsSecurityConfigstill reads them. Unmirrored, its issuer would silently disable.the_identity_issuer_pair_loads_from_its_env_nameschanges accordingly.
Reserved keys. Each service holding a client key adds IDENTITY_CLIENT_PRIVATE_KEY to its own RESERVED_KEYS, creating the list where absent. canopy-web also adds UPSTREAM_CLIENT_SECRET. Each service’s config test loads with the injected key set and checks reserved_keys_are_not_fields.
Receivers (service_name.parse::<CanopyService>()):
| Service | Receiver |
|---|---|
canopy-security |
The bootstrap builds none. Its main builds |
Any other |
|
canopy-web, canopy-exchange |
None. |
AppState becomes { db, receiver: Option<IdentityReceiver> }.
-
The eight mains that attach the applicant verifier now attach it to
boot.receiver(same loader, same trait object). -
U4 ports every
AppStateconstruction (grep -rn 'AppState {', about 20). -
Offline test states take
canopy_test_lib::identity::offline_receiver(service), an empty key set that refuses every token. States serving real tokens takedevstack_receiver(service).
Senders (service_name.parse::<ConfidentialClient>() where client.service().is_some(), 13 services):
-
IdentitySender::from_secrets(&settings, client, &EnvSecretProvider::new(service_name), http), held asArc<IdentitySender>inBootstrapResult.senderand as an extension. -
canopy-web and the portal build their own senders (SW9, SW12). persons, rules and security send nothing.
Boot order. Every service’s depends_on names canopy-security: service_healthy.
SW4. Admission
Each handler extracts Extension<Principal> (and Option<Extension<ApplicantOwnership>> where it checks ownership) and calls principal.admit(&ADMISSION)?:
-
A listed route uses its row’s constant. U5 promotes each of the 120
DELEGATED_ROUTESrows to a namedpub constincanopy_auth::delegated(<SERVICE>_<METHOD>_<PATH WORDS>, e.g.PERSONS_GET_PERSONS_ID_ASSETS), and the table is built from them. No new gate. -
An unlisted route follows I3c’s translation table (
plans/archive/identity-plane-split-i3c.adoc, "Translating today’s bars"), with one precondition:-
A service-only bar translates to
Admission::system()only when a client other than canopy-web or the portal holds aSystemorBothedge to the service. -
Where none does (appeals, notices, reporting, wic), the route’s admission follows R6’s effect rule for canopy-cli’s operators:
Admission::user_roles_via(&[CLI], …), with readsCASEWORKER_OR_ABOVE_ROLES, writes the writer bar, destructive calls supervisor and admin, and operations admin. Its tests reach it throughtokens::cli(SW13). -
Notices'
POST /v1/notices,POST /v1/notices/{id}/resendandGET /v1/notices/queueare the known cases: callerless in production, operations and a read. U6 and U7 list every case they find.
-
Ported helpers:
| Today | Becomes |
|---|---|
|
|
|
|
|
|
|
|
|
|
WIC’s |
|
effective_user.rs and caller_context.rs go with their last callers.
Attribution. A system caller’s attribution becomes its client id (A4): FTI accessed_by, redaction actor_sub, idempotency keys, bulk runs and export events. Every such column is TEXT, and nothing reads rows back by the old service-account subject (the realm randomized it per import).
SW5. Senders, sharing and the 401 retry (E5–E8)
BearerSource is a new canopy-auth trait whose methods take &self:
-
async fn bearer(&self, target: CanopyService) → Result<OwnedBearer, BearerError>; -
async fn rejected(&self, target: CanopyService), async becauseSharedOutboundtakes its lock to drop the tokens.
It is implemented by:
-
SharedOutbound<'s, 'p>, atokio::sync::Mutex<Outbound<'s, 'p>>.bearerlocks, mints, takes.owned()and unlocks, so a request’s concurrent calls (joined futures) share one delegation cache; -
WebOutbound, held per request asArc<WebOutbound>, which already shares one cache and one renewal across concurrent callers; -
PortalSender; -
ServiceTokenSource, which ignores the target. It lets unmoved callers compile, and it goes with the type in U19.
canopy_auth::send_with_retry(source, target, deadline: Option<Instant>, build), where build: Fn(&str) → reqwest::RequestBuilder. It generalizes AdminClient::exchange's loop and keeps its semantics:
-
each attempt is bounded by the remaining deadline;
-
a 401 naming
insufficient_user_authentication(challenge or body, RFC 9470) is returned at once for the caller to classify, because a re-mint cannot refreshauth_time; -
any other 401 calls
rejected(target)and is sent once more, only while at least 1 s remains (RETRY_FLOOR); -
a second 401 is returned.
AdminClient moves onto it, keeping StepUpRequired and its refusal mapping. Every outbound call site uses it.
Concurrency. A request’s concurrent calls run as joined futures over one SharedOutbound or Arc<WebOutbound>. Work that outlives its request is system-origin (E5) and builds its own Outbound from the Arc<IdentitySender>.
Shared clients.
-
PersonsClientholds anArc<dyn BearerSource>in place of itsServiceTokenSource:persons.system()calls with that source (the service’s own, system origin) andpersons.on(&source)with a request’s. Both return aPersonsCallsview whose methods call throughsend_with_retry. -
RulesClientmethods takesource: &dyn BearerSourcein place oftoken: Option<&str>(sorules_client_has_no_shared_token_statestill holds), each call and its retry withinRULES_CALL_TIMEOUT.CallerContextcarries thatsourcein place of itsbearer_token. -
A 401 is no longer a generic error.
-
U4 ports every caller to pass its current source (
ServiceTokenSource; tests aFixedBearer), and U6, U7 and U9 swap the source. -
signing_registrationtakes theArc<IdentitySender>and sends through it as aBearerSource, which asks for a system token per attempt (every program’s edge to canopy-security isSystem). An acquisition the issuer answers unavailable (503temporarily_unavailable, the first key’s 60 s lead) is retried within a 120 s budget without spending one of its six attempts. Its five mains move in U4.
Origins.
-
In-request:
SharedOutbound::new(sender.calls(Origin::of(&principal))). -
Background tasks, durable retries and boot:
Origin::System.
Eligibility. Its hop two and fan-out are onward delegation (G9). TokenExchanger, ExchangePurpose::OrchestratorFanout, the exchanger client and EXCHANGE_TARGETS go.
Verification (E8, #2648). The four /internal/v1/ routes go behind the receiver at their own paths:
-
SOLQ uses its constant;
-
IEVS uses
system_from(&[Snap]); -
SAVE uses
system_from(&[Eligibility, Snap]).
eligibility, snap and web send bearers, and CANOPY_INTERNAL_API_KEY and api/service_key.rs go.
Keys in the devstack (K4, E3).
-
The Kanidm phase (SW2) writes
.devstack/identity/env/<client>.env(owner-only) for each confidential client:client_key_secret(client)with its key from.devstack/identity/keys/<client>.pem, and in canopy-web’s alsoCANOPY_WEB__UPSTREAM_CLIENT_SECRET. -
Each of the 15 client blocks, and canopy-web-xsite, names its file as an
env_filewithrequired: false, so every compose invocation, arunthat starts dependencies included, computes the same environment. -
A service started before the files exist boots without its key and refuses to start (E3: no file fallback). That is loud.
SW6. canopy-web’s origin, the ingress and the issuer (Q1, J1; amends Q1’s proxy clause)
The ingress. Two devstack services run the upstream image directly, so no build is needed and the prebuilt path pulls it: nginxinc/nginx-unprivileged:1.31.6-alpine3.24-slim@sha256:<digest pinned at U2>, non-root (uid 101).
| Service | Profiles | Alias | Port | Proxies to |
|---|---|---|---|---|
|
every |
|
its own allocated, same-port |
|
|
every |
|
its own allocated, same-port |
|
-
One service per origin keeps
SAME_PORT_SERVICESone port per service, and nginx never needs an absent upstream. -
Config and leaf: an envsubst template (
INGRESS_SERVER_NAME,INGRESS_PORT,INGRESS_UPSTREAM) and the leaf are installed by xtask into thecanopy_ingressvolume, read-only, by a one-off asdevstack_tls::installfills Kanidm’s. CI’s daemon sees no job files, so there is no bind mount. The template:-
terminates TLS;
-
sets
X-Forwarded-For $remote_addr(overwrite, never append),X-Forwarded-Proto httpsandHost; -
serves a plain
127.0.0.1:8081/healthzfor compose’s healthcheck (wget -q -O /dev/null).
-
-
Why nginx-unprivileged (judgment-protocols comparison, 2026-10-11):
Candidate Verdict Caddy 2.11.7-alpine
Runs as root by default, and its proxy manages
X-Forwarded-ForitselfHAProxy 3.2.25-alpine (LTS)
Equal fit, but a heavier config for two names
Traefik
Ships no Alpine image
An in-repo Rust proxy
Code to own and test
nginx is non-root, Alpine and BSD-2. It overwrites with one line, and is the commonest production ingress.
The leaf. devstack_tls::generate signs a second leaf (SANs web.canopy.test, web.canopy-xsite.test) in the same pass as Kanidm’s, since the CA key is never kept. current() checks every pair, and any miss regenerates all of them (SW2 restarts the readers).
Origins.
-
Public origins:
-
canopy-web:
CANOPY_WEB__PUBLIC_ORIGIN = https://web.canopy.test:<P_web>; -
canopy-web-xsite:
https://web.canopy-xsite.test:<P_xsite>. -
Each redirect is its origin plus
/auth/callback. The session cookie is alwaysSecure;redirect_urlandsession_securego.
-
-
canopy-web stops publishing its http port; the ingress is the host entrance.
-
The issuer:
-
canopy-security’s
identity_issuerand every receiver’s:https://web.canopy.test:<P_web>/identity; -
the internal URL:
http://canopy-security:8012/identity; -
the device URI:
https://web.canopy.test:<P_web>/device.
-
Kanidm. The Kanidm phase (SW2) sets the canopy-web client’s origin to canopy-web’s public origin and its redirects to both origins' callbacks, on every bring-up. That replaces the migration’s portless entry and registers the cross-site redirect.
Test inputs.
| Input | Value |
|---|---|
|
Set in |
|
Rendered in |
The broker’s |
Carries |
|
Accepts any registered redirect and builds the callback from the request’s own |
|
The https origins |
|
The https origin |
Host Rust tests reach canopy-web through canopy_test_lib::web_client(), which pins web.canopy.test to CANOPY_TESTWEB_ADDR and trusts the devstack CA. Kanidm’s Credentials::http_client() pins to CANOPY_TESTKANIDM_ADDR the same way.
Port moves. canopy-security binds no session to its own issuer, so a resample or a port recovery that moves canopy-ingress moves the issuer without ending sessions:
-
every service is recreated with the new env, and Kanidm is re-provisioned;
-
a token minted under the old
issis refusedtoken_rejected, and the sender’s retry re-mints under the new one; -
onward delegations and native proofs naming the old endpoint fail once and are re-minted;
-
canopy-cli’s stored session names its issuer (O4), so
tokenanswersLoginRequiredand the worker runscanopy loginagain; -
a Kanidm port move ends web sessions at their next renewal (
upstream_changed), as today.
Trusted proxies. The devstack sets no CANOPY_TRUSTED_PROXIES. Compose addresses are dynamic, entries are exact (Q2; CIDR is #2846), and every devstack client shares one address. The deployment guide states the production chain: the ingress overwrites; canopy-web trusts the ingress; canopy-security trusts canopy-web.
A host browser needs 127.0.0.1 web.canopy.test web.canopy-xsite.test idm.canopy.test and the devstack CA (.devstack/idp/kanidm-ca.pem) trusted. cargo xtask dev start prints both, and local-dev documents them.
SW7. Audit through canopy-identity (#2649, #1869)
-
The exchange audit goes:
ChainAuditSink,TokenExchanger, and the ingest’sauth.token_exchangearm (validate_token_exchange_purpose, its dedup key, its action mapping). The issuance log is the audit-before-release (A6, §13). Historical chain rows are untouched. -
#2649:
AuditEventIngestRequest.source_serviceleaves the request body. Both ingest arms stamp it fromprincipal.client()'sas_str()(the portal’s iscanopy-portal). The route admits system tokens and the portal (M4).
SW8. canopy-web’s session store (R4: "replaces its schema outright")
One migration drops web_session, web_login_flow and web_session_end, and creates these tables. Ids are UUID v7.
| Table | Columns and constraints |
|---|---|
|
|
|
|
|
|
|
|
Ends and replacement keep today’s semantics (web_session/store.rs):
-
Every end is one data-modifying CTE that deletes the row and inserts its end row.
-
Replacement (a re-sign-in or a step-up) is one transaction:
-
end the old row as
superseded, withsuperseded_bythe new id; -
if nothing was ended and the old row’s end reason is
signed_outoroperator, refuse and roll back; -
insert the new row.
-
-
Logout ends by its cookie’s
token_hash. Failing that, it followssuperseded_byfrom the end row with thattoken_hash, up to four links (MAX_SUPERSEDE_LINKS). -
So logout wins in both orders, and today’s race tests (
a_logout_racing_a_completing_callback_ends_the_superseding_sessionand its reverse) port. -
end_reason(key)reads the end row.
Flows.
-
A flow is written from
PendingAuthorization::expose_for_store(). -
It is taken with the single-use
DELETE … WHERE flow_hash = $1 AND state_hash = $2 AND expires_at > now() RETURNING …. -
It is rebuilt with
PendingAuthorization::restore(returned_state, nonce, verifier, max_age). The relying party’s 43-characterstatereplaces today’s 22-character one.
Sweeps.
-
Every 300 s, a sweep ends idle web sessions (
idle), deletes expired flows, and deletes end rows older than 30 days. -
NativeSessions::sweepmaintains native sessions every 30 s.
The record stays plaintext JSONB, as today’s grant is (field encryption is #2521).
The implementation. PgWebSessionStore (key: the session id) implements WebSessionStore, and PgNativeStore implements DueSessions. Their DB tests run contract::check and contract::check_due; canopy-web’s dev-dependency enables canopy-auth’s test-helpers.
Existing sessions and Studio drafts are dropped. Pre-1.0, workers sign in again.
SW9. canopy-web signs in and calls through canopy-identity (W1, V1, X1–X8)
Boot. canopy-web reads:
-
the upstream profile (
identity-upstream.yaml, mounted read-only as canopy-security mounts it); -
CANOPY_WEB__UPSTREAM_CLIENT_SECRET(SW2); -
CANOPY_WEB__IDENTITY_CLIENT_PRIVATE_KEY; -
the identity settings.
It builds:
-
UpstreamRelyingParty; -
FederationClient; -
WebSessionEngineoverPgWebSessionStore; -
WebSender::from_secrets; -
NativeSessionsoverPgNativeStore; -
AdminClient; -
EdgeForwarder.
Sign-in. A browser reaches Kanidm only by navigation, never by a redirect that follows a form submission. CSP’s form-action 'self' blocks those in Chromium, as auth/handoff.rs records. That module stays for every such step, and so does the cross-site callback’s SameSite=Strict fix.
| Route | Behaviour |
|---|---|
|
Renders the AC-8 page: the notice and a Continue link |
|
Creates the |
|
Creates a |
|
Takes the flow and completes it by kind, then answers the handoff page to |
|
|
The callback completes each kind as follows:
-
sign_in:complete_sign_in, then a new session row (a replacement when the flow namesreplaces_session_id); -
step_up: a replacement; -
device_approval:complete_approval.
A SignInError::Federation of auth_time_too_old (F4: a stale upstream sign-in) restarts the flow once with prompt=login (fresh_retry). A second refusal, like any other federation refusal, renders the refusal page with its code, missing_primary_programs included (C8).
Removed: /auth/select, /v1/auth/discover, /auth/local-login, IdpRuntime, the Keycloak parts of the auth/ tree, the old web_session/ store, api/mock_exchange.rs and their tests. D1 allows one upstream.
The AC-8 notice is jurisdiction.toml's new required [sign_in] system_use_notice, a list of paragraphs, parsed by canopy-composition and validated non-empty.
-
default and georgia carry the DoD Notice and Consent Banner (public domain), with "U.S. Government" read as "State of Georgia" in georgia. Its three paragraphs:
-
You are accessing a U.S. Government information system, which includes this computer, this network, all computers connected to this network, and all devices and storage media attached to this network or to a computer on this network. This information system is provided for U.S. Government-authorized use only.
-
Unauthorized or improper use of this system may result in disciplinary action, as well as civil and criminal penalties.
-
By using this information system, you understand and consent to the following: you have no reasonable expectation of privacy regarding any communications or data transiting or stored on this information system; at any time, and for any lawful Government purpose, the Government may monitor, intercept, and search and seize any communication or data transiting or stored on this information system; any communications or data transiting or stored on this information system may be disclosed or used for any lawful Government purpose.
-
-
test-max and test-min carry "This is a test system. Do not enter real personal information."
Roles.
-
WorkerRolegainsSecurityAdmin, last infrom_roles' precedence beforeUnprivileged. So a session holding onlysecurity_adminis admitted. -
Its handling at the six
WorkerRolematches:Match SecurityAdmin as_str,role_slug_for_workersecurity_adminworker_role_display"Security administrator"
surface_for_role, and the dashboard’s two redirect sitesRedirect to
/admin/security, asAuditor's does to/audit-logalerts_url_forNone
admit_roleAdmits it
-
can_writeand everymatches!gate leave it out. -
A session’s
security_admincapability is read from its roles, not itsWorkerRole. So a worker holding a case role andsecurity_adminkeeps their case landing and sees the "Security administration" nav link (base.html, both nav copies).
Extractors. require_auth serves through WebSessionEngine::current. A request’s SignedInWorker carries the subject, roles, programs and username from the session’s F2 answer (ADR-044: programs come from federation).
Calls.
-
A middleware inside the protected stack builds
WebSender::calls(session key, live, deadline)per request and insertsArc<WebOutbound>. -
ServiceClientsandInternalClientlose their stamped token. Each call goes throughsend_with_retrywith the request’s deadline. -
with_service_identity,svc_token, the exchanger and the six exchanged/review wrappers go. -
WorkerObservedSinkand the worker-name refill takeWebSender::system_bearer(Security). -
The panel cache keys on
(service, url, subject)(#2647). Every call carries the worker’s delegation, so the day-30 shadow-findings call carries its identity (#2803).
The route-authz gate (xtask/src/cmd/route_authz.rs):
-
The new sign-in routes are GETs in
main.rs, taint-checked like today’s/login. -
/auth/callbackstays inGET_TAINT_EXCEPTIONS. -
The removed routes' entries go.
-
EXPECTED_MUTATING_TOTALis recomputed in each unit that changes it.
SW10. canopy-web’s new pages (Y1, Z1, Q7)
Security administration (services/canopy-web/src/admin_security.rs, mounted in the protected stack by admin_security::routes()). Its extractor admin_security::SecurityAdminOnly requires security_admin; a session without it gets the 403 page.
| Method | Path | Does |
|---|---|---|
GET |
|
Look up a subject by |
GET |
|
Create form |
POST |
|
Create (K5) |
GET |
|
Links, sessions, suspension state |
POST |
|
Suspend |
POST |
|
Lift |
POST |
|
Revoke (form carries the subject to return to) |
GET |
|
Re-link form |
POST |
|
Re-link |
GET |
|
Signing keys |
POST |
|
Revoke a key |
GET |
|
Clients |
POST |
|
Disable |
POST |
|
Enable |
-
Each write takes an
AdminReasonand the checked id types, and redirects back (same origin) with a result notice. -
A write answered
StepUpRequiredrenders the handoff page toGET /auth/step-up?return_to=<the page>.
Device approval (services/canopy-web/src/device.rs, mounted by device::routes(), extractor device::ApproverSession, any admitted session):
| Method | Path | Does |
|---|---|---|
GET |
|
Code form |
POST |
|
|
POST |
|
Deny |
POST |
|
A |
GET |
|
Success, after the callback |
GET |
|
The worker’s native sessions |
POST |
|
Revoke this device. The row’s |
-
Every invalid code shows one message. A 429 shows its wait.
-
A sweep task runs
NativeSessions::sweepevery 30 s.
The gate.
-
policy_forgains arms foradmin_security.rsanddevice.rs. -
SCOPE_POLICYgainsNotProgramScopedentries for each new mutating handler.
The edge.
-
let edge_router = edge.router();merges outside the session and CSRF layers, under the edge limiter, withTrustedProxiesfromCANOPY_TRUSTED_PROXIES. -
COMPOSITION_ALLOWLISTgains("services/canopy-web/src/main.rs", "merge", "edge_router"), justified liketest_clock: canopy-auth’s forwarded identity routes, which take no cookie and change no canopy-web state (Q7).
SW11. Studio and the IdP tables (ADR-050 §2)
[identity], [[idp]] and [local_accounts] leave idp.toml, which keeps [roles.*] (ADR-022). Their removal reaches:
-
IdpDocument; -
the four rulesets;
-
Studio’s step 2, its probe,
IssuerProbeClient,canopy_auth::issuer_probeand their templates; -
step2_route_infra_tests.rs; -
the bundle’s
render_idp_toml.
The wizard has four steps. A jurisdiction’s upstream is deployment configuration (ADR-050).
SW12. The portal, canopy-cli and the operator tools (O1, O5, O7)
The portal.
-
PortalSender::from_secrets(withsend_with_retry) replacesPortalTokenSourcesat all 22 sites. -
PortalConfigswaps its OIDC fields for the identity settings and reservesIDENTITY_CLIENT_PRIVATE_KEY. -
tokens.rs,narrow_token_test.rsand the Keycloak start-race retry go.
canopy-cli.
-
Every command takes
DeviceClient::token(CanopyService)throughsend_with_retry. -
canopy loginruns the device flow (begin_loginprints the URI and code;complete_loginpolls).canopy logoutandcanopy token <service>stay. -
Profile: it carries
identity_issuer(the public issuer; the edge serves every endpoint) and an optionalca_file. The devstack profile derives both and pinsweb.canopy.testtodocker::published_host(). -
Goes:
login service, the password grant,exchange_for_audience,keycloak_*,devstack.rs's Keycloak proof, the notice mark-read verb (#2805), and their tests.
The operator tools.
-
sweep-finalize-orphanstakes the operator’s device session from canopy-cli’s store for its profile (--profile). -
identity verifyandidentity render --backend keycloakgo.identity checkstays.
SW13. The battery (K7, J1)
Rust. canopy-test-lib gains tokens, over one process-wide TokenBroker (BrokerConfig::from_env):
| Helper | Mints |
|---|---|
|
A delegation as canopy-web |
|
A stepped-up delegation |
|
A system token |
|
The portal’s system token |
|
A canopy-cli delegation, from a device session per person (below) |
The broker’s canopy-cli sessions. TokenBroker gains a device session per person, all production grants (D14):
-
DeviceClient::begin_loginas canopy-cli, over a store under the broker’s cache; -
the broker approves the user code as canopy-web does: its spaced Kanidm sign-in,
step_up_options(), andFederationClient::approvewith the person’s web session; -
complete_login.
Then DeviceClient::token(target).
cast(U) is the realm username, except admin, which is canopy.admin (K3). applicant.test has no account (D11), so its rows take the portal path.
Each Keycloak site maps by the route’s admission, in this order:
-
A worker acting (a password grant, or an exchange as U) becomes
worker(cast(U), target)when canopy-web holds a delegation edge to the target, elsecli(cast(U), target). -
A service token on a route with a system arm becomes
system(c, target):-
under
system_from(&[X]),cis X; -
under
system(),cis the first client inCALLERSorder, excluding canopy-web, canopy-portal and canopy-cli, whose edge to the target isSystemorBoth. -
Every non-web via row has a system arm (21 of 21).
-
-
A service token on a route with no system arm becomes
worker(p, target)orcli(p, target), by which via actor the row lists.pholds the route’s role set, per the table below. -
canopy-web’s 18 service-token sites become
worker. -
The portal’s scoped tokens become
portal(target, scope). -
A test of eligibility’s onward hop calls eligibility as a worker, and eligibility delegates.
| Role set | Cast person |
|---|---|
|
jane.caseworker |
|
jane.qc |
|
jane.auditor |
|
jane.supervisor |
admin |
jane.admin |
quality_control |
qc.reviewer |
data_steward |
data.steward |
fti_auditor |
fti.auditor |
studio_admin |
jane.studio |
security_admin |
sec.admin |
Negative tests keep the property they assert, not the token they used:
-
A token the issuer will not mint (no edge) becomes two assertions: the broker reports the issuer’s refusal, and the receiver refuses the nearest mintable token (another receiver’s, 401
token_rejected). -
Example: rules'
worker_tokens_rejected_post_cutoverasserts:-
canopy-web cannot mint a rules delegation;
-
a persons delegation is refused by rules;
-
a
clidelegation from a person outsideCASEWORKER_OR_ABOVE_ROLES(jane.studio) is refused 403required_role_missing; -
a
clicaseworker is admitted, per I3c2’s rows.
-
Other Rust test changes:
-
Lifetime: no test holds a token past one minute; long tests re-mint, which is cheap because the broker reuses sessions.
-
The 11
receiver_contract_test.rsbecome identity contract tests. Per service they cover:-
no bearer: 401
token_missing; -
another receiver’s token: 401
token_rejected; -
X-Canopy-Actor: 400actor_header_retired; -
a cast worker lacking the role: 403
required_role_missing; -
the portal on a non-portal route: 403
portal_on_non_portal_route, where the service has a portal route.
-
-
The
qc_read_onlytests takeworker("qc.reviewer", …). -
mock_issuer.rskeeps its upstream surface: discovery, JWKS, userinfo, minting, and whichever/tokenarms a canopy-identity suite or the perf substrate uses. It drops introspection, client credentials, RFC 8693 exchange anddiscovery()'sOidcDiscovery. -
Deleted:
introspection_mock_issuer_test,claim_contract_mock_issuer_test,issuer_probe_test,trusted_issuer_discovery_test,exchange_audit_e2e_test, the F4 Keycloak conformance matrix (conformance_matrix_testandconformance.rs), and in-service tests of Keycloak itself (rogue exchanger azp, direct versus exchanged, broad and multi-audience, the hop-two pair, the Keycloak-user fresh hire, the src infra tests building Keycloak sources). -
loud_miss_pinscans follow the new names.auth.rsgoes with its last caller in U17.
The Kanidm lane’s oracle stays independent of canopy-auth’s validator (idp_conformance_kanidm.rs's module doc). Before U19 deletes jwks and claim_contract:
-
login.rs'sverifytakes a private copy ofbind_algorithm's algorithm-to-key binding, and its access-token checks keep that oracle. -
oidc_generic_contract()?.project(…)becomesupstream::projectover anoidc-genericUpstreamProfile, with the conformance assertions readingFederatedIdentity'ssub(),roles()andprograms().
Playwright.
-
auth/setup.ts: signs its nine workers in withrouteUpstreamSignInat canopy-web’s origin and saves their storage states. Each run signs in afresh:clear_playwright_auth_cacheand the cache mount go. -
Budgets:
auth-setup,journeyand every project whose specs call the helper inline (auth,auth-cross-site) take the identity-plane budgets:timeout: 300_000andnavigationTimeout: BROKER_BUDGET_MS. -
TLS trust: Chromium pins the ingress leaf’s SPKI battery-wide. xtask computes
CANOPY_E2E_WEB_SPKIfrom the leaf it generated, andplaywright.config.tsadds it to every project’slaunchOptions.args.ignoreHTTPSErrorsis never used. Node trusts the devstack CA throughNODE_EXTRA_CA_CERTS(the CA installed into canopy-e2e’s inputs). -
The given helpers:
lib/given/auth.tsgives way to broker helpers mapping by Rust’s rules, across 35 files. -
Specs:
-
auth.spec.tsasserts canopy-web’s own sign-out: the session ends,/loginshows the notice, jane.unscoped’s refusal page, and the stale-SSO restart’s single retry. -
auth-cross-site.spec.tssigns in at the xsite origin. -
The two journeys' inline sign-ins take the helper.
-
Studio’s three issuer-probe tests go.
-
-
A real redirect chain. The
@identityspec gains "a worker signs in to canopy-web through Kanidm’s pages", once at each origin. A Chromium pinned to Kanidm’s and the ingress’s leaves goes:-
/login, then Continue; -
Kanidm’s pages (the page object);
-
the callback’s handoff;
-
signed in.
The xsite run proves the
SameSite=Strictsession cookie arrives.
-
-
cargo xtask e2ebrings the broker up for every run. Theno_ci_e2e_run_starts_the_token_brokerpin flips to "every run starts it", and CI’s e2e lanes build the broker image in their daemon.
k6. All four profiles take per-VU createTokenCache tokens: system('canopy-eligibility', …) for their targets. smoke drops its unused worker token. perf brings the broker up for every profile, and KEYCLOAK_URL goes.
SW14. Deletion (K1)
U19 deletes what earlier units have not:
-
Devstack: the devstack’s Keycloak directory, the compose service, its 21
depends_on, and everyOIDC_*, exchanger, audience andEXCHANGE_TARGETSkey. -
xtask:
-
the Keycloak port (
PORTS_ENV_VERSIONbumped); -
realm drift, heal and reimport (
dev reimport-realm), and the #1900 token-holder restarts; -
the perf
keycloakcell; -
validate’s
heal-realm-driftstage; -
the call-graph advisories reading the legacy env;
-
validate-in-network’s realm pins;
-
issuer_http's password and secret grants.
-
-
canopy-auth:
token_exchanger,service_token(and itsBearerSourceimpl),jwks,identity_config,receiver,middleware,exchange_audit,policy,validatorandsubject_bearer. Also:-
introspection, exceptServiceCredentials, which moves underupstream; -
Claims, withROLE_VOCABULARYand the role sets moving tocanopy_auth::roles; -
claim_contract, keeping onlyJsonPointer, which moves underupstream; -
discovery, withTOKEN_EXCHANGE_GRANTmoving toidentity_session; -
client_ext::with_service_identity, keepingACTOR_HEADERand the finalize headers.
-
-
Other crates: canopy-api’s legacy
BootstrapResultfields and bootstrap path; canopy-common’s nine settings.
SW15. Settled issues
-
Implemented here: #2649 (SW7), #2647 and #2803 (SW9), #2648 (SW5), #2805 (SW12), and #2344 and #2345 (the relying party, wired).
-
Superseded, each closed after merge with its mapping:
-
#1869: the exchange audit is gone (SW7).
-
#1901:
ServiceTokenSourceis gone, and the sender never fails open (E6). -
#1447: every receiver has its own audience and checks a system token’s edge (L3), and each contract test refuses another receiver’s token.
-
#1595:
-
JWKS non-200 maps to
a_defective_answer_is_a_failed_fetchanda_failed_refresh_keeps_the_set_until_it_is_stale. -
The stale bound maps to
a_set_past_720_s_fails_closed. -
Leeway maps to
identity_token's time-rule tests. -
Discovery, introspection and exchange no longer exist.
-
-
SW16. New input surfaces
The admin forms, the device forms and the sign-in routes' query parameters get evil-input cases (oversized fields, control characters, non-UTF-8, malformed ids and codes). Each asserts a 4xx, no echo of the input, and no state change. The checked types (AdminReason, CheckedPair, UserCode) already carry their own proptests.
Units
Subjects are at most 72 characters, ending in (#N). Every unit follows SW1.
Erratum (2026-10-12): U2’s ingresses are ingress and ingress-xsite (the canopy- prefix marks fleet application services in xtask), both in every profile so the xsite origin’s port and registered redirect hold without an e2e run; web.canopy-xsite.test stays canopy-web-xsite’s alias, and canopy-web keeps publishing its http port, until U9 serves the https origin, and TestConfig.web_url, CANOPY_E2E_BASE_URL and CANOPY_E2E_XSITE_BASE_URL move with U9 and U18 (SW6’s table corrected). Kanidm’s canopy-web redirects leave the static migration, which Kanidm re-applies at every start, and xtask sets them over REST on every bring-up and records them in the Kanidm credentials file (Credentials.redirect_uris); the broker and the devstack tests read them there (identity_broker::registered_redirect), not from CANOPY_TEST__WEB_ORIGIN. The shared published-host rule is canopy_test_lib::docker_host, and the web client is web_origin::web_client.
Erratum (2026-10-12): U3 delivers the client keys and canopy-web’s Kanidm client secret through per-client env files that docker-compose.yml names as env_files, not interpolated variables, so every compose invocation carries them (SW5’s paragraph corrected); it reserves IDENTITY_CLIENT_PRIVATE_KEY (and canopy-web’s UPSTREAM_CLIENT_SECRET) in each client service’s RESERVED_KEYS, which SW3 placed in U4, since the injection is what requires them. canopy-web-xsite is not among the TLS and profile readers restarted: cargo xtask e2e removes it after every run, so it always starts on the current material.
Erratum (2026-10-12): U4 builds the shared clients and CallerContext on BearerSource as SW5’s corrected bullets say (PersonsClient::system / on, RulesClient's per-call source, rejected async). The bootstrap builds the receiver and sender before any connection, so a missing client key refuses the boot before migrations; each service layers its Arc<IdentitySender> as an extension in the unit whose handlers first send through it (U6, U7). Tests build a user or system Principal with canopy_auth::identity_receiver::test_principal (test-helpers), and an AppState with canopy_test_lib::identity::offline_receiver or devstack_receiver; a call to a stub receiver takes canopy_test_lib::identity::FixedBearer. canopy-test-lib’s library enables canopy-auth’s test-helpers, which no production image builds.
Erratum (2026-10-12): U6 hands each request’s handlers an owned outbound, canopy_auth::RequestOutbound, which request_outbound_middleware (installed inside the receiver with the service’s sender) inserts as an extension, in place of a SharedOutbound each handler builds; a test inserts a FixedBearer in its place. A service-local client holds the sender (system origin) and on(source) swaps in a request’s outbound where a call carries the caller; existence probes (canopy-validators) and shared bookkeeping (appeals' adverse-action stays) stay on the sender, as B4 allows. SW4’s appeals and reporting operator routes admit canopy-cli as written, but the compiled graph holds no canopy-cli edge to either service, so they admit no caller until #2886 settles one. canopy-security and the other admin routers keep their ReceiverContract until U7 ports canopy-api’s admin routes.
Erratum (2026-10-12): U7 renames PersonsClient::system to calls (U4’s erratum corrected) and adds with_source, so a request’s copy of a shared client carries the caller: canopy-applications' deps extractors, ReopenSagaDeps::on and PostponementSagaDeps::on (inline saga drives included) build theirs on the request’s outbound, and the other service-local deps gain on(source) as in U6; canopy-reporting’s clients retry a 401 around canopy_api::retry, which owns each send. canopy-overpayments' list admits by the mounting service’s delegated constant, which the mounting router layers as an api::ListAdmission (api::routes(admission) does; canopy-snap layers its own beside its create handler). CallerContext goes: the TANF and Medicaid determine take the Principal and a BearerSource. Eligibility’s run config carries the request’s outbound and the sender (DetermineConfig { source, system }), the sender for the reads I3c2 M4 keeps system (the replayed operation’s envelope; the bulk-run admin routes' corpus, provenance and universe reads); EXCHANGE_TARGETS leaves its config and docker-compose.yml, and its SSA SOLQ pre-dispatch stays off in development (#2495), which the retired key’s absence ensured. canopy-reporting has no service-only route, its run reads dropping the service arm (no system edge), so #2886 concerns appeals alone. The snap and medicaid provenance gates and canopy-applications' determination context admit canopy-eligibility by principal.client(), its onward delegation as well as its system token.
Erratum (2026-10-12): U8 removes the ingest’s auth.token_exchange arm and every intake-side dedup producer (the bus arm’s parse, the v1 append’s key probe, the staged row’s unhashed key); ChainAuditSink stays, naming no source, until canopy-web’s exchanger goes in U9. The chain-v2 drainer keeps honoring a dedup key on rows staged while the exchange audit ran, and the dedup_key columns stay. The intake’s poison tests quarantine a number-fence failure in place of a retired purpose. audit_ingest_test.rs loses its three exchange-arm tests and exchange_audit_e2e_test.rs its jti-replay test; its round trip still asserts canopy-portal as the source, so U16 asserts the id of the client its token is minted for instead.
Erratum (2026-10-12): U9 evolves web_session/ in place: the store, flows and sweep keep their files, the Keycloak grant gives way to record.rs's WebSessionRecord encoding, and engine.rs and native.rs hold the two WebSessionStore implementations. Handlers keep SessionData, built per request by SessionData::admit from the served session, in place of a SignedInWorker. The serve binds the boot roster, layered only as clients::SharedRoster, to each request’s outbound, so a handler can extract no unbound roster; InternalClient keeps its own transient-retry and deadline loop and re-mints once after a 401 inside it, under RETRY_FLOOR, rather than through send_with_retry (no canopy-web upstream answers a step-up challenge; the security-admin calls take AdminClient in U10). The callback refuses a device_approval flow; its completion, NativeSessions and the native sweep move to U11, and AdminClient and EdgeForwarder are built in U10 and U11 with their routes. The base.html "Security administration" link moves to U10 with the pages it names; until U10, a worker whose only role is security_admin is admitted and redirected from / to /admin/security, which U10 adds, and SessionData::is_security_admin lands with its tests for U10’s extractor and link to read. The sign-in routes' evil-input cases assert no echo, no stored return path and no 5xx, not a 4xx: #2520’s validator drops a refused return_to rather than refusing the request, and it gains a 2 048-byte cap. A role whose / redirects away is named once, api::dashboard::landing_elsewhere. The route harnesses take counted fixed bearers (HarnessBearers), asserting each upstream call’s delegation. step2_route_infra_tests.rs signs its worker in through the scripted sign-in (auth::test_support::World) until U12 deletes the step. canopy-web keeps publishing its http port, and TestConfig.web_url its http default, until U18 moves the e2e battery to the https origins (U2’s erratum corrected).
Erratum (2026-10-12): U10’s pages share one template, its view chosen server-side, and the nav link reads NavRole, the type every page’s worker_role_slug now has: the role’s slug plus the session’s security_admin. WebIdentity holds the AdminClient, and SecurityAdminOnly carries the request’s outbound, the client and the theme. A write’s form is read through AdminForm, which refuses a body that is not UTF-8 before a lossy decode could pass it. admin_security::routes() is generic over the router’s state, which no handler reads, so the route tests mount it on the scripted world.
Erratum (2026-10-12): U11’s approval flow stores the approving worker’s web-session id in web_login_flow.replaces_session_id, which the callback serves to complete the approval, since the upstream’s cross-site return carries no SameSite=Strict session cookie; its stale step-up retry takes the step-up options. Code entry’s and approval’s refusals add user_code_invalid and approver_mismatch to auth::Refusal. ApproverSession serves the worker’s web session again for code entry, which presents it. WebIdentity holds the NativeSessions; main.rs builds the EdgeForwarder and merges it into the outer router before the per-IP limit.
Erratum (2026-10-12): U12 retires [[idp]] and [local_accounts], but [identity] stays in the rulesets until U19: the legacy bootstrap’s IdentityConfig::load, which SW1 keeps to U19, refuses a boot without it. IdpDocument accepts the table unread (LegacyIdentityTable; the shipped rulesets' tables are checked through IdentityConfig in idp_test.rs), and the Studio bundle no longer renders it, so a bundle generated between U12 and U19 boots only once U19 deletes the legacy bootstrap. The probe’s runtime cap moves to canopy_auth::discovery::ISSUER_BODY_CAP until U19 deletes its readers, and canopy-api’s SharedKeyedLimiter, a general keyed limiter, stays without its one consumer.
Erratum (2026-10-12): U13 narrows SW5’s retry. A sender re-mints and resends only a 401 whose WWW-Authenticate is a Bearer challenge naming no error or invalid_token (canopy_auth::refuses_the_bearer), as every receiver’s and canopy-security’s admin guard’s token refusals are. A route’s own 401 (canopy-applications' wrong applicant credential, which a resend would check twice) and a step-up 401 are returned as they came, read from the challenge alone. canopy-web’s InternalClient loop and AdminClient take the same rule, and stub receivers answer canopy_test_lib::identity::bearer_rejected(). The portal builds its sender at boot, refusing the boot without its identity settings or key, and mints lazily, so the Keycloak start-race retry goes with no replacement; /readyz mints the canopy-applications token. The portal no longer reads idp.toml's [identity].
Erratum (2026-10-12): U14’s devstack is a reserved profile name derived on every run from .ports.env's CANOPY_TEST* keys (issuer, CA, service URLs), the issuer’s host pinned to CANOPY_TESTWEB_ADDR through IdentityHttpClient::with_trust; the global --devstack switch goes, and token show becomes token <SERVICE>. DeviceClient is a BearerSource whose rejected drops nothing, since each bearer is a fresh refresh. The sweep opens canopy-cli’s Session, so xtask depends on canopy-cli’s library. identity render goes whole (Keycloak was its only backend), and with identity verify gone U14 deletes issuer_http.rs and the devstack secret fallbacks SW14 gave U19. The broker’s device approval (TokenBroker::approve_device) lands in U14 for its devstack login test, and canopy-test-lib gains device_flow's stub issuer and receiver; U15 keeps the per-person device sessions and tokens::cli. cli_test.rs's Keycloak-token tests compile but fail until U17.
Erratum (2026-10-12): U15 keeps each person’s device store at <broker cache>/cli/<person> and serializes a login under the person’s cache entry, which approve_device now holds throughout. A stale device session is replaced, not awaited: the broker keeps no native record, so nothing renews it. BrokerConfig gains web_addr (CANOPY_TEST__WEB_ADDR), which the token-broker service’s compose block and xtask’s broker config now set. canopy-cli’s refresh and begin_login are retried on 503 like the broker’s other grants. The session-reuse and TOTP-spacing tests are one test, since only a fresh login makes the reuse check free of timing. The token-broker service answers a device error broker_failed until a unit has it mint canopy-cli tokens.
Erratum (2026-10-12): U16’s tokens::portal takes scope: Option<&str> (None: every scope, as the portal sends), and tokens adds or_skip (each helper as an Option, a miss reported through skip_or_panic), cast and system_caller (SW13’s system() rule over the compiled edges); bearer_sub, bearer_iss and mint_applicant_claim move into it. The mock issuer drops /token whole, since no suite or the perf substrate used any of its grants; TestClient::authenticated, uncalled, is deleted, and VerificationClient::with_token carries E8’s bearer. The QC write-gate sweep reads each handler’s admitted constant, which surfaces two write-verb routes admitting QC, waived: snap’s determination dry run, which is write-free, and rules' evaluate, whose only writes are its evaluation audit and telemetry, a read under SW4 and I3c2. The security and enrollment loud-miss pins scan the qualified tokens:: calls; applications' waits for U17. Appeals' canopy-cli operator routes admit no mintable caller until #2886 gives canopy-cli an edge to canopy-appeals and canopy-reporting; that defect is this branch’s, so #2886 lands on it after U16, and appeals' operator-route tests fail until then.
Erratum (2026-10-12): #2886 adds canopy-cli’s delegation edges to canopy-appeals and canopy-reporting, their profile URLs and the devstack profile’s derivation of them, and a command per operator surface: canopy appeal and canopy ipv for appeals' OPERATOR_READ, OPERATOR_WRITE and OPERATION routes, and canopy report for reporting’s routes but the overpayment summary canopy-web calls (every reporting route admits its roles through any actor, so the edge is their caller). No route’s admission changes.
Erratum (2026-10-12): U17 adds canopy_test_lib::identity::devstack_sender(client), a service’s real sender over the devstack, for in-process routers whose requests call live peers (canopy-applications' harness, eligibility’s bulk run). The applications suites file recertifications as a canopy-web worker: the renewed certification’s read rides the request’s outbound, and canopy-applications' edge to canopy-renewals is delegation alone, so a system-origin filing, which no production caller makes, answers 502. canopy-cli’s integration tests send tokens::cli delegations through ApiClient, and canopy_test_lib::auth is deleted with its last caller; the e2e and k6 helpers still name it until U18.
Erratum (2026-10-12): U18’s stale-SSO single retry has no e2e test: canopy-identity judges sign-in age on the wall clock and Kanidm stamps auth_time from the session the broker just opened, so no browser run can stage it; U9’s a_stale_upstream_sign_in_is_retried_once_with_prompt_login keeps it. auth and auth-cross-site become projects of their own, and routeSignInStart turns canopy-web’s /login/start 303 into a script navigation, which Playwright can route. The broker service gains POST /v1/tokens/cli. The TypeScript helpers mirror Rust’s tokens (orSkip answers null only when the broker is unreachable; a refusal throws), with systemArm, held and tokensAgain for long flows, and an xtask test holds their system-caller table to the compiled edges. canopy-web publishes no port (PORTS_ENV_VERSION 7): .ports.env drops CANOPY_E2E_BASE_URL and CANOPY_TESTWEB_URL, TestConfig.web_url reads CANOPY_TESTWEB_ORIGIN, and the clock-lane probe moves to canopy-applications. KEYCLOAK_REALM_AFFECTING_SERVICES keeps its canopy-web entry until U19 deletes the realm heal. k6’s profiles mint every target’s token as canopy-eligibility, which holds an edge to each, and k6’s Keycloak auth helper goes.
Erratum (2026-10-12): U19 removes ten legacy ServiceSettings fields, the exchanger pair counted as two, and the compose services' Keycloak-only extra_hosts with them. What the deletions leave unreferenced goes too: oauth_error, ServiceCredentials::sent_secrets, canopy-common’s deadline_retry and ApiError::identity_unavailable(), canopy-contracts-security’s token-exchange audit types, canopy-api’s SharedKeyedLimiter, canopy-test-lib’s JWKS chaos fixture and TestConfig.keycloak_url, and applicant from ROLE_VOCABULARY, which nothing reads once Claims::require_applicant goes. identity check caps the issuer’s answers at JWKS_BODY_CAP in place of the retired ISSUER_BODY_CAP. It also fixes the branch’s leftover unused dependencies (canopy-verification’s canopy-secrets and subtle, canopy-web’s jsonwebtoken), a canopy-web test reading an error’s top line for its chain, and the earlier units' broken private intra-doc links.
-
U1 (#2864, w3)
docs(adr): record the switch—type::documentation,service::security.-
ADR-049 Amendment 25 (R24–R26, SW1–SW16), its Status line, and the amendments to K1, T5 and Consequences.
-
This page (
In progress) and its nav group. -
The 20 issues and the epic list.
-
The external-review issue (
type::security,priority::high,workflow::blocked), related to &133.
-
-
U2 (#2865, w5)
feat(devstack): serve canopy-web at its https origin(SW6) —type::feature,service::devstack.-
The ingress services and their volume install, the second leaf, the ports.
-
The issuer and device URI; the test inputs and published-host addresses; the broker’s
redirect_urisand the helper’s membership check. -
Tests:
-
the TLS pair and regeneration;
-
each ingress block (alias, same-port, the XFF overwrite line, healthcheck, non-root, no build);
-
the issuer pins;
-
web_client()and Kanidm’s pin under atcp://DOCKER_HOST; -
the helper accepts both registered redirects.
-
-
-
U3 (#2866, w5)
feat(xtask): stage Kanidm and hand services their identity secrets(SW2, SW5) —type::feature,service::xtask.-
The Kanidm phase on all four paths.
-
The provisioned origin and redirects.
-
The key and upstream-secret pairs in every
upenv, and the 15 interpolations. -
The readers' restarts.
-
Tests:
-
each path’s order;
-
the secret in the stack’s
upenv; -
each client block interpolates its key;
-
TLS_READERSandsettle_profilename canopy-web.
-
-
-
U4 (#2867, w8)
feat(api): boot every service on canopy-identity(SW3, SW5) —type::feature,service::shared-crates.-
Settings, mirroring and reserved keys; the bootstrap’s receivers and senders;
AppStateand its constructions. -
BearerSource,SharedOutboundandsend_with_retry;PersonsClient,RulesClientand their callers;signing_registration. -
canopy-security’s receiver; exchange;
depends_on; the test receivers. -
Tests:
-
missing identity settings or key refuse boot;
-
each config loads with its injected key;
-
/v1answerstoken_missing; -
exchange mounts no
/v1; -
send_with_retryretries once after a 401, never after a step-up 401 or another status, and not underRETRY_FLOOR; -
SharedOutbound's concurrent callers share one mint; -
signing registration survives 70 s of
temporarily_unavailable; -
canopy-security’s issuer still loads.
-
-
-
U5 (#2868, w3)
feat(auth): name each delegated route’s admission(SW4) —type::feature,service::shared-crates.-
Tests: the table’s rows equal the constants; the existing row tests.
-
-
U6 (#2869, w8)
feat(services): admit and send through canopy-identity, part 1(SW4, SW5) —type::feature,service::persons.-
persons, rules, security, verification (E8, the key deleted), notices (its CLI-operator routes), enrollment, renewals, appeals, caps, wic.
-
Tests: each service’s in-crate admission tests on
Principal; verification’s internal routes refuse the key.
-
-
U7 (#2870, w8)
feat(services): admit and send through canopy-identity, part 2—type::feature,service::applications.-
applications, eligibility (onward delegation), snap, tanf, medicaid, reporting, canopy-overpayments, canopy-api’s admin routes.
-
Tests: as U6; eligibility’s fan-out delegates onward over one
SharedOutbound.
-
-
U8 (#2871, w3)
feat(security): stamp audit sources from the client(SW7) —type::feature,service::security.-
Tests: each arm stamps the authenticated client; the portal’s events stamp
canopy-portal.
-
-
U9 (#2872, w8)
feat(web): sign in and call services through canopy-identity(SW8, SW9) —type::feature,service::web.-
The migration and both stores; sign-in, step-up, callback, logout, the AC-8 page and its ruleset field.
-
Roles, extractors, the outbound middleware and roster; the wrappers deleted; the panel-cache key.
-
Tests:
-
contract::checkandcontract::check_dueon Postgres; -
the ported replacement and logout race tests;
-
the flow round trip through
restore; -
each callback kind answers a handoff;
-
the stale-SSO single retry;
-
the refusal page;
-
SecurityAdminadmission and landing; -
one subject’s panel-cache entry is served to no other subject;
-
a receiver’s 401 re-mints once.
-
-
-
U10 (#2873, w5)
feat(web): add the security-admin pages(SW10, SW16) —type::feature,service::web.-
Tests: a non-admin gets 403; each write’s reason and CSRF;
StepUpRequiredanswers the handoff to/auth/step-up; the evil-input cases.
-
-
U11 (#2874, w5)
feat(web): approve devices and mount the identity edge(SW10, SW16) —type::feature,service::web.-
Tests:
-
the invalid-code message;
-
a 429 wait;
-
/device/approveanswers a handoff; -
approver_mismatchapproves nothing; -
revoking another worker’s device answers 404 and revokes nothing;
-
the edge’s routes resolve;
-
the evil-input cases.
-
-
-
U12 (#2875, w3)
feat(web): retire Studio’s identity step(SW11) —type::feature,service::web.-
Tests: the four-step wizard; the bundle has no identity tables; each ruleset parses with its notice.
-
-
U13 (#2876, w3)
feat(portal): send the portal’s calls with its sender(SW12) —type::feature,service::portal.-
Tests: a target outside the nine is refused locally; a 401 retries once.
-
-
U14 (#2877, w5)
feat(cli): sign canopy-cli in with the device flow(SW12) —type::feature,service::shared-crates.-
Tests: a devstack login approved through the broker’s device approval;
canopy token; logout;LoginRequiredunder another issuer; the sweep with a device session.
-
-
U15 (#2878, w5)
feat(test-lib): mint canopy-cli tokens through the broker(SW13) —type::feature,service::shared-crates.-
The broker’s device sessions and
tokens::cli. -
Tests: a cast person’s
clitoken is admitted by a via-CLI row; the session is reused; the TOTP spacing holds.
-
-
U16 (#2879, w8)
test: mint the Rust battery’s tokens through the broker, part 1(SW13) —type::chore,service::shared-crates.-
canopy-test-lib’s
tokensand its own suites; the Kanidm oracle’s port. -
persons, rules, security, verification, notices, enrollment, renewals, appeals, caps, wic.
-
-
U17 (#2880, w8)
test: mint the Rust battery’s tokens through the broker, part 2—type::chore,service::applications.-
applications (its harness on
devstack_receiver), eligibility, snap, tanf, medicaid, reporting, web, portal, cli. -
auth.rsdeleted.
-
-
U18 (#2881, w8)
test(e2e): sign the e2e battery in through the broker(SW13) —type::chore,service::web.-
auth-setup, budgets, TLS trust, given, specs, the real redirect chain, the xtask and CI broker wiring; k6’s four profiles and
perf.
-
-
U19 (#2882, w8)
chore: delete the Keycloak path(SW14) —type::chore,service::devstack. -
U20 (#2883, w5)
docs: describe the system on canopy-identity—type::documentation,service::security.-
ADRs: ADR-049’s Status (effective) and Amendment 25’s as-built record. The detailed amendments of ADRs 007, 017, 019, 023, 037, 043, 044, 046 and 048, replacing their banners.
-
Pages: idp-integration, configuration-reference, local-dev (hosts, CA, ingress, the staged bring-up), security, security-operations (client-key rotation), deployment-guide (R24’s prerequisites, the proxy chain), services and the
api/pages, authorization-inventory, testing, shared-crates, canopy-cli, xtask-catalog, the finalize-orphan runbook, the guides, the walkthroughs and troubleshooting. -
Close-out: CHANGELOG (Added, Changed, Removed, Security; the attribution change); the plan Done and archived;
plan-lint --donewith--allow-openfor U1–U20, the external-review issue, the SW15 issues closed after merge, and Scope’s open issues; after merge, the SW15 closures and the epic’s tasks ticked.
-
Each unit updates the canonical page for its own surface (e.g. an API page whose route admission changed). U20 sweeps the rest.
Scope
In: K1’s switch, SW1–SW16, and the issues SW15 names.
Out:
-
#1303 and the external review (deployment prerequisites, R24).
-
#2804 (case tab role filter, a pre-existing defect).
-
#2811 (SAVE routes), #2790 (issuer pool bursts), #2846 (CIDR proxies), #2521 (session field encryption).
-
&134 (alternative upstreams).
Risks
-
A long local branch. Bundles after each unit; main barely moves (single developer); a rebase before the push.
-
Developer setup. Hosts entries and CA trust become necessary to sign in from a host browser.
dev startprints both. -
A moving issuer. A port move re-mints every token, and canopy-cli asks for a new login (SW6).
-
Battery time.
-
Each fresh auth-setup takes nine headless sign-ins, which run in parallel because each person is distinct.
-
The broker starts for every e2e and perf run, the pre-push smoke included.
-
canopy-cli sessions cost one device approval per person, reused afterwards.
-
-
canopy-security as a boot dependency of everything. Its receiver is in process and it calls no service.
-
Attribution change. System callers' audit rows carry the client id from the merge on (SW4, CHANGELOG).
Verification
-
Per unit:
cargo check(SW1), fmt, clippy and unit tests on the touched crates, check-docs, plan-lint. -
Before the push (on a devstack brought up from
dev clean, so the staged bring-up and a fresh issuer are exercised):-
cargo xtask validate(the pre-push battery: nextest including infra tests, e2e, docs, perf smoke); -
cargo xtask e2e(every project,identity-planeand@identityincluded); -
cargo xtask perf --profile loadand--profile identity-tokens; -
cargo xtask delegated-routes check; -
cargo xtask identity check --client canopy-eligibility.
-
-
By hand, recorded in the MR:
-
a host browser signs in at
https://web.canopy.test:<P>past the AC-8 notice; -
sec.adminsuspends and lifts a subject through a step-up; -
canopy loginapproved on/device, thencanopy persons list.
-
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic |
claude-opus-5-5 |
No-ship. Nine blockers, fixed: compile order: SW1’s porting rule, the Keycloak pieces kept to U19, |
2 |
not stated (the maintainer’s other vendor) |
not stated |
No-ship. 19 findings (5 P1), fixed in-plan: the staged Kanidm bring-up before the stack (SW2);; reserved secret keys (SW3);; sign-in by navigation with the handoff kept, and a real redirect-chain spec (SW9, SW13);; the end log’s |