Skip to content

Phase B3: OIDC authorization and consent - #2036

Merged
neuromechanist merged 22 commits into
feature/issue-2014-epic-oidc-providerfrom
feature/issue-2017-phase3-oidc-authorization-and-consent
Nov 4, 2026
Merged

neuromechanist merged 22 commits into
feature/issue-2014-epic-oidc-providerfrom
feature/issue-2017-phase3-oidc-authorization-and-consent

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase B3 of the OIDC provider epic (#2014), implementing #2017: the authorization endpoint's two API routes, migration 0122, code minting, consent, and the copy the website page renders. The page itself is nemarOrg/website#501, now based on the website's staging. A person signed in at the app host can be sent to /oauth/authorize by a registered client, see what the client may do, consent, and be redirected back with a single-use code, state and iss.

What changed

  • shared/contract/oidc-authorize.ts: the wire contract (route paths, the sign-in marker parameter and its ten-minute window, the caller marker header and value, the request length bound, the consent token lifetime, the answer kinds with a compile-time tie to the answer shapes, error-page codes, the closed list of redirect errors, rule refusal reasons, decisions), written as text-readable literals for the website's drift test. Its header says the routes answer 404 until HOST_PREFIXED_SESSION_COOKIE is "1".
  • backend/src/db/migrations/0122_oidc_grants_and_codes.sql: oidc_grants (sorted JSON scopes, consent_kind first_party or user, one live grant per account and client by a partial unique index) and oidc_codes (id INTEGER PRIMARY KEY, code_hash NOT NULL UNIQUE, client, account, grant, redirect address, scopes, nonce, S256 challenge, auth_time, a CHECK that both times parse and that expires_at is at most 60 seconds after created_at, and used_at). client_id in both tables is the oidc_clients.id row id, never the public client id; the header says so, and a route test joins a stored grant and code back to the client's row. No foreign keys, as in 0121.
  • backend/src/services/oidc-identity.ts: the sign-in rule stated once: ORCID_PROVEN_SQL (an oauth_identities ORCID row whose iD is users.orcid, never orcid_verified), ACCOUNT_ACTIVE_SQL, the constant SIGN_IN_RULE_SQL for statements that mint, and signInRuleRefusal() (account_inactive, account_not_person, orcid_not_proven), for Phase B4: OIDC token, userinfo, revocation and introspection #2018 and Phase B5: OIDC revocation cascades and back-channel logout #2019 to reuse.
  • backend/src/services/oidc-authorize.ts: the decisions, in one order every request walks (below); the consent token; the signed sign-in marker; the grant upsert and the code insert, each re-reading session, account, client, sign-in rule, registered redirect and grant coverage in its own WHERE clause (the shape of DOCS_MINT_INSERT_SQL); and the prune of codes more than an hour past expiry, in every mint batch from either route. id_token_hint verification moved to backend/src/services/oidc-id-token.ts, and base64url decoding joined oidc-encoding.ts.
  • backend/src/routes/auth-oidc.ts, mounted at /auth: POST /auth/oidc/authorize (check) and POST /auth/oidc/consent (decide). Guards in a pinned order: the surface (404 unless the provider is on, the request is on the issuer host with no /nemar prefix, and HOST_PREFIXED_SESSION_COOKIE is on), the caller marker (403 without the fixed header the website page's server client sends and its browser proxy never forwards), isAllowedOrigin (403, before the session is read; a missing Origin is refused), webSessionMiddleware; then a session read under the legacy cookie name is no session, then the per-account budget, then the body. Every answer is no-store.
  • backend/src/routes/auth-orcid.ts, in three commits that cherry-pick on their own: every completed ORCID sign-in mints a fresh session and ignores any session cookie already in the browser (Mint a fresh session at every ORCID sign-in); a sign-in never attaches an iD to the account a pre-existing cookie names: an iD attaches to a session's account only in the explicit link flow and, while the flag is on, only from a __Host- session (Link an ORCID iD only from a __Host- session; it uses B1's cookie-name helpers); and only the POST start arms a link: a GET start with mode=link is now a plain sign-in, as mode=relink already was, so only the POST, which checks Origin and requires a session, puts link or relink in the state cookie (Start an ORCID link only from the POST route, review round 2). Settings' "Connect your ORCID" becomes a form POST in Phase B3: /oauth/authorize page website#501.
  • backend/src/services/oidc-clients.ts: registration refuses a redirect address whose query already names code, state, iss or error.
  • backend/src/middleware/rateLimit.ts: checkOidcAuthorizeBudget, thirty a minute per account across both routes, modelled on checkPrivateGrantBudget; neither route is in the strict per-address bucket.
  • shared/contract/account-copy.ts: oidc.consent.* (including oidc.consent.redirect_host, "Either answer sends you to {redirect_host}."), oidc.rule.* and oidc.error.*; {client} and {redirect_host} added to the placeholder vocabulary and to the parity test's allowed set; // DRAFT: wording pending the owner (#2017) above oidc.consent.compute_spend.
  • backend/wrangler-sccn.toml, backend/src/types/bindings.ts, backend/src/index.ts: the note that the authorization routes also answer 404 until HOST_PREFIXED_SESSION_COOKIE is "1", so both must be set.
  • ADR 0119 (still proposed): thirteen sentences across rules 3, 8 and 10 (four from the first pass, seven from review round 1, two from review round 2), and its index line in .context/decisions/README.md; listed under Decisions for review below.

The order every request walks

  1. Client and redirect address: an unknown or disabled client (one answer for both), a missing or repeated client_id or redirect_uri, a request over 8192 characters, or a redirect address that is not exactly a registered string is {kind: "error_page", code} and never a redirect.
  2. The request, each error a redirect to the registered address with error, state (when the request had exactly one) and iss: a present response_type other than code is unsupported_response_type (RFC 6749 section 4.1.2.1); a missing or empty one, a repeated parameter, a response mode other than query, a method other than S256 or no 43-character challenge, or an unreadable prompt, max_age or nonce is invalid_request; request and request_uri get their own codes; openid absent, a catalogue scope the client may not have, or a machine-only scope is invalid_scope; names outside the catalogue are dropped. A parameter with no value is treated as omitted.
  3. The session: none (or a legacy-name session) is {kind: "login"}, or login_required with prompt=none.
  4. Freshness: prompt=login, a max_age older than the session, or a valid id_token_hint for another subject is {kind: "reauth", request} (or login_required). The returned request drops prompt=login and carries a sign-in marker the API signs over the moment by D1's clock and the client; a session at least that new satisfies all three, so the person signs in once. A marker that does not verify, names another client, or is more than ten minutes old counts as absent. Front-channel freshness is a courtesy; a client relies on auth_time, the session's own sign-in time, which the code carries.
  5. The client's sign-in rule: {kind: "rule_refused", reason, client_name, location} with a prebuilt access_denied location (or access_denied with prompt=none).
  6. Consent: first-party only while every registered redirect address still passes isFirstPartyRedirect; otherwise third-party, asked under consent_mode (ask_once unless a user grant covers every scope asked for, always every time, and prompt=consent forces it for a third-party client; consent_required with prompt=none). A first_party grant is never taken for consent.
  7. The code: 256 bits from generateGrantCode, stored by hashGrantCode, 60 seconds by D1's clock; {kind: "redirect", location} with code, state and iss.

The consent token is HMAC-SHA256 under OIDC_SECRET, over a JSON array of the domain tag oidc-consent-v1, the session id, the client, the redirect address, the scope set, state, the challenge, nonce and an expiry ten minutes after the check by D1's clock, compared in constant time. The consent route walks steps 1 to 6 again and verifies the token against what it finds; a forged, expired, longer-lived, other-key, other-session or other-request token is consent_invalid.

Tests

  • backend/test/oidc-authorize-routes.test.ts (91), through the real Worker with real sessions from issueSession, clients from the owner route and keys from the owner's rotation: every refusal path with error page versus redirect and iss and state; unsupported_response_type versus a missing type; the caller marker; the signed marker (forged, other client, expired, future); the sign-in rule; consent (first-party skips, a first-party client whose address no longer qualifies is asked, ask_once asks again on a wider set, always, prompt=consent, deny, a second account on the same client is asked); a table of tokens that differ from the request in exactly one bound value, a token that claims a longer life, one at its expiry, a legacy cookie on consent; the code (60 seconds, hashed at rest, auth_time from the session, joined back to the client's row id, a mint that writes nothing answers an error page); redirect_origin per requested address; Origin, no-store, body shape, the 404 cases, and the per-account budget over the real limiter.
  • backend/test/oidc-authorize-migration.test.ts (26), on bun:sqlite and Miniflare D1: the tables' CHECKs (including unparseable times), the row id and unique hash, the one-live-grant index, the grant upsert, CODE_INSERT_SQL gate by gate (including another account's grant), auth_time, and the prune.
  • backend/test/oidc-authorize-inventory.test.ts (3): the router table and its guard order, now five handlers.
  • backend/test/oidc-authorize-sign-in-loop.test.ts (2): the reauth round trip and a legacy-cookie login round trip, each through the real callback, ending in a fresh __Host- session that the check accepts.
  • backend/test/orcid-callback-sign-in.test.ts (23, new) and backend/test/orcid-relink-route.test.ts (7): with the flag on AND off, a plain sign-in ignores both cookie names and mints a fresh session, a GET start with mode=link or mode=relink arms only a plain sign-in (with or without a session), the POST start arms a link for this site's Origin and a session, refuses another Origin or none (403) and sends a session-less POST to sign in, arming nothing; start to callback, the link attaches from a __Host- session and is refused from a legacy one while the flag is on; with the flag off, a link a GET tried to start signs in instead and attaches nothing to the account a legacy session names, and a link the POST started still attaches to a legacy session's account, the residual stated as a test.
  • backend/test/oidc-sign-in-rule.test.ts (2, table-driven): rule by status by deletion by kind by proof, through the SQL and the TypeScript, which must agree; and a consent sentence for every scope.
  • backend/test/oidc-client-rules.test.ts: a redirect address whose query names a response parameter is refused.
  • Mutation proofs: 46 in the first pass, 29 in review round 1 and 8 in review round 2, each a single exact edit of a guarded line, each killed by the test that guards it, files restored byte for byte. Round 2 covered the GET start arming link (two suites) or relink, the POST start's Origin check, its session check, the POST start unable to arm link, and the callback's link condition and legacy-link flag again under the new tests. Round 1 covered the callback's link condition (two suites), the legacy-link flag, the migration's time CHECK and unique hash, the mint's and the grant read's account binding, the response type split, the marker's MAC, window and client binding, the caller guard, the token's lifetime ceiling and expiry boundary, each value the token binds (nonce, challenge, redirect, client, scopes), the legacy cookie on consent, the failed mint, auth_time (route and statement), compute.submit as spend, redirect_origin, the registration query rule, the rule's kind and proof clauses, and the scope copy.

