Identity plane split, plan I1b: canopy-identity client authentication and system tokens (epic &131)

Status: Done (2026-10-03) — !1558
Epic: &131 (stage I1 of &130)
Issues: #2548 (w3), #2557 (w1), #2549 (w3), #2550 (w3), #2514 (w1), #2551 (w5), #2552 (w5), #2560 (w2), #2553 (w3), #2554 (w5), #2555 (w5), #2556 (w3), #2559 (w1), #2562 (w3)
MRs:

  • MR 1, feat/identity-clients-and-purposes: U1, #2557, U2, U3, #2514, U4, U5 and #2560, in that order, titled "canopy-identity clients, purposes and issuance stores (#2548, #2557, #2549, #2550, #2514, #2551, #2552, #2560)". #2557 corrects a doc comment in canopy-signing found while planning. #2560 makes the issuer probe refuse PUBLIC grants, which U4 would otherwise extend to the issuance log.

  • MR 2, feat/identity-token-endpoint: U6, U7, U8, U9, #2559 and #2562, titled "canopy-identity token endpoint, receiver validator and client (#2553, #2554, #2555, #2556, #2559, #2562)". It ships after MR 1 merges. #2559 corrects the expiry and skew bounds that #2557’s sibling search found in other doc comments. #2562 derives every issuer-probe fact from one catalog snapshot.

  • Erratum (2026-10-02): U1 as built. ProvisionedKeyError has a fifth variant, Unreadable: a secret-provider failure other than absence, kept apart from Missing so that an outage never reads as an unset key.

  • Erratum (2026-10-02): U3 as built. identity_internal_url is held to the issuer’s rules. Both values must equal their url::Url serialization, so the issuer identifier is one exact string. A blank value counts as unset. canopy-common gains settings::config_root(), which the layered config and the client registry share. url becomes a workspace dependency.

  • Erratum (2026-10-02): U4 as built:

    • The jti insert is a targetless ON CONFLICT DO NOTHING. On PostgreSQL 18, a conflict target needs SELECT on its columns, which the issuer must not hold, so the primary key stays the table’s only unique index.

    • The stamp function pins TimeZone = 'UTC', because to_jsonb(timestamptz) renders in the session’s zone.

    • The purge refuses a batch outside 1..10000.

    • The probe keys function privileges by signature, as the closing audit does, and adds a NoStoreRead requirement.

  • Erratum (2026-10-02): U6–U9 as built:

    • The compact-JWS parser both validators share is canopy-auth’s identity_jws. It compares typ by RFC 7515 §4.1.9 media-type equivalence (the application prefix optional, case-insensitive) for A1 as for A4. The client-authentication+jwt, jwt-bearer, at+jwt and lifetime constants are in identity_policy.

    • Both validators require exp − iat of at least 1 s. U6 refuses a NUL in jti, which PostgreSQL text cannot store, so it never reads as a store failure. U8 caps a token at 8 KiB and requires sub = client_id (A4). With one compiled client, an iss, sub or client_id naming another client fails deserialization, so ClientMismatch and Subject wait for a second client.

    • U6’s exactly-once test runs two authenticators on two pools. The routed two-router test is U7’s. Both live in tests/identity_token_test.rs, which U6 creates, with fixtures in services/canopy-security/tests/common/mod.rs.

    • U7 reads the body itself, so a wrong content type or a body over 16 KiB is an audited invalid_request. The 5 s budget splits into 2 s of processing and 3 s of audit. An optional client_id must name the assertion’s client (RFC 7521 §4.2), else invalid_client. A row names the client only once its assertion is spent, so a jti-store 503 names none. peer_addr is the TCP peer. When an answer’s row fails, the 503 makes one more attempt to log audit_unavailable. router takes the rate (main passes 120), and the audit, the signing keys and the jti store sit behind traits that fault-injection tests replace.

    • U8’s 30 s debounce spaces every fetch attempt, scheduled or forced. A malformed Age fails the fetch, and a set older than the one held does not replace it. canopy-auth re-exports p256’s VerifyingKey. IdentityHttpClient, the bounded client with no redirects, is a newtype that U8 and U9 share, so SystemTokenSource::new takes it rather than a raw client.

    • U9’s close cites the archive directory by its full path, which plan-lint --done resolves.

  • Erratum (2026-10-03): MR 2 carries #2562, #2571, #2513 and #2572 with U6–U9, in that order. #2571 (the issuer’s temp tables could shadow the registry), #2513 and #2572 (canopy-reporting’s boot guard, the class #2562 fixed in the identity probes) were found while building it; #2559 shipped in sweep 6 (!1557).

The issues are bundled into two MRs under the maintainer’s one-MR-per-related-group ruling: each MR is one deliverable, and its commits build on each other. Each MR has one commit per issue. MR 1’s U1 commit adds this page (Status In progress) and its nav entry. MR 2’s U9 commit closes the plan.

This is a Design + Scope plan. GitLab owns tracking. The plan freezes when U1 starts.

Context

ADR-049 makes canopy-identity, a module of canopy-security, the one issuer every service trusts. Plan I1a (archive) built its keys, the database-guarded registry and /identity/jwks. It left I1b everything that mints:

  • client authentication (D10);

  • the token endpoint and RFC 8414 metadata (D2);

  • system tokens (D3) and their purposes (D4);

  • the issuance audit (D13);

  • the receiver validator (D9);

  • the issuer identifier config.

In the tree today:

  • LocalP256Key::generate() is canopy-signing’s only production KeySigner. No signer loads provisioned key material (crates/canopy-signing/src/key.rs).

  • canopy-auth’s validator stack is the Keycloak era’s. JwksProvider checks no JOSE typ, keeps keys after a failed refresh with no bound, and accepts any audience in a set. Claims would read a system token as a user (crates/canopy-auth/src/{jwks,claims}.rs). Changing it would alter the running path.

  • No purpose name exists anywhere. The only compiled scopes are the portal’s nine targets and 13 scopes (services/canopy-portal/src/tokens.rs).

  • The issuer login’s grant matrix is closed across canopy-security’s schema, and boot probes it (services/canopy-security/src/identity/probe.rs). The I1a migration’s closing audit cannot change, so new issuer-written tables need a migration with its own closing audit.

  • canopy-security’s public routes carry only /identity/jwks, and public routes skip the per-IP limiter (crates/canopy-api/src/lib.rs).

  • The ADR-041 audit-export channel D13 names does not exist: its Child B, #1301, is blocked and not started.

Scope

In scope: U1–U9 below, plus #2514 (the issuer probe reads its facts in one snapshot), which U4 builds on. U7 adds a live route; no caller uses it until I3.

Out of scope:

  • wiring a consumer (I3, &133): the sender cache, AuthLayer, the issuer-host bootstrap, readiness gating, provisioning a real client’s private key, and the receiver’s HTTP status for an unavailable key set;

  • session and delegation tokens, the call graph, runtime client disablement and the admin routes (I2, &132);

  • the ADR-041 export of the issuance log, and its retention (#1301, #1303);

  • moving canopy-security’s main runtime off the superuser (#2501).

Design

Decisions (recorded in ADR-049 Amendment 3, which lands with U2)

# Decision

A1

Assertion audience and type.

  • A client assertion’s aud is 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 "the token endpoint", which D2’s internal and edge-forwarded endpoints would make ambiguous.

  • typ must be client-authentication+jwt or absent; any other typ is refused, so an access token never passes as an assertion.

A2

Purposes.

  • D4’s registry is a compiled list of SystemPurpose {name, client, audience, scopes}.

  • A (client, audience) pair has at most one purpose. The client names the audience, and the issuer derives the purpose.

  • A purpose’s name is <client-id>/<audience-service>, for example canopy-portal/canopy-applications.

  • scope is optional. When present it must be a subset of the purpose’s set; when absent the token carries the full set.

  • Client ids are the compiled SystemClient enum (canopy-portal in I1b). Purposes are code (D4); client keys are configuration (D10).

  • I1b seeds the portal’s purposes from services/canopy-portal/src/tokens.rs. Each other sender’s purposes arrive with its I3 cut-over.

A3

Audiences. The request names its audience with RFC 8707 resource: urn:canopy:service:<service-name>, an absolute URI. The token’s aud is that URI, so 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, with sub = client_id, nbf = iat and a space-separated scope.

  • The user claims of D3’s layout (sid roles programs act auth_time) are absent. SystemTokenClaims denies unknown fields, so a token carrying any of them is refused.

  • Lifetime 600 s, header typ: at+jwt. The validator also accepts application/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 (D2: the issuer depends on its own database). The log is INSERT-only by trigger, and the issuer cannot read either table. Expired jti rows go only through an owner-run SECURITY DEFINER purge 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. An issued row means a token was minted and released only after COMMIT; 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 registry entry’s enabled: false, or its absence, refuses the client at every mint, scoped to a restart. Runtime disablement is I2’s (D12).

A8

The D13 export. The log carries a stable record_id, a schema_version and a complete-row row_digest, which the database computes over the stored row, occurred_at included. ADR-041’s policy version is stamped by the export, which waits on #1301 and is tracked by the follow-up U5 files. The token endpoint answers a failure it can retry with RFC 6749’s temporarily_unavailable, extended from the authorization endpoint (§4.1.2.1).

A9

JOSE headers. Both canopy-identity JWS validators accept exactly the protected headers alg, kid and typ, and refuse any other, crit, b64, jwk, jku, x5c and x5u among them (RFC 7515 §4.1.11). No extension is supported.

U1: a provisioned P-256 KeySigner (crates/canopy-signing)

  • ProvisionedP256Key::from_pkcs8_pem(&zeroize::Zeroizing<String>) → Result<Self, ProvisionedKeyError>, behind the existing KeySigner trait:

    • the kid is computed by Kid::rfc7638;

    • the key is zeroized on drop and never serialized;

    • ProvisionedKeyError is a thiserror enum: Missing, Malformed, NotP256, Encrypted.

  • load_provisioned_key(&dyn SecretProvider, key_name: &str) reads through require_secret (crates/canopy-common/src/key_material.rs). There is no file fallback (D10). Key names end in _PRIVATE_KEY, so cargo xtask secret-loads covers them.

  • Tests:

    • assert_key_signer_conformance (canopy_signing::conformance, feature test-helpers);

    • a loader proptest: no input panics, and each error variant is reached;

    • a round trip against PublicJwk::verifying_key.

  • Relates to #2502. DeterminationSigner is unchanged.

U2: purposes and token claim types (crates/canopy-auth)

  • crates/canopy-auth/src/identity_policy.rs holds:

    • SystemClient (canopy-portal, serialized as that string);

    • SystemPurpose;

    • fn purpose_for(client: SystemClient, audience: &str) → Option<&'static SystemPurpose>.

  • SystemTokenClaims and ClientAssertionClaims, serde types with deny_unknown_fields (A4).

  • Tests:

    • each (client, audience) pair has at most one purpose;

    • every scope set is non-empty and unique;

    • every name follows A2’s rule;

    • the claim serialization is pinned.

  • services/canopy-portal/src/tokens.rs gains a test, under the server feature, that canopy-auth’s portal purposes equal Target::op_scopes. canopy-portal is a binary crate depending on canopy-auth, so the test lives on its side.

  • ADR-049 Amendment 3: A1–A9, and the I1b staging of D10, D12 and D13.

U3: issuer identifier and client registry (canopy-security config)

  • New SecurityConfig fields: identity_issuer and identity_internal_url. Both are optional, but they must be set together; setting one alone refuses boot.

    • identity_issuer must be https, except under CANOPY_ENV=development. Its path must be exactly /identity, and it may carry no query, fragment or userinfo (RFC 8414 §2). Endpoint URLs are built structurally with url::Url path segments, never by string concatenation, so they are the mounted /identity/token and /identity/jwks.

    • When they are unset, the token endpoint and the metadata answer 503 temporarily_unavailable and boot logs once.

    • The devstack sets both to http://canopy-security:8012/identity in docker-compose.yml, the container’s port.

    • configuration-reference.adoc documents both. The names collide with neither OIDC_* nor RESERVED_KEYS.

  • The client registry:

    • read with the config crate (already used by crates/canopy-common/src/settings.rs) from <CANOPY_CONFIG_ROOT>/canopy-security/identity-clients.yaml. The file does not layer. The repo ships none, a deployment mounts its own, and an absent file means no clients.

    • Each entry: client (a SystemClient id string), enabled (bool) and keys (one or two {x, y} public JWK coordinates).

    • The kid is computed (RFC 7638), never configured.

    • A malformed entry, an unknown client, a third key or a duplicate key refuses boot, naming the entry.

  • Tests: each refusal, the absent file, and a proptest that no YAML input panics the loader.

U4: the jti store and the issuance log (one migration, the probes)

  • A migration sorting after 20261209000000, owned by canopy_identity_owner, with two tables.

    identity_client_assertions, keyed on (client, jti):

    Column

    Type

    Notes

    client

    TEXT NOT NULL

    CHECK (client <> '')

    jti

    TEXT NOT NULL

    CHECK (length(jti) BETWEEN 1 AND 128)

    expires_at

    TIMESTAMPTZ NOT NULL

    the assertion’s exp + 60 s

    identity_issuance_log:

    Column

    Type

    Notes

    record_id

    UUID PRIMARY KEY

    v7, from the writer

    occurred_at

    TIMESTAMPTZ NOT NULL

    stamped clock_timestamp() by a SECURITY DEFINER trigger, as I1a stamps

    outcome

    TEXT NOT NULL

    CHECK (outcome IN ('issued','refused'))

    error

    TEXT

    the RFC 6749/8707 code; CHECK outcome = 'refused') = (error IS NOT NULL

    reason

    TEXT

    the typed refusal reason, CHECK (reason ~ '^[a-z_]{1,64}$'); its vocabulary is pinned in code by a test

    client, purpose, audience, scope

    TEXT

    NULL when not yet known (an unauthenticated refusal)

    token_jti, kid, expires_at

    UUID, TEXT, TIMESTAMPTZ

    set only when outcome = 'issued' (a CHECK)

    peer_addr

    INET

    the request’s source address

    schema_version

    SMALLINT NOT NULL

    1

    row_digest

    BYTEA NOT NULL

    computed by the stamp trigger: sha256 of the stored row as jsonb (to_jsonb(NEW) - 'row_digest'), occurred_at included; CHECK (octet_length(row_digest) = 32)

    An index on identity_client_assertions (expires_at) serves the purge.

  • Functions and triggers:

    • the stamp trigger (SECURITY DEFINER) sets occurred_at and then row_digest, overriding any supplied value;

    • an identity_registry_immutable-style trigger makes the log INSERT-only;

    • identity_purge_client_assertions(batch INT) RETURNS INT is owner-run and SECURITY DEFINER. It deletes up to batch expired rows under FOR UPDATE SKIP LOCKED, so concurrent sweepers never block each other, and returns the count.

  • Issuer grants:

    • column-level INSERT on both tables, the log without occurred_at and row_digest;

    • no SELECT, UPDATE or DELETE on either. A jti replay is detected from ON CONFLICT DO NOTHING's row count, which needs no read;

    • EXECUTE on the purge.

      Grants carry -- global-ddl: markers. The migration ends with its own closing audit over every identity object, old and new.

  • Code changes:

    • probe.rs in_grant_matrix / holds_grant_matrix / outside_matrix, REGISTRY_TABLES / REGISTRY_FUNCTIONS and the test fixtures are extended. #2514’s single-snapshot read lands just before.

    • The issuer pool grows from 4 to 8 connections. Its doc derives the size: one group-commit writer, one jti insert per token request at the route’s limit (U7), and I1a’s registry and JWKS traffic.

  • Tests (EphemeralSchema, in services/canopy-security/tests/identity_registry_test.rs):

    • a jti inserts once, and a duplicate reports zero rows;

    • the issuer cannot read either table, nor UPDATE, DELETE or TRUNCATE the log;

    • the purge removes only expired rows, and two concurrent purges never delete a row twice or block;

    • the trigger’s digest covers occurred_at, and a supplied digest is overridden;

    • the probes refuse a grant outside the extended matrix.

  • Docs: data-models/canopy-security.adoc and security-operations.adoc#identity-registry (the purge and the grants).

U5: the issuance-log writer (services/canopy-security/src/identity/issuance_log.rs)

  • A group-commit writer.

    • Callers enqueue a row with its deadline and a oneshot on a bounded queue of 256 rows. Enqueueing waits at most until the caller’s deadline; a full queue past that is a 503, with the row not written.

    • One task gathers up to 32 rows or 10 ms, drops the rows whose callers have gone, inserts the rest in one transaction on the issuer pool, and answers each caller after COMMIT.

  • A writer-owned deadline of 2 s covers each batch from pool acquisition through COMMIT. On expiry the writer closes that connection rather than returning it, fails the batch’s callers, and takes a fresh connection for the next batch.

  • Fail closed: a failed write, an expired batch deadline or an expired caller deadline fails every affected caller, and nothing is released.

  • Metrics:

    • canopy_identity_issuance_batch_rows (histogram);

    • canopy_identity_issuance_commit_seconds;

    • canopy_identity_issuance_queue_depth;

    • canopy_identity_issuance_failures_total{cause}.

  • The jti sweeper runs every 60 s with a jittered first tick. Each run calls the purge in batches of 1000 until a call returns fewer than 1000 or 2 s pass. That catches up with any ingress below 60 000 assertions a minute per replica, far above the token route’s limit times any realistic sender count.

  • The export follow-up is #2561, blocked by #1301.

  • Tests:

    • concurrent rows commit in batches;

    • a failed commit fails every waiter;

    • a stalled connection (the canopy_test_lib::stalling_relay from #2538) trips the batch deadline, and the next batch succeeds on a fresh connection;

    • a saturated queue answers 503 at the caller’s deadline and recovers once drained;

    • a caller that gives up before its batch starts leaves no row;

    • two sweepers on two pools purge concurrently without errors.

U6: client-assertion verification (services/canopy-security/src/identity/client_auth.rs)

  • The pipeline, cheapest checks first:

    • parse the compact JWS, refusing anything over 8 KiB;

    • the protected header holds only A9’s parameters, with alg = ES256;

    • typ per A1;

    • kid is the thumbprint of one of the client’s enabled keys;

    • verify with PublicJwk::verifying_key.

  • Then the claims:

    • iss = sub = client_id, naming an enabled SystemClient;

    • aud = identity_issuer as its sole value;

    • iat is present and at most now + 60 s;

    • exp is after now and exp − iat ≤ 60 s;

    • jti is 1–128 characters.

  • Single use: INSERT … ON CONFLICT DO NOTHING into identity_client_assertions. Zero rows is a replay.

  • Each refusal is a typed ClientAuthRefusal. A failure of the jti store (an error or a timeout) is a separate ClientAuthError::StoreUnavailable, never a refusal or a replay. U7 maps and audits both.

  • The shared corpus: crates/canopy-auth/src/jws_corpus.rs, behind a new canopy-auth feature test-helpers, provides jws_evil_cases!, a parametric macro over these cases:

    • alg: none;

    • HS256 confusion;

    • an embedded jwk header;

    • a signed unknown crit extension;

    • a signed b64: false;

    • nested JWS;

    • an oversize token;

    • bad base64;

    • a truncated signature;

    • a duplicate header key.

      canopy-security dev-depends on canopy-auth with that feature. lanes::FEATURE_BUILDS gains a default-features canopy-auth entry, following canopy-signing’s, so the feature-builds gate still covers the build without test-helpers.

  • Tests:

    • a table of each refusal;

    • the corpus;

    • a proptest that no input panics the parser;

    • two routers on two pools over one EphemeralSchema accept a jti exactly once.

U7: the token endpoint and RFC 8414 metadata (services/canopy-security/src/identity/token_endpoint.rs)

  • POST /identity/token, merged into public_routes beside /identity/jwks (services/canopy-security/src/main.rs):

    • form-urlencoded only, with a body limit of 16 KiB;

    • a whole-request budget of 5 s, of which the audit wait gets at most 3 s;

    • a dedicated per-IP limiter at 120 requests/min (canopy_api::apply_rate_limit).

  • The request: grant_type=client_credentials, client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer, client_assertion, exactly one resource, and an optional scope.

  • The flow: authenticate (U6), then purpose_for (U2), then the scope check, then key_ring.active(), then mint_compact_jws(&active, "at+jwt", …) with times from chrono::Utc::now() (D14). The log row commits (U5), and only then is the token released.

  • Success: {access_token, token_type: "Bearer", expires_in: 600, scope}.

  • Response headers: every response carries Cache-Control: no-store and Pragma: no-cache (RFC 6749 §5.1). They are set by a layer outside the route’s rate limiter, so a 429 carries them too.

  • Errors:

    Cause

    error

    Status

    malformed or duplicate parameters, a missing parameter, several resource values

    invalid_request

    400

    grant_type is not client_credentials

    unsupported_grant_type

    400

    a wrong assertion type, any U6 refusal, an unknown or disabled client

    invalid_client

    400

    resource names no service, or the client has no purpose for it

    invalid_target

    400

    scope is not within the purpose’s set

    invalid_scope

    400

    no active key; a SignError (a window closing after active(), a timeout); the jti store unavailable; an audit failure; the issuer unconfigured; the budget spent

    temporarily_unavailable

    503

    invalid_client is a 400: the client authenticates in the form, not in an Authorization header, and RFC 6749 §5.2 requires a 401, which carries a WWW-Authenticate challenge (RFC 9110 §15.5.2), only for header-based authentication. Each 503 cause is audited with its own reason, and none releases a token.

  • Metadata: GET /.well-known/oauth-authorization-server/identity (RFC 8414 §3.1) returns:

    • issuer, token_endpoint: {issuer}/token, jwks_uri: {issuer}/jwks;

    • grant_types_supported: [client_credentials];

    • token_endpoint_auth_methods_supported: [private_key_jwt];

    • token_endpoint_auth_signing_alg_values_supported: [ES256];

    • response_types_supported: [].

      In-cluster clients use the same paths under identity_internal_url.

  • Metrics: canopy_identity_tokens_issued_total{purpose} and canopy_identity_token_refusals_total{error}.

  • Tests: routed tests over an EphemeralSchema, with a client registered in the test (no grant is test-only, D14):

    • each table row, asserting its log row;

    • fault injection for each 503 cause, a signer that refuses and a jti store that fails among them, each releasing nothing and audited;

    • the cache headers on a success, an error and a 429;

    • a form-parse proptest;

    • the metadata document, and that its token_endpoint and jwks_uri resolve to the mounted routes.

  • Docs: api/canopy-security.adoc, authorization-inventory.adoc, services.adoc and security.adoc.

U8: the receiver validator, unwired (crates/canopy-auth/src/identity_token.rs)

  • IdentityTokenValidator::new(issuer, audience, key_source) and validate(&self, token, request_start) → Result<SystemTokenClaims, IdentityTokenError>.

    • IdentityTokenError separates Rejected(reason) from KeysUnavailable.

    • The checks:

      • the protected header holds only A9’s parameters: typ per A4, alg ES256, a known kid;

      • the signature, verified with p256;

      • iss and aud exact (A3);

      • exp − iat ≤ 600, iat ≤ now + 60, nbf ≤ now + 60, with a 60 s leeway on exp;

      • no user claims (A4).

  • #[async_trait] pub trait IdentityKeySource: Send + Sync, with one method: async fn key(&self, kid: &Kid, request_start: SystemTime) → Result<Option<p256::ecdsa::VerifyingKey>, KeysUnavailable>.

  • HttpJwksKeySource:

    • refreshes every 300 s, and at most once per 30 s on an unknown kid;

    • fails closed once its set is 720 s stale, measured from request start − Age (D9, Amendment 1);

    • a 64 KiB body cap; an empty set is valid;

    • a bounded client with no redirects (the http-clients gates).

  • canopy-security’s in-process source: services/canopy-security/src/identity/key_source.rs reads JwksMemo<PgPublishedKeys>, the database registry, never the ring, since each ring holds only its own key.

  • Tests:

    • a rejection table;

    • staleness with a fake clock and Age;

    • the unknown-kid debounce;

    • the corpus;

    • a proptest that no token panics the validator.

U9: the client side, unwired (crates/canopy-auth/src/identity_client.rs)

  • ClientAssertionMinter::new(signer: Arc<dyn KeySigner>, client: SystemClient, issuer: Url) and async fn mint(&self) → Result<String, SignError>. Each assertion has a fresh v7 jti, exp = iat + 60 s and A1’s aud and typ.

  • SystemTokenSource::new(minter, token_endpoint: Url, http) and async fn token(&self, resource: &str, scope: Option<&str>) → Result<Arc<str>, SystemTokenError>:

    • it caches each (resource, scope), single-flight, for the shorter of 300 s and exp − 60 s. 300 s is the receivers' JWKS refresh, so a token signed by a revoked key leaves the cache no later than receivers stop accepting it;

    • fn invalidate(&self, resource: &str, scope: Option<&str>) drops an entry, and the next call reacquires. Wiring a receiver’s 401 to it is part of each sender’s I3 cut-over, as ServiceTokenSource's reacquisition is today;

    • it uses a bounded client with no redirects;

    • it sits beside ServiceTokenSource, which is unchanged.

  • Round trip: services/canopy-security/tests/identity_token_test.rs. An in-process canopy-security router over an EphemeralSchema mints a portal token, and U8’s validator accepts it with the in-process key source.

  • The plan closes here:

    • Status becomes Done (YYYY-MM-DD) — !N;

    • the page moves to docs/modules/ROOT/pages/plans/archive/, with the nav moved as the header says;

    • Amendment 3’s link is repointed;

    • cargo xtask plan-lint --done docs/modules/ROOT/pages/plans/archive/identity-plane-split-i1b.adoc --allow-open runs, exempting MR 2’s own issues (2562, 2571, 2513, 2572, 2553, 2554, 2555, 2556, still open until it merges) and 1301, 1303, 2501, 2502 and 2561.

Conventions every unit follows

  • Database tests use EphemeralSchema in infra_tests modules or tests/ binaries, gated by infrastructure_available(). The battery sets CANOPY_TEST_INFRA=required, so a missing database fails instead of passing (I1a’s U3 erratum). It never runs #[ignore] tests (xtask/src/cmd/test.rs).

  • Every parser gets a proptest, and the token parsers share the U6 corpus (adr-049 Consequences). Issuer and receiver code reads chrono::Utc::now(), never canopy_common::clock (D14). Every unit ships its CHANGELOG.adoc Added bullet and the doc pages its section names.

Units

  1. U1 (w3) — feat(signing): load a provisioned P-256 key as a KeySigner (#2548). crates/canopy-signing/src/provisioned.rs. This page and its nav entry.

  2. #2557 (w1) — require_unexpired_with_leeway's doc comment states the bound the code enforces, as filed.

  3. U2 (w3) — feat(auth): compiled system purposes and token claim types (#2549). crates/canopy-auth/src/identity_policy.rs, services/canopy-portal/src/tokens.rs (test), ADR-049 Amendment 3.

  4. U3 (w3) — feat(security): identity issuer config and the client registry (#2550). services/canopy-security/src/{config,identity/clients}.rs, docker-compose.yml, configuration-reference.adoc.

  5. #2514 (w1) — the probe reads its facts in one snapshot, as filed.

  6. U4 (w5) — feat(security): client-assertion and issuance-log stores (#2551). The migration, identity/{probe,registry}.rs, the fixtures, the data-model and operations pages.

  7. U5 (w5) — feat(security): a group-commit issuance log (#2552). identity/issuance_log.rs, the sweeper, metrics.

  8. #2560 (w2) — the issuer probe refuses PUBLIC grants on identity objects, as filed.

  9. U6 (w3) — feat(security): verify private_key_jwt client assertions once (#2553). identity/client_auth.rs, crates/canopy-auth/src/jws_corpus.rs.

  10. U7 (w5) — feat(security): token endpoint and RFC 8414 metadata (#2554). identity/token_endpoint.rs, main.rs, the API docs.

  11. U8 (w5) — feat(auth): an unwired canopy-identity token validator (#2555). crates/canopy-auth/src/identity_token.rs, identity/key_source.rs.

  12. U9 (w3) — feat(auth): a private_key_jwt system-token client, unwired (#2556). crates/canopy-auth/src/identity_client.rs, tests/identity_token_test.rs, the plan close.

  13. #2559 (w1) and #2562 (w3) — as filed, in MR 2.

Verification

  1. Per unit: fmt; clippy in both profiles; nextest for the touched crates; the named database tests with CANOPY_TEST_INFRA=required; rustdoc-private; migrations-lint, secret-loads, http-clients audit-redirects and audit-timeouts, db-pools, web-paths and quality-budgets.

  2. Per MR: every validate stage, then git push (the pre-push battery).

  3. After MR 2, on the devstack (cargo xtask dev reload applies the U4 migration):

    • the metadata answers at /.well-known/oauth-authorization-server/identity on canopy-security’s port;

    • its token_endpoint and jwks_uri are http://canopy-security:8012/identity/token and …/jwks, and both answer in the compose network;

    • an unsigned POST /identity/token is refused 400 invalid_client with both cache headers. U7’s routed test asserts the refusal’s log row.

  4. git grep -nE 'use canopy_common::clock|canopy_common::clock::' services/canopy-security/src/identity crates/canopy-auth/src lists no I1b file.

Review log

round vendor resolved model verdict

1 (2026-10-02)

Anthropic

claude-opus-5-5

no-ship. Fifteen blockers, all fixed: the nav group; the page in the first commit; subject lengths; the MR justification; the data-model, operations and CHANGELOG docs; plan-lint’s --allow-open; priority labels; crate-legal test placement and a corpus home; existing dependencies only; wire values; the registry file and issuer settings; column tables and grants; the endpoint’s errors, rate, budget and URLs; a dropped banner item; a verification grep that holds on main.

2 (2026-10-02)

OpenAI

gpt-6-astra

no-ship. Twelve findings, all fixed: a writer-owned batch deadline with connection recovery; a bounded, deadline-aware audit queue; a jti purge sized for ingress, with an index and concurrent sweepers; a database-computed digest covering occurred_at; audited 503s for signing and jti-store failures; a feature-builds entry for the new canopy-auth feature; the devstack’s port 8012; issuer validation refusing a query or fragment, with structural endpoint URLs; a protected-header allowlist rejecting crit and b64; invalid_client as 400; a sender cache capped at 300 s with invalidate; Pragma: no-cache and cache headers outside the limiter. No round 3.

Edit this page · default