Identity plane split, plan I2b: the upstream profile and id_token verification (epic &132)

Status: Done (2026-10-05) — !1569
Epic: &132 (stage I2 of &130)
Issues: #2692 (w5), #2693 (w3), #2694 (w5), #2695 (w5), #2696 (w3), #2697 (w3), #2698 (w3)
MR: feat/identity-upstream-profile: U1–U7 in order, titled "canopy-identity upstream profile and id_token verification (#2692, #2693, #2694, #2695, #2696, #2697, #2698)".

The seven issues are one deliverable, the upstream half of federation that plan I2c’s grant calls, so they ship as one MR under the maintainer’s one-MR-per-related-group ruling, one commit per issue. U1’s commit adds this page (Status In progress) and its nav entry: a new group, Identity Plane Split (epic &130), holding * …, placed just above ** Completed Plans Archive in docs/modules/ROOT/nav.adoc, as plan I2a did. U7’s commit closes the plan.

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

Context

ADR-049 D6 has canopy-identity validate an upstream id_token "against the profile’s trust anchor", call userinfo bound to the id_token’s sub, and project roles, programs and the username through the profile. D5’s id_token row fixes the checks: iss exact, aud contains the client, azp equal to the client when there are several audiences, iat no older than 5 minutes. D2 forbids any upstream call at boot. ADR-050 §2 makes the upstream a deployment-configured profile (kanidm, oidc-generic, and later keycloak and zitadel) and, in its Trust anchors bullet, has upstream-facing clients take a PEM bundle of TLS trust anchors.

In the tree today:

  • No profile type exists. The upstream is described by the ruleset’s [identity] table (crates/canopy-auth/src/identity_config.rs), whose IdentityProvider names Keycloak and OidcGeneric. crates/canopy-api/src/bootstrap.rs loads it at boot for every service but canopy-portal, which loads it itself to validate its own service tokens; canopy-web uses it for sign-in.

  • canopy-identity’s own keys already have the bounded key cache D9 describes: HttpJwksKeySource (crates/canopy-auth/src/identity_token/jwks_source.rs, plan I1b) refreshes every 300 s, refetches on an unknown kid at most once per 30 s, and fails closed at 720 s, dating a set by the response’s Age. It parses ES256 keys only, and its IdentityKeySource trait is P-256 only.

  • The receivers' JwksProvider and ClaimContract are Keycloak-era: the provider has no staleness bound and a payload-typ rule that refuses Keycloak’s id_tokens, and ClaimContract::project rewrites service markers, which must never apply to an upstream’s claims.

  • The opt-in Kanidm lane (plan I0, crates/canopy-test-lib/tests/idp_conformance_kanidm.rs) signs real people in against Kanidm 1.11.2 behind a private CA, and verifies its id_tokens with the lane library’s own verifier (upstream::kanidm::login::verify).

Scope

In scope: U1–U7 below: the profile and its loader, the TLS trust anchors and the upstream HTTP client, the lazy discovery and key cache, the id_token validator, the userinfo client, the federated projection, and the Kanidm lane’s proof.

Out of scope:

  • the federation grant, subjects, sessions, renewal, the grace policy and the end-to-end sign-in deadline (I2c), which call these pieces;

  • canopy-web reading the profile, retiring [identity], , [local_accounts] and Studio’s identity step (I3);

  • the keycloak and zitadel profiles, each with its conformance suite (I4);

  • a conformance suite for oidc-generic against a deployment’s own IdP (onboarding).

Design

Decisions (recorded in ADR-049 Amendment 5; C4 also in ADR-050 Amendment 2; C7 narrows D5’s id_token row and C9 sets userinfo’s grace; both amendments land with U1)

# Decision

C1

One profile file. The profile is one non-layered file, <CANOPY_CONFIG_ROOT>/identity-upstream.yaml, parsed by a canopy-auth type that refuses unknown fields, read by canopy-security now and canopy-web at I3. D1 allows one upstream, so both readers must agree on iss, the client and the algorithms, and ADR-012’s layers are per service (config/<service>/, CANOPY_<SERVICE>__), so two services cannot read one copy. It holds no secret: canopy-web’s upstream client secret stays in SecretProvider (D10). An absent file means no upstream is configured, with one boot warning; a file that exists and is unreadable or defective refuses the boot, naming the field. Boot reads and validates the file and its trust-anchor bundle but makes no request (D2).

C2

Profiles in I2. kanidm and oidc-generic only.

  • algorithms is a non-empty subset of ES256, ES384, RS256, PS256 and EdDSA; none and every HS* are refused at parse. Each binds one key type: P-256, P-384, RSA of at least 2048 bits (both RSA algorithms), Ed25519.

  • A kanidm file states only profile, issuer, client_id and the optional jwks_uri, userinfo_endpoint and tls_trust_anchors; any preset field present is refused, naming it. Its presets: algorithms [ES256]; claims from the id_token; refresh re-issues the id_token; client authentication client_secret_basic; roles /roles and programs /primary_programs (canopy’s provisioning convention for Kanidm, not Kanidm built-ins); username /preferred_username.

  • An oidc-generic file states every field except those three optional ones.

C3

Two meanings of "trust anchor". D6’s "the profile’s trust anchor" is D5’s "upstream profile’s JWKS". ADR-050 §2’s Trust anchors are TLS roots, and the profile names them tls_trust_anchors.

C4

The TLS bundle replaces the built-in roots. When tls_trust_anchors names a bundle, the upstream client trusts only it; with no bundle it trusts reqwest’s built-in roots (in the shipped image, webpki-roots and the OS store, since object_store’s rustls-tls-native-roots feature unifies into the build). Replacing pins discovery, JWKS and userinfo to the deployment’s PKI, so a mis-issued public certificate cannot substitute the upstream’s keys. This narrows ADR-050 §2’s "extra trust anchors", which ADR-050 Amendment 2 records; an additive mode waits for a deployment that needs one.

C5

Upstream key bounds. The upstream key cache reuses I1b’s state machine, constants and dating: refresh every 300 s, an unknown kid at most once per 30 s, fail closed when 720 s stale, and a set dated by its fetch start less the response’s Age (Amendment 1), the older of the discovery and JWKS responses deciding.

  • Each fetch sends Cache-Control: no-cache (RFC 9111 §5.2.1.4), so a compliant cache revalidates with the upstream before it answers.

  • An older cached copy dates older and never replaces a newer set, so a key the upstream removed stops verifying at most 720 s after its removal.

  • A set whose Age makes it born stale leaves the keys unavailable (fail closed); a malformed Age fails the fetch.

  • The bound assumes a cache sends Age on a stored response, as RFC 9111 §5.1 requires. Amendment 5 and idp-integration.adoc record that as the deployment’s requirement.

Unavailable keys are a distinct outcome from a refused token.

C6

Issuer and endpoints. Two URL rules, both https or, only when the caller passes development, http:

  • the issuer is an identifier: no userinfo, query or fragment, and canonical or a bare origin (U1), because iss and discovery’s issuer must equal it exactly;

  • jwks_uri and userinfo_endpoint are endpoints: no userinfo or fragment, a query allowed (OIDC Discovery §3 lets userinfo carry one, and some IdPs serve an application-specific JWKS such as ?appid=…).

Discovered endpoints must share the issuer’s origin (scheme, host and port); endpoints the profile names explicitly may sit elsewhere. Discovery need not advertise token exchange or refresh.

C7

The id_token rules, beyond D5’s row:

  • at most 16 KiB;

  • the protected header holds alg, kid, an optional typ and an optional x5t or x5t#S256 (ignored, as generic IdPs send them), each once; any other member refuses;

  • alg in the profile’s list, bound to the key the kid names; typ absent, JWT or application/jwt (the existing media-type rule, typ_names);

  • every time claim (exp, nbf, iat, auth_time) is a NumericDate (RFC 7519 §2): a finite JSON number, truncated to whole seconds, within i64; any other value refuses as malformed;

  • exp after now − 60 s; nbf, when present, no later than now + 60 s (RFC 7519 §4.1.5, as the receivers' JwksProvider enforces today); iat no older than 300 s and no later than now + 60 s;

  • auth_time required (D3, and D6’s step-up and refresh rules need it), and no later than iat + 60 s or now + 60 s, since an authentication cannot follow the token it produced. How old it may be is I2c’s step-up and max_age policy. OIDC Core §2 makes an IdP send it only when the request asks, with max_age or as an essential claim, so the authorization request canopy-web sends from I3 must ask; Kanidm always sends it;

  • sub an OidcSubject (canopy_common::identity::OidcSubject: 1–255 ASCII bytes, no control character), as Claims.sub is for the receivers today;

  • aud exactly the client: a string equal to client_id, or an array holding only it. Any additional audience refuses, azp notwithstanding, because the profile names no audience the client trusts (OIDC Core §3.1.3.7 step 3). This narrows D5’s row ("aud contains the client"); a trusted-audience list waits for a deployment that needs one;

  • azp refused whenever present and not the client;

  • nonce returned to the caller, not judged (D5: canopy-web checks it);

  • amr never read (D6), nor acr (new here).

C8

The projection. A verified anchor (iss, sub as an OidcSubject, auth_time, nonce) plus a claims payload (from the id_token or userinfo, as the profile says) project to a FederatedIdentity: roles as I2a’s RoleSet, programs as I2a’s ProgramSet, and a username of 1–256 bytes with no control characters. Roles take the profile’s role names intersected with the vocabulary, with no service prefix (D3). It does not go through ClaimContract::project (whose retirement is I3’s, &133); this amends D6’s federation step 3. ProjectionRefusal, with ADR-044’s codes where it has one:

  • NoRole (no_role): the roles pointer missing or not an array of strings, or no vocabulary role left;

  • MissingPrograms (missing_primary_programs): absent or empty;

  • MalformedPrograms (malformed_primary_programs): the wrong shape or an unknown program slug, as canopy-web’s ScopeAdmissionError already reads them;

  • NoUsername (no_username, a new code): missing, the wrong shape or out of bounds.

C9

Userinfo failures and grace. Amendment 2 narrowed D6’s grace because a refresh the upstream may have processed may have rotated its token, and presenting it again revokes the session. A userinfo GET spends no credential, so that rationale does not apply, and an answer the upstream may or may not have processed ends nothing:

  • Unavailable (no connection, any timeout, a connection lost after sending, 408, 425, 429, 5xx) gets D6’s original grace when it renews an existing session;

  • Refused (any other 4xx: the upstream no longer accepts the access token) and Invalid end the session.

A sign-in has no session to extend, so a sign-in whose claims come from an unavailable userinfo fails (I2c applies both rules).

U1: the profile and its loader (canopy-auth, canopy-security)

  • A new crates/canopy-auth/src/upstream.rs over upstream/ (the identity_policy.rs pattern); upstream/profile.rs holds the profile.

  • Wire and resolved types. The file parses into a wire enum tagged by profile: a kanidm variant holding only the fields C2 lets it state, and an oidc-generic variant holding every field, each refusing unknown fields (so a kanidm file stating a preset field is refused, naming it). UpstreamProfile is resolved from it, presets filled in:

    • issuer, client_id (an upstream newtype, not B1’s Client), algorithms, claims_from (id_token | userinfo), refresh (reissues_id_token | userinfo), client_auth_method (parsed now, used at I3), and claims.{roles, programs, username} as JSON pointers;

    • optional jwks_uri, userinfo_endpoint and tls_trust_anchors (one bare file name resolved against the config root; /, \, .. and absolute paths refused);

    • enums, not booleans, so the config crate’s lenient coercion cannot apply.

  • URLs. canopy-auth cannot call canopy-security’s private identity_url checker (services/canopy-security/src/config.rs), so U1 implements C6’s two rules:

    • the issuer rule is the checker’s: https unless development; no userinfo, query or fragment; refused unless already canonical, since iss and discovery’s issuer must match the configured string byte for byte. Its fixed-path rule does not apply, and one non-canonical form is accepted: an empty path written without its trailing / (https://accounts.google.com, which url renders as …com/), kept verbatim for the comparisons;

    • the endpoint rule, for jwks_uri and userinfo_endpoint (named here, discovered in U3): https unless development, no userinfo or fragment, a query allowed.

  • Loader. load(config_root: &Path, development: bool) and load_from(path: &Path, development: bool) return Result<Option<UpstreamProfile>, UpstreamProfileError>, None when the file is absent; parse(yaml: &str, development: bool) returns Result<UpstreamProfile, UpstreamProfileError>. Parsing goes through config::File::from_str(.., FileFormat::Yaml), as ClientRegistry does (services/canopy-security/src/identity/clients.rs); unlike the registry, the file sits at the config root. canopy-auth gains config = { workspace = true }. canopy-security loads the profile at boot after the client registry and holds it unwired until I2c.

  • Tests: each preset; every field’s refusal (a kanidm file stating a preset field included); a bare-origin issuer accepted and kept verbatim, with a trailing-slash form of the same issuer accepted as itself; an endpoint with a query accepted and an issuer with one refused; an endpoint with userinfo or a fragment refused; an absent file is None, an unreadable or defective one refuses with the field named; a proptest that no YAML panics the parser and that an accepted wire value, rendered as JSON (a YAML subset, through serde_json), parses back equal.

  • Docs: ADR-049 Amendment 5 (C1–C9) and ADR-050 Amendment 2 (C4), with both Status lines; a new [#identity-upstream] section in configuration-reference.adoc beside [#identity-clients]; an idp-integration.adoc section on canopy-identity’s upstream profile; an upstream bullet under == canopy-auth in shared-crates.adoc, after identity_token; this page and its nav entry.

Erratum (2026-10-05): as built, the wire enum is read by hand from the map config::File::from_str(.., FileFormat::Yaml).collect() returns, without a config::Config or serde’s derived tagged enum: building a Config expands each top-level key as a path (a key such as issuer[9223372036854775807] panics it), and the derived enum’s errors through the config crate name no field structurally and quote the offending value. Both U1 guarantees hold: a kanidm file stating a preset field is refused naming it, and an unknown field is refused in either variant. client_auth_method accepts client_secret_basic and client_secret_post; client_id is 1–255 bytes of RFC 6749 VSCHAR.

U2: TLS trust anchors and the upstream HTTP client (canopy-auth, canopy-security)

  • upstream/tls.rs: TlsTrustAnchors::load reads the named bundle (capped at 1 MiB) and walks it with <(SectionKind, Vec<u8>)>::pem_slice_iter (canopy-auth gains rustls = { workspace = true } for rustls::pki_types). It refuses the boot on zero certificates, on any section whose kind is not SectionKind::Certificate (a mounted private key), and when the bundle’s count of -----BEGIN ` lines differs from the sections returned, because pki-types silently skips a label it does not know (`ENCRYPTED PRIVATE KEY, OPENSSH PRIVATE KEY). The anchor count and SHA-256 fingerprints are logged at boot.

  • upstream/client.rs: UpstreamHttpClient, built at boot with no request, in one Client::builder() chain:

    • .connect_timeout(2 s), .timeout(2.5 s) and .redirect(Policy::none()), as cargo xtask http-clients audit-timeouts and audit-redirects require in the constructor’s own chain, plus .https_only(!development);

    • with a bundle, .tls_built_in_root_certs(false) and one .add_root_certificate(Certificate::from_der(..)?) per anchor; never tls_built_in_webpki_certs(false), which leaves the OS store trusted.

  • The end-to-end deadline across discovery, JWKS and userinfo is I2c’s. The client honours the system HTTPS_PROXY (TLS is end to end, so the anchors still apply). Bodies are read through read_capped_body, which does not check the status, so each caller does. A host-resolution override (resolve) exists only under canopy-auth’s test-helpers feature, for U7; the gate scans that code as production, so it keeps the same chain.

  • canopy-security builds the anchors and the client at boot beside the profile, unwired until I2c.

  • Tests: each bundle refusal, an ENCRYPTED PRIVATE KEY block among certificates included; a proptest that arbitrary bundle bytes never panic; the client refuses http outside development and follows no redirect (in-process listeners); an https request to a plain listener fails. The positive proof that a private CA is accepted is U7’s, against Kanidm’s CA (no new TLS dev-dependency). That a bundle excludes the built-in roots is checked by review of the one builder chain; no test can observe it without a public-CA fixture.

Erratum (2026-10-05): as built, the builder chain states .tls_built_in_root_certs(anchors.is_none()) (false exactly when a bundle is given, which clears both the webpki and the OS store) and a fold then adds each anchor with add_root_certificate, since no reqwest call adds several roots in one chain. The bundle walk counts every -----BEGIN marker, not only those at a line start, and also refuses a certificate rustls cannot use as a trust anchor. UpstreamHttpClient::get answers with the status and headers, and body(limit) then reads the capped body, so a caller judges the status first. Transport failures are typed by how far the request got: UrlRefused, Connect, Tls and ConnectTimeout sent nothing; Timeout and ConnectionLost may have been received; TooLarge is a body over its cap. canopy-common’s caused_by_tls becomes public for the TLS class.

U3: the lazy discovery and key cache (canopy-auth)

  • HttpJwksKeySource's state machine (lazy first use, single flight, keep the newer set, fail closed on stale) becomes generic over a fetcher that dates the set, a key parser (and so the key type, Clone), a kid type, and a set payload that can carry more than keys, read through an accessor that takes no kid. canopy-identity’s keys keep their behaviour; the existing tests are the pin.

  • upstream/keys.rs instantiates it for the upstream. Discovery and JWKS are fetched together, each with Cache-Control: no-cache, on first use and then every 300 s, and the set carries discovery’s userinfo_endpoint for U5. Bodies are capped at 64 KiB; C5’s bounds and dating and C6’s endpoint and origin rules apply. Each key is parsed on its own:

    • skipped: a use present and not sig (a key with no use is kept, as today); a declared alg outside the profile’s list; a key type outside the profile’s algorithms; no kid;

    • a declared alg binds the key to that algorithm alone;

    • a duplicate kid among the kept keys refuses the set.

  • Tests, in crates/canopy-test-lib/tests/upstream_keys_test.rs, with an injected clock and never a sleep, against crates/canopy-test-lib/src/mock_issuer.rs extended with discovery that advertises userinfo_endpoint, jwks_uri and userinfo_endpoint overridable (another origin and a query included), key rotation, a scripted Age on discovery and JWKS, a record of the request headers, and discovery and JWKS faults (5xx, redirect, delay, oversize). The mock serves plain http at its bare origin, so these tests pass development and rely on U1’s bare-origin issuer form. Discovery without token exchange already exists (grant_types_supported). Cases: lazy first fetch; the 300 s refresh; one unknown-kid refetch per 30 s; fail closed at 720 s while a held set keeps serving inside it; a newer set followed by an older cached response (a larger Age, still holding a removed kid) leaves the removed key refused; an Age that makes a set born stale leaves the keys unavailable; a malformed Age fails the fetch; every fetch sends Cache-Control: no-cache; a discovery issuer mismatch; each C6 refusal, and a discovered endpoint with a query accepted; each key rule; an oversized body; a proptest that arbitrary discovery and JWKS bodies never panic. canopy-test-lib, which already depends on canopy-auth, gains the dev-dependency canopy-auth = { workspace = true, features = ["test-helpers"] }, as canopy-security has.

Erratum (2026-10-05): as built, the generic machine is the crate-private key_cache module: a KeyCache over a KeySetFetcher whose associated types are the kid, the key (Clone) and the payload, each fetcher owning its key parser; age_of moves with it. UpstreamKeySource::new takes the development flag, for the discovered-endpoint scheme rule. A discovered endpoint that fails the endpoint or origin rule fails the whole fetch, the userinfo endpoint included, so an IdP that publishes its JWKS or userinfo on another origin needs both named in the profile. Each JWK entry is judged on its own: an entry that is not a JSON object, or one whose judged member (kty, crv, x, y, n, e, kid, alg, use) is present and not a string, null included, or appears twice, skips that key. The JWKS must be a JSON object holding keys once, as an array, and discovery a JSON object whose issuer is a string and whose jwks_uri and userinfo_endpoint are each absent or a string (a null one is malformed, not absent, even where the profile names that endpoint), else the fetch fails. An EC key’s coordinates are length-checked at parse, the point itself being validated by aws-lc-rs when it verifies. Requests also send Accept: application/json, and the set is dated from the one attempt’s start.

U4: the upstream id_token validator (canopy-auth)

  • upstream/id_token.rs: UpstreamIdTokenValidator::validate(token, keys, now), where keys is a new async key-source trait over the upstream’s key types (U3 in production, a fixed set in tests) and now is injected (production passes chrono::Utc::now(), D14).

  • The header pre-check per C7 runs first. jsonwebtoken (10, aws_lc_rs) then verifies only the signature, under the key the kid names and the algorithm the profile binds to it: Validation::new(alg) with required_spec_claims empty, validate_exp and validate_aud false (validate_nbf is false by default), and never insecure_disable_signature_validation. Every time and party check is U4’s own, nbf included, against the injected now. It returns the verified anchor (iss, sub as an OidcSubject, auth_time, nonce) and the payload, or a typed refusal; unavailable keys are a separate outcome.

  • Tests, the pure rules in canopy-auth and the minted cases in crates/canopy-test-lib/tests/upstream_id_token_test.rs:

    • each C7 rule refused on its own, among them a future nbf (one inside the leeway accepted); a malformed exp, nbf, iat or auth_time; an auth_time after iat or now beyond the leeway; an additional audience even with azp equal to the client (a one-element aud array accepted); and the OidcSubject refusals the receivers pin today (empty, 256 bytes, non-ASCII, a control character), whose receiver test in jwks.rs stays;

    • a header typ of at+jwt refused; a Keycloak-shaped id_token (header typ: JWT, payload claim typ: "ID") accepted, since only the header’s typ is judged; the ES256 evil corpus (jws_evil_cases!, with CorpusInputs::max_token_bytes at 16 KiB) plus RS256 cases minted by MockIssuer::mint and verified against the keys it serves at /jwks; a string-valued crit member refused; a proptest that arbitrary input never panics.

Erratum (2026-10-05): as built, the evil-JWS corpus runs in canopy-auth’s unit tests, since jws_evil_cases!'s setup cannot fail and an integration-test crate cannot host it under the workspace lints; the mock-minted cases are in upstream_id_token_test.rs as specified. x5t and x5t#S256 may appear together, each at most once. The payload must be a JSON object naming each claim once. jsonwebtoken’s decode still parses exp, nbf, sub, iss and aud with its checks off: a value its parser cannot step over (any array or object in sub, or a non-empty one in exp or nbf) is refused as a malformed payload rather than by the claim’s own rule, while iss and aud are read whatever their shape and judged by their own rules, and an empty [] or {} in exp or nbf refuses as a malformed time claim. A time claim that is not an exact i64 is judged as the IEEE 754 double serde_json reads it as, so a text within about 1024 of ±2^63 takes its rounded value: one that rounds to 2^63 refuses, and one that rounds to −2^63 reads as i64::MIN. aud may repeat the client, a non-string nonce refuses, auth_time is returned as NumericDate seconds, and the key trait takes SystemTime (the key cache’s convention) while validate takes DateTime<Utc>. upstream::keys reads present-or-string members through identity_jws::present_string, now crate-visible.

U5: the userinfo client (canopy-auth)

  • upstream/userinfo.rs: fetch(access_token, expected_sub) (the token a zeroize::Zeroizing<String>, as SubjectBearer holds one) sends a Bearer GET to the profile’s or discovered userinfo_endpoint. Only a 200 whose media type is application/json is accepted (parameters such as ; charset=utf-8 are tolerated; a signed application/jwt response is refused), capped at 64 KiB and parsed as a JSON object; a sub other than expected_sub refuses (OIDC Core §5.3.2).

  • expected_sub is an OidcSubject. Outcomes are C9’s, so that I2c applies its grace rule directly:

    • Unavailable: connect failure, any timeout, the connection lost after sending, 408, 425, 429, 5xx;

    • Refused: any other 4xx;

    • Invalid: a 200 that fails the media type, the cap, the parse or the sub check, or any other status (a 1xx, a 3xx, since no redirect is followed, or another 2xx).

  • Tests, in crates/canopy-test-lib/tests/upstream_userinfo_test.rs: mock_issuer gains a userinfo route that serves a scripted status, content type and body; the lost connection uses a raw in-process TCP listener that reads the request and closes the socket. Cases: each outcome and each status class above, the sub mismatch, the media type, the cap, and a proptest that arbitrary bodies never panic.

Erratum (2026-10-05): as built, the client is UpstreamUserinfo, and fetch(access_token, expected_sub, keys, now) takes the key source and the injected now per call, as U4’s validate does, so I2c shares one source. A profile-named endpoint is called without consulting discovery, so discovery being down is Unavailable only when the profile names none. Four fail-closed outcomes join C9’s list as Invalid: an access token that is not an RFC 6750 b64token (never sent), an answer without exactly one Content-Type, no userinfo endpoint in the profile or discovery (a deployment defect), and an endpoint URL the client refuses before connecting; a status past 599 is one of C9’s "any other status". The answer is returned as UpstreamUserinfoClaims, whose Debug prints no claim. U4’s unique-member object reader moves to a crate-private upstream::json (UniqueObject), shared by the id_token payload and the userinfo answer.

U6: the federated projection (canopy-auth)

  • upstream/projection.rs: project(profile, anchor, claims) → Result<FederatedIdentity, ProjectionRefusal> per C8. RoleSet and ProgramSet build only from sorted, duplicate-free lists, so the projection sorts and dedups first.

  • Tests: each refusal variant; a service-marker role (service:…) never projects; programs read as the wire ids (chip and medicaid distinct); a proptest over arbitrary claim JSON.

Erratum (2026-10-05): as built, project takes the claims as a serde_json::Map (VerifiedUpstreamIdToken::payload() or UpstreamUserinfoClaims::claims()), the caller choosing by the profile’s claims_from, and is re-exported only as canopy_auth::upstream::project. FederatedIdentity carries the anchor’s iss, sub and auth_time with the roles, programs and UpstreamUsername, whose "no control character" is Unicode Cc (format characters such as ZWNJ stay allowed, for names in every jurisdiction). Refusals are judged in the order roles, programs, username. Programs match canopy-web’s admission (absent or empty is missing; a non-array, a non-string element or an unknown slug is malformed; a repeat is dropped) except that chip stays distinct and the set is in wire-id order. The shared unique-member reader now refuses a member repeated at any depth, and no longer treats serde_json’s private raw-value member name as an encoded value.

U7: the Kanidm lane’s proof (canopy-test-lib)

  • idp_conformance_kanidm.rs writes identity-upstream.yaml into a temporary directory (profile: kanidm, issuer <origin>/oauth2/openid/<client_id>, client_id, tls_trust_anchors: kanidm-ca.pem), copies the lane’s CA (Credentials.ca_path) beside it, loads it through U1’s load(dir, false), and reaches idm.canopy.test through U2’s test-helpers resolution.

  • New tests (the lane’s profile already runs them one at a time):

    • U3 fetches discovery and keys over the real private CA;

    • U4 accepts real and refreshed id_tokens and refuses Kanidm’s at+jwt access token presented as an id_token;

    • U5 binds to the right sub and refuses another;

    • U6 projects the reader and the SNAP worker as their roles and programs say (first restoring the SNAP worker’s program groups, as the refresh test does), and refuses the unscoped person as MissingPrograms, first clearing its account expiry, as the expiry test does. The module doc’s one-job list names these readers.

  • The lane’s verify (upstream::kanidm::login::verify, through the test’s verify_id_token) stays as an independent oracle. New assertions record what ADR-050 has not: preferred_username's value, an id_token exp − iat of 900, no typ in the id_token header, and same-origin jwks_uri and userinfo_endpoint; they go in an ADR-050 Amendment 3 run record, with its Status line.

  • The plan closes here: Status Done (YYYY-MM-DD) — !N; the page moved to docs/modules/ROOT/pages/plans/archive/; the nav group removed and the archived entry appended, suffixed — DONE YYYY-MM-DD, as the last line of the Completed Plans Archive group; and cargo xtask plan-lint --done docs/modules/ROOT/pages/plans/archive/identity-plane-split-i2b.adoc --allow-open 2692 --allow-open 2693 --allow-open 2694 --allow-open 2695 --allow-open 2696 --allow-open 2697 --allow-open 2698.

Conventions every unit follows

  • Every parser has a proptest: U1’s loader, U2’s bundle walk, U3’s discovery and JWKS parsing, U4’s validator, U5’s userinfo body and U6’s projection. U4, the token parser, also takes the jws_evil_cases! corpus (ADR-049 consequences). Errors are thiserror enums that never echo the input.

  • Every serde_json::Value under src/, unit tests included (U4’s payload, U5’s body, U6’s claims), carries // PARTNER-EDGE-UNTYPED: on the line before: the quality-budgets B3a threshold is 0.

  • Nothing calls the upstream at boot; tests inject now and never sleep.

  • Every unit ships its CHANGELOG.adoc Added bullet and extends shared-crates.adoc's upstream bullet with the types it adds.

Units

  1. U1 (w5) — feat(auth): load the deployment’s upstream identity profile (#2692).

  2. U2 (w3) — feat(auth): pin the upstream’s TLS roots and bound its client (#2693).

  3. U3 (w5) — feat(auth): cache the upstream’s discovery and keys lazily (#2694).

  4. U4 (w5) — feat(auth): verify an upstream id_token against its profile (#2695).

  5. U5 (w3) — feat(auth): call userinfo bound to the id_token’s subject (#2696).

  6. U6 (w3) — feat(auth): project an upstream identity to roles and programs (#2697).

  7. U7 (w3) — test(identity): prove the kanidm profile on the Kanidm lane (#2698).

Verification

  1. Per unit: fmt; clippy in both profiles; nextest for canopy-auth, canopy-security and canopy-test-lib; rustdoc-private; quality-budgets; feature-builds (canopy-auth without test-helpers builds only there); http-clients audit-timeouts and audit-redirects; secret-loads.

  2. U7: two full cargo xtask identity conformance --idp kanidm runs, reading the JUnit in full.

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

Review log

round vendor resolved model verdict

1 (2026-10-04)

Anthropic

claude-opus-5-5

no-ship. Seven blockers, all fixed: the algorithm set and its key types; what a preset profile’s file may state; the token size cap, the header member list and the username bound; the https rule against development; userinfo outcomes split so Amendment 2’s grace rule applies unchanged; the projection’s refusal variants; the ADR changes recorded (ADR-050 Amendment 2 for C4, and C8 amending D6). Also taken: the [identity] readers corrected, the key source’s generic parameters, a per-request client bound, U4’s signature-only verification, test locations and dependencies, URL canonicality, the boot wiring of the anchors, U7’s test order, and the exact plan-close command.

2 (2026-10-04)

OpenAI

gpt-6-astra

no-ship. Five findings and two decisions, all fixed: nbf checked by hand, since the library’s time checks are off; sub typed as OidcSubject, keeping the receivers' refusals; separate issuer and endpoint URL rules, so an endpoint may carry a query; the upstream key set dated by Age again, each fetch sending Cache-Control: no-cache, so an older cached copy cannot reinstall a removed key, with the cache’s Age recorded as the deployment’s requirement; any additional audience refused, narrowing D5; auth_time may not follow iat or now; userinfo failures get D6’s original grace (C9), since a GET spends no credential. No round 3.

Edit this page · default