Gates

  • bun run typecheck: pass. bun run lint: pass (179 files, no fixes). bunx biome check on the 22 TypeScript files this PR adds or changes: clean.
  • bun run migrations:d1-check (alone, once): pass, 118 migrations applied on real D1, catalog matches bun:sqlite (170 objects, 52 tables).
  • Targeted suites (review round 1 head): every backend/test/oidc-* and backend/test/orcid-* file, rate-limit-buckets, session-cookie-name, identity-refusals-route and cli-self-service-routes: 28 files, 871 pass, 0 fail. Round 2 head: every orcid-* file (callback 23, relink 7, cookies 13, name 6, link-intents migration 4, SSO migration 8), oidc-authorize-routes 91, -sign-in-loop 2, -inventory 3, neurobagel-route-inventory 4, cli-self-service-routes 39, session-cookie-name 108: 308 pass, 0 fail; ADR tests 18 pass; parity against website#501 9 pass; typecheck passes; biome clean on the touched files. The caps table (rate-limit-site-identity.test.ts): 149 pass. ADR tests (adr-0119-wording, adr-index): 18 pass. test/account-copy-parity.test.ts with NEMAR_WEBSITE_ACCOUNT_COPY set to website#501's src/lib/account-copy.ts: 9 pass.
  • A real browser run (installed Chrome under Playwright) of Deny, Allow and a repeat against this head's Worker, served locally: 29 checks pass, with a negative control. Details on Phase B3: /oauth/authorize page website#501.
  • Not run: the full bun test (by the owner's rule it runs at epic to dev).
  • Two earlier commits (Treat an empty request parameter as omitted, Pin the OIDC authorize cap in the caps table) skipped the pre-commit hook; typecheck and biome have since been run by hand over the whole head and pass, and every round-1 commit went through the hook.

CI sequencing

Each repository's CI compares its copy and contract against the other's pre-release branch: this repository's parity test reads the website's staging, and the website's drift tests read this repository's dev. A change that adds copy keys on both sides cannot be green on both at once. This PR merges into the epic branch with test/account-copy-parity.test.ts (the new oidc.* keys absent from website staging) named as the only red. Website #501's drift tests are red until the epic reaches dev; its CI must be re-run on its head before it merges, and this repository's parity check turns green once #501 is on staging.

Decisions for review (deviations from the issue text)

  • The two routes answer 404 while HOST_PREFIXED_SESSION_COOKIE is off, not only while OIDC_SECRET is unset. Only a __Host- session may approve a grant, so with the flag off no session can, and a person sent to sign in would come back to the same answer forever. Recorded in ADR 0119 rule 10, and noted beside the flag in the toml, the bindings, the contract and index.ts.
  • Every completed sign-in mints a fresh session, and a sign-in never links an iD to a pre-existing cookie's account. A person whose session was read under the legacy name, or who was asked to sign in again, comes back with a new __Host- session after one sign-in. Recorded in ADR 0119 rule 10.
  • Only the POST start arms an ORCID link (review round 2). A GET start with mode=link is a plain sign-in, as mode=relink already was, so a link can no longer be armed by a cross-site navigation, with the flag on or off.
  • Decision for the owner: the three ORCID commits are a PARTIAL production fix, and the closing change is the production flag. With HOST_PREFIXED_SESSION_COOKIE off (production today), a legacy session cookie set from a sibling host can still stand in for the person's own session in a link the person starts, until the production flag is on; a test states that residual. The recommendation is to close it by turning the production flag on, rather than shipping these commits ahead of the epic as "the fix". Recorded in ADR 0119 rule 10.
  • The consent token also binds nonce. nonce is stored in the code too, so the token covers every value the code carries.
  • login and reauth return the request to come back with, built by the API, and the sign-in marker in it is signed (domain oidc-reauth-v1, the moment and the client, ten minutes). A marker that does not verify counts as absent. Recorded in ADR 0119 rule 3, with freshness as a courtesy and auth_time as what a client relies on.
  • The routes require a fixed caller marker header. The website's general browser proxy refuses auth/oidc/* and never forwards that header, so an answer that carries a code or a consent token reaches only the page's server code.
  • First-party is re-checked over every registered redirect address, and a client that no longer qualifies is treated as third-party and asked, not refused. A first_party grant never counts as consent. Recorded in ADR 0119 rule 8.
  • Grant scopes: a person's consent only widens their own user grant and replaces a first_party one; a first-party authorization widens a grant and marks it first_party. The union is computed by D1 at write time.
  • prompt=consent forces the screen for a third-party client and is ignored for a first-party one; select_account is accepted and ignored; an unknown prompt value is invalid_request; an invalid or foreign id_token_hint is ignored.
  • A present response_type other than code is unsupported_response_type (RFC 6749 section 4.1.2.1), and a missing or empty one is invalid_request; the issue said invalid_request for both.

Not done, or for the owner

  • Deploy order for the GET start change: once this API is live, a GET start with mode=link is a plain sign-in, so a Settings page that still uses the old link would start a sign-in (for an iD nobody holds, a sign-up) instead of a link. Website#501's form POST should be live no later than this API.
  • The compute-spend sentence, oidc.consent.compute_spend ("It can also reserve and spend your NEMAR compute time."), is a draft marked // DRAFT: wording pending the owner (#2017) in both copy files.
  • The private-site and docs grant routes are reachable through the website's general proxy in the same way the authorization routes were; they are unchanged here, as instructed, and whether they get the same guard is the owner's decision.
  • The amendment comment on Phase B3: OIDC authorization and consent #2017 still says a returning person needs "at most one extra sign-in"; ADR 0119 rule 10 now states the corrected rule, and the comment needs the same edit.
  • Design section 3 route names, after merge (the issue's "When merged").
  • bunx biome check backend/src shared test reports errors and warnings that are all present on the epic branch before this PR, in files it does not touch.
  • A registered redirect whose host holds a character the URL standard allows but a policy would split on (;, ', ,, *) gets the website's unavailable panel instead of a consent screen; registration (B2) accepts such a host today.

@neuromechanist

Copy link
Copy Markdown
Contributor Author

Targeted neighbour suites (the owner's rule: no full bun test in a phase). 35 files: every backend/test/oidc-*.test.ts, private-grant-route, docs-auth-routes, partner-hosts-routes, maintenance, cors-origins and every rate-limit-* suite.

  • First run: 1080 pass, 4 fail. One was a real miss in this PR: rate-limit-site-identity.test.ts pins every cap in __limits, and the new OIDC_AUTHORIZE_MAX_REQUESTS was not in its table. Fixed in bfa674e7; the file passes.
  • Rerun, after the fix, in four parallel batches: 1081 pass, 3 fail. All three are suites that start Miniflare's workerd and timed out while this machine's file system was stalled (the same stall that hung migrations:d1-check): the beforeAll of oidc-authorize-migration.test.ts (this PR's; all 22 of its tests passed on both engines before the stall began), and two suites this PR does not touch, the beforeAll of oidc-migration.test.ts and oidc-jwks-memo-identity.test.ts (5 s timeout). Worth one rerun on a healthy machine or in CI: cd backend && bun test test/oidc-authorize-migration.test.ts test/oidc-migration.test.ts test/oidc-jwks-memo-identity.test.ts.

Not run, would check: the full bun test (runs at epic to dev); bun run migrations:d1-check to completion (wrangler hung on the first migration during the stall), which would confirm the wrangler replay of 0122 beyond the Miniflare D1 run in the migration suite.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR2036

Version: 0.10.28-PR2036.d623571
Commit: d623571


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit 891fc97 into feature/issue-2014-epic-oidc-provider Nov 4, 2026
18 of 20 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-2017-phase3-oidc-authorization-and-consent branch November 4, 2026 21:09
neuromechanist added a commit that referenced this pull request Nov 6, 2026
* Phase B1: ADR 0119, partner hosts, __Host- cookie and OIDC subject (#2031)

* docs: ADR 0119, NEMAR as an OIDC provider

* feat: exclude partner hosts from origin checks

* feat: __Host- session cookie behind a flag

* feat: users.oidc_subject and owner lookup

* feat: reserve the nmu_ username prefix

* docs: refresh compute notes for ADR 0119

* docs: ADR 0119 notes the single legacy clear

* docs: ADR 0119 names the cookie exposure

* docs: correct stale session cookie docblocks

* fix: brand OidcSubject, correct shared docblocks

* docs: say who deletes TOLERATED_GAPS entry

* feat: __Host- names for the ORCID flow cookies

* feat: reversible flag, slide and sign-out rules

* test: name-aware session cookie in live tests

* docs: ADR 0119 states the cookie principle

* docs: refresh stale cookie comments, 0120 notes

* fix: sign-out cascades for every carried account

* docs: ADR 0119 rule 9 matches the Context

* fix: name every account in the sign-out log

* Phase B2: OIDC client registry, signing keys and discovery (#2033)

* Add the OIDC scope, token and id vocabulary

* Add migration 0121 for OIDC clients and keys

* Add OIDC config and signing key service

* Amend ADR 0119 rule 8: first-party needs NEMAR hosts

* Serve OIDC discovery and keys on the issuer host

* Add owner routes for OIDC clients and keys

* Declare OIDC_SECRET as a Worker secret

* Add nemar admin oidc commands

* Retype OIDC vocabulary and share encoders

* Add revoked key state and unique active names

* Harden OIDC key rotation and add revocation

* Tighten OIDC client registration rules

* Close OIDC surface bypasses and cached errors

* Add keys revoke and emergency rotation to the CLI

* Record OIDC key and client decisions in ADR 0119

* Note what the key set cache depends on

* Use router path, add --emergency, ADR note

* Phase B3: OIDC authorization and consent (#2036)

* Add the OIDC authorization wire contract

* Add migration 0122 for OIDC grants and codes

* Add the OIDC sign-in rule and ORCID proof

* Add OIDC authorization and consent service

* Add a per-account OIDC authorize budget

* Serve OIDC authorize and consent routes

* Add OIDC consent, rule and error copy

* Record phase B3 rules in ADR 0119

* Correct the OIDC error copy comment

* Treat an empty request parameter as omitted

* Pin the OIDC authorize cap in the caps table

* Mint a fresh session at every ORCID sign-in

* Link an ORCID iD only from a __Host- session

* Give OIDC codes a row id and strict times

* Refuse a redirect query naming code or state

* Move ID token reading into its own module

* Sign the reauth marker, guard the caller

* Show the redirect host on the consent screen

* Say the authorization routes need the flag

* Record round-1 authorization rules in ADR 0119

* Start an ORCID link only from the POST route

* State the flag-off ORCID link residual

* Phase B4: OIDC token, userinfo, revocation and introspection (#2042)

* Add oidc_tokens table (migration 0123)

* Add OIDC token, userinfo, revoke, introspect

* Refuse OIDC tokens on every non-OIDC route

* Add the oauth-ip rate limit bucket

* Name the nemar.account claims in discovery

* Test token statements, router and bearer

* Use a plain string in the bearer test

* Let the statement decide the refresh token

* Record token rules 13 and 14 in ADR 0119

* Note the /oauth routes beside the cookie flag

* Revoke on any second presentation of a code

* Make the access expiry index partial

* Revoke a refresh token's siblings on rotation

* Revoke a used code only after PKCE matches

* Serve userinfo and introspection in read-only

* Seed owner-only data in the allowlist test

* Bare bearer challenge, userinfo scope pinned

* Omit token_type for a refresh token; type user

* Test the content type and a late reuse

* Scan the constant-time comparisons

* Test database and signing faults

* Test trimming, form decoding, grant binding

* Correct the surface and bearer docblocks

* Record round-1 token rules in ADR 0119

* Let the lost claim detect a code's replay

* Refuse a retry once the first child was used

* Exempt only POST in read-only maintenance

* Record round-2 token rules in ADR 0119

* Correct the ADR 0119 index line

* Test the grace's time limit on its own

* Phase B5: OIDC revocation cascades and back-channel logout (#2045)

* Add oidc_logout_deliveries (migration 0124)

The intent row of a back-channel logout, and the closed words of an ending: reasons, statuses, error classes and the retry schedule. Tested on bun:sqlite and Miniflare D1; d1-check passes.

* End OIDC grants in every credential cascade

One cascade module (oidcEndStatements) is added to the batch of admin revoke, the owner soft delete and its sweep, ORCID unlink and relink, a kind change away from person, the owner end-account route and the client disable. It queues the logouts, revokes the tokens and grants and deletes unused codes. Role demotion, key revocation and sign-out are deliberate non-paths with tests. Tested through the real routes; each caller mutation-checked; caller count held by a source scan.

* Send back-channel logouts after a cascade

The sender signs a logout+jwt and posts it to the client's registered https address after the batch commits (waitUntil), never following a redirect, with a 5 second timeout, no answer body read and no credential. 5xx and network errors retry at 1m, 5m, 30m, 2h and 12h from a production-only 30 minute tick. A dev worker sends only to loopback or OIDC_LOGOUT_DEV_HOSTS and records the rest as fenced. Owner list view added.

* Add end-account and logout-deliveries commands

nemar admin oidc end-account (the manual merge step and incident tool) and logout-deliveries, and the disable command now reports what it revoked.

* Run the cascade statements on Miniflare D1

Every cascade and delivery store statement, as the real functions build it, runs on D1 itself, where bun:sqlite accepts SQL that D1 refuses.

* Record the OIDC cascade and logout in ADR 0119

Rule 12 gains the cascade function, its order, filters and caller list, rule 15 the delivery, token, request and fence, with consequences and open questions. Index line, AGENTS.md and implementation notes updated; wording pinned by test.

* Refuse a loopback host with a trailing dot

localhost. names localhost; the production address check now strips trailing dots before testing the host. Tested for production and dev.

* Document the kind change and the dev hosts var

The kind route comment names the grants it now ends; wrangler documents the absent OIDC_LOGOUT_DEV_HOSTS var; a userinfo test expects a disabled client's token row to be revoked.

* Retry throttled logouts, close the class list

A 408 or 429 is retried on the same six-attempt schedule with the class http_throttled; Retry-After is only a lower bound for the wait, capped at 12 hours, and only for those two. last_error_class is now a closed list in the unreleased migration, held equal as a set to the vocabulary for reason, status and class.

* Prune finished logout deliveries in the tick

The production tick deletes sent and fenced deliveries after 30 days and failed ones after 180, at most 500 a tick and after its delivery work, and never a pending row. The windows are named defaults in shared/oidc.ts for the owner to set before the first client registers. Dev has no tick and is not pruned.

* Log a database fault in the first attempt

attemptDueLogouts never throws, so the catch after it was dead and a fault in the first attempt (or the sweep's) left no trace. The tally is now logged as a count and the error's class, never its text, an address, a token or a subject.

* Agree on a trailing dot and test the fence

isLoopbackHost and isLocalOrLiteral fold a trailing dot, so registration of a logout or redirect address and the sender's check at send time agree. Tests: production ignores OIDC_LOGOUT_DEV_HOSTS for a local host that the list names, a stored address that is no longer sendable is recorded address_refused through the sender, dotted forms in the registry and verdict tables.

* Test the lease, unreported and the pins

Claimed-never-recorded attempts are taken up again when the lease lapses and failed as unreported once all six are used; the claim's two-minute lease is read from the database and pinned above the 5 second timeout; the timeout window is tight; the token-store reason test no longer feeds one list through itself.

* Hold the cascade callers by every reference

The caller scan now resolves import bindings of the cascade module (named, aliased, namespace, destructured, alias chains) and flags every other use outside it as a stray: a value, a raw SQL constant, a dynamic import, a re-export, a default import, a namespace element access, a module-level reference. Each way is planted and shown caught.

* Correct the end-account text, tighten types

The end-account question no longer says the person is asked again at every client (a first-party client does not ask), and the help says to pair the command with a revocation, deletion or kind change for a merge loser. The reason is a z.enum that never echoes a value, an unsent delivery's status and class are a typed pair, the soft delete and sweep paths get the restore test, and the stand-in reports the cause of an openssl failure.

* Record the round-1 rulings in ADR 0119

Rule 12 says a new path adds to OIDC_END_CALLERS and to the docs and private lists only when it runs their statements, that only the sweep is guarded, and that a merge loser's end-account is paired with a revocation, deletion or kind change. Rule 15 decides throttling with Retry-After, unreported, the owner routes without the cookie flag, and retention; open points updated.

* Drop kind change from the merge-loser steps

A kind change away from person ends only the person_proven_orcid grants, and a non-person account still meets active_account, so it cuts no merge loser off. The end-account help and ADR 0119 rule 12 now say to run end-account and then revoke or delete the loser, and why in that order. Tested: kind change keeps active_account grants and signs in again; the merge procedure through the real routes; wording pins fail on the old text.

* Cap a Retry-After of any length

A run of 11 or more digits was read as no Retry-After, so a partner asking for the longest wait got the shortest. parseRetryAfter now accepts any run of digits and caps digits and dates at 12 hours; the cap lives there and recordOf only takes the longer of it and the schedule. Tested: 12, 25 and 400 digits through the sender and a pure parser table; restoring the 10-digit limit fails both.

* Correct the delivery span and failed help

With Retry-After capped at 12 hours, a failed row's last attempt can come about 63 hours after its creation, not under a day: the retention comment, ADR rule 15 and its consequences now say within three days, derived from the constants and pinned by a test. The logout-deliveries help now lists what is final and what is retried, read from a table of every status from 200 to 599 through the real sender.

* Flag an exported alias of the cascade

The caller scan saw no call and no value in export const endIt = oidcEndStatements, so a caller in another file could hide behind it. An alias whose name is exported by its declaration (const, let, var, a destructured pattern, a namespace member, a later assignment to an exported let) is now a stray, reported once. Both headers say a call that never runs, or whose result is discarded, passes the scan. Tested with the real scanner on planted source; removing the check fails it.

* Phase B6: OIDC end-to-end test (S0, S1) (#2048)

* Pin relying-party libraries for the OIDC test

* Add OIDC end-to-end test with a real library

* Declare OIDC token error words once

* Check the token error type at compile time

* Scope e2e hooks and add verifier controls

* Pin openid-client 6.8.9

* Amend ADR 0119 on key re-encryption

* Narrow the key recovery to current and next

* List every verifier control in the e2e header

* Guard the e2e hooks against failed setup

* Phase B6: OIDC conformance rig and run (S4, S5) (#2049)

* Add the conformance plan configurations

* Add the conformance rig and its pre-flight

* Pin the conformance suite images by digest

* Add the OIDC conformance workflow

* Accept a redirect as the suite being up

* Run the suite scripts in their local mode

* Let every Basic module run to its outcome

* Give the rig a client for each purpose

* Record the approved deviations and skips

* Stop the rig and pin Python before upload

* Test the expected files and workflow limits

* Give each plan its own expected failures

* Expect both client_secret_post failures

* Accept a combined decision in the PKCE check

* Say what the exported results copy

* Log each authorization error the rig answers

* Check the authorization errors before upload

* Wait for the rig to exit before upload

* Bound the suite start and lower the Basic limit

* Say the suite goes on after the secret check

* Test the PKCE refusal, scopes and the pre-flight

* Test the authorization check and stop step

* Fail on malformed authorization lines

* Match strictly and report a missing log

* Test the check's entry point and its step

* Log a rule refusal as access_denied

* Read an error in the redirect fragment

* Count authorization requests against their lines

* Test each kind of authorization line

* Kill a rig that ignores the stop

* State the residual risk of a global allowed set

* Fix the tier claims in two OIDC test headers (#2053)

* Claim the unit-pure tier in two OIDC headers

* Fix OIDC test header wording

* Add a process CI tier and move the two OIDC process tests into it (#2056)

* Route CI TIER: process files out of unit-pure

Add scripts/ci/process-files.sh, which lists the files whose header
claims the process tier, and have unit-pure-files.sh skip them.
The routing test reads the new pattern from the script.
Tested: bun test test/ci-tier-routing.unit.test.ts.

* Add the process-tier CI job

One job, on the unit-pure trigger, that runs the files process-files.sh
lists and refuses an empty list. No secrets, no sharding.
Tested: routing test; actionlint shows only the three SC2086 notes
already present on the base.

* Move the two OIDC process tests to the process tier

oidc-conformance-rig and oidc-e2e now claim CI TIER: process, with the
reason stated. The routing test asserts they are listed by
process-files.sh and absent from the unit-pure list.
Tested: routing test; both files run on their own.

* Run the process tier in the deploy gate

The pure list skips process files, so test-gate gains a step that runs
scripts/ci/process-files.sh with the same empty-list refusal. The
routing test asserts the gate runs it.
Tested: routing test, both OIDC files, actionlint, typecheck, lint.

* Give the OIDC alias scan test 60 s (#2052)

* Reword the OIDC compute-spend consent sentence (#2057)

* Reword the OIDC compute-spend consent sentence

* Update ADR 0119 consent screen wording

* Remove the temporary conformance push trigger (#2059)

This branch was previously deployed

1 inactive deployment
npm — d6235718 Deployed Nov 4, 2026 by neuromechanist via publish #4164
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant