Plan: Internal Token Issuer, Cut-over and Production (epic &112, stage S2)
- Status
- Context
- Scope
- U17 — The switch: cut-over and rollback (weight 8, P3-low,
feat/iti-u17-switch, after U2–U16) - U18 — Collapse the devstack IdP clients (weight 3, P3-low,
chore/iti-u18-one-idp-client, after U17) - U19 — Conformance suite tie-in, #2688 (weight 3, P2-medium,
test/iti-u19-conformance, after U17) - U20 — Docs and runbooks (weight 3, P3-low,
docs/iti-u20-docs, after U18, U19) - U21 — Production gate: the external security review (weight 2, P3-low,
chore/iti-u21-security-review-gate, after U20, last)
- U17 — The switch: cut-over and rollback (weight 8, P3-low,
- Risks
- Review log
Context
ADR-085 decides the design. Plan Internal Token Issuer builds it, unwired, in U1–U16, and fixes the placement (§A), settings (§B) and cut-over mechanics (§C) these units use. The two pages are one program, split at the switch to keep each under the plan size cap; unit numbers continue, and both were reviewed together.
-
Units. Each becomes a child issue of epic &112 on approval, with the title, weight and priority given here, its canonical doc page and a
CHANGELOG.adoc== Unreleasedentry. -
Prerequisites. U2–U16 have merged; #2688’s suites exist before U19.
Scope
U17 — The switch: cut-over and rollback (weight 8, P3-low, feat/iti-u17-switch, after U2–U16)
-
Code: in
crates/craig-api/src/bootstrap.rs,init_authandbuild_auth_with_peer_jwksbuild U14’s validator andportal_policy_fromfeeds its guard;TokenSourcegoes into every sender; the BFFs sign in through U11, soverify_login_tokens’ access-token leg and `X-Craig-Subjectgo; craig-cli and the operator tools switch to the device client; U10’s routes mount. -
Password-grant callers move to the broker:
crates/craig-test-lib/src/token.rs:348-370(79 files),tests/e2e/lib/given/context.ts:299-312,tests/e2e/lib/ssa-fixture.ts:27-48,devstack/seed/seed.sh:330-332, k6 (tests/k6/helpers/auth.js: a token per user and audience, renewed 60 s beforeexp) and ZAP (tests/security/zap-auth-hook.js: a token per audience; a failed mint fails the scan). -
Migration: it latches history, opens the soak and revokes the app login’s
record_legacy_issuer()(D7, D15), leaving every service’sschema_compat_floorwhere it was. craig-security stops recordingOIDC_ISSUER. -
Deleted: the request-path upsert in
worker_identity_middleware.rs;build_service_token,build_actor_issuer,jwks_provider_for,build_introspection_client,introspection_configand the #1335 boot fetch;OidcServiceToken,ActorTokenIssuer,actor_verifier, the peer-JWKS loaders, receiver introspection,TokenValidationMode, theservice:-role predicates; U3’s legacy-digest comparison;identity verify’s IdP `client_credentialsprobe (xtask/src/cmd/identity/verify.rs:476-484);gen-actor-keysanddevstack-actor-keys.env. -
Settings: receivers lose
OIDC_ISSUER/OIDC_INTERNAL_URL,CLIENT_ID/CLIENT_SECRET,TOKEN_VALIDATION_MODEand the five introspection settings,SIGNING_JWK*/SIGNING_KID,CRAIG_PEER_JWKS_JSON*,SUBJECT_CLIENTSandCRAIG_IDENTITY_SERVICE_ROLE_PREFIX. The BFFs'OIDC_ISSUER,OIDC_INTERNAL_URL,KEYCLOAK_CLIENT_ID,[KEYCLOAK_]REDIRECT_URI,CLIENT_IDandCLIENT_SECRETbecome theirUPSTREAM_*settings (§B). -
Compose follows §B, with the issuer first after the migrate gate.
docker-compose.cluster.ymldrops the Keycloak it keeps only for the boot fetch (:13-14). -
Tests: the battery, on the broker; invariants: an onward call carries the full
act, the log names every hop, a token not addressed to its receiver is a 401; intake submission and replay (the sameclient_request_id, the stored row); craig-web’s/deviceapproval end to end; the latch migration fails with history and no recorded issuer, latches portal-only history (anaudit_logrow, noworker_identities), and leaves everyschema_compat_floorunchanged; a run with--replicas craig-security-issuer=3delegating across replicas; ZAP proves an authenticated 200 before scanning; the deletions, named in the MR. -
Docs: banners on ADR-028 (superseded) and ADR-026, -029, -021, -076, -013 and -011 (amended);
security-operations.adoc§ Rollback, with the soak;configuration-reference.adoc;deployment-guide.adoc§ Deployment gates, D15’s three, open. CHANGELOG:=== Changedand=== Removed; Ops note: the settings, adoption, the soak, workers signing in again, and keeping the legacy IdP clients until the soak ends. -
Erratum (2026-10-26, #2739): the devstack latch needs a wipe step, never a retirement: the devstack
OIDC_ISSUERembeds the per-checkout Keycloak port, so a devstack whose port changed holds several recorded issuers, which D7 refuses, and each earlier one validated tokens, so D7 forbids retiring it. The devstack is disposable: its latch step wipes and reseeds the fixture databases (cargo xtask dev reseed), which yields a clean deployment with no history (no latch, no soak), since U17 removes the recording call and revokes the grant, so no post-U17 boot records an issuer. To exercise the latch on the devstack, record on a pre-U17 release before switching. No devstack path callsidentity_retire_legacy_issuer.
U18 — Collapse the devstack IdP clients (weight 3, P3-low, chore/iti-u18-one-idp-client, after U17)
-
Code: the realm keeps only
craig; the 14 legacy clients (devstack/keycloak/craig-realm.json:103-1533) go, with the 11service:*roles, the service-account users, the audience mappers,partners.replay-checkand the compose client secrets;model.rs, the four renders andmultibackend_bootstrap.rsemit one client. -
Tests: the
committed_realm_*parity tests require one client; the render tests;no_admin_api_calls_per_adr_026. -
Docs:
idp-integration.adoc§ Required IdP Configuration and § Reference IaC;devstack.adoc§ Test Users. CHANGELOG:=== Removed; Ops note: delete the 14 legacy clients after the soak.
U19 — Conformance suite tie-in, #2688 (weight 3, P2-medium, test/iti-u19-conformance, after U17)
-
Code: #2688’s suites (Keycloak, Kanidm, ZITADEL, generic OIDC) federate through the issuer and assert roles, subjects, refusals, renewal and logout; the generic fixture’s non-UUID sub drives a craig-cases write keyed on the minted UUID (#2685’s end-to-end path); the receiver-side IdP cases retire; the pre-push identity paths gain
services/craig-security/src/identity/andcrates/craig-auth/src/identity/. -
Tests: the suites. Docs:
idp-integration.adoc’s backends table. CHANGELOG: `=== Changed(#2685’s end-to-end path).
U20 — Docs and runbooks (weight 3, P3-low, docs/iti-u20-docs, after U18, U19)
-
Code and tests: none. Docs:
security.adoc§3 and §6, andidp-integration.adoc, rewritten to the two-layer model;architecture.adoc’s diagram (the IdP reaches only the BFFs) and its OIDC row; `security-operations.adocrunbooks: D8’s compromise procedures and the provisioning role, break-glass (including re-enabling a disabled craig-web), client-key and upstream-secret rotation, client disablement, deprovisioning, the soak’s end, retiring a legacy issuer, an IdP change (subject creation and re-link after the soak), and hardening;local-dev.adoc. CHANGELOG:=== Changed.
U21 — Production gate: the external security review (weight 2, P3-low, chore/iti-u21-security-review-gate, after U20, last)
-
Code: none; findings become
fix:issues. The review, commissioned persecurity-operations.adoc§ Penetration Test Process, covers ADR-085, its annex, the threat model, every new parser and federation. -
Tests: D17’s production run on the whole system at R (federation and revocation included), with a rolling restart and a killed replica; a staging run of the issuance log’s archive-then-prune; a staging rollback drill during a soak (the prior release’s images on the post-switch databases: every service boots, craig-security included, a worker signs in, and an intake replay returns its row).
-
Erratum (2026-10-26, #2739): the rollback drill runs the prior release’s migrate gate before its app, and verifies that the revoked
identity_record_legacy_issuerEXECUTE, the history latch and the soak stay intact. -
Docs: U17’s gate items marked met in
deployment-guide.adoconce the report is recorded and every finding is closed or accepted by the maintainer; both plan pages then go toDone. CHANGELOG:=== Changed.
Risks
-
Scale. U17 is large; it stays one local branch until green, then one push (Canopy R26).
-
Harness churn. 79 files, the e2e helpers, k6, ZAP and the seed move; a login-theme change breaks the form driver (
crates/craig-test-lib/src/portal_subject.rs:14). -
Native deprovisioning waits for the native session’s end unless the subject is suspended (ADR-085 records it).