Repository navigation
fix(service-settings)!: the settings route family refuses a session the ADR-0069 authentication policy holds - #23285
Conversation
… ADR-0069 policy holds SettingsContext declares an optional authGate (core's AuthGate). The plugin's verified resolver fills it with normalizeAuthGate from the session it already reads, and the family door asks evaluateAuthGate before the anonymous floor, answering 403 with the gate's code and message. A resolver that sets no authGate mounts the family as before. Claude-Session: https://claude.ai/code/session_01BRQ9Mp1yH7R1az6MaUM18H Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BRQ9Mp1yH7R1az6MaUM18H Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BRQ9Mp1yH7R1az6MaUM18H Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 9 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin dad54a2d73e23aefd14858cf421dfd33a6088f69 && git checkout dad54a2d73e23aefd14858cf421dfd33a6088f69
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 99e944daf26ac1d2d50e90c5b631349ab45f664f 8a0e89368c4b2ef4a5959766a1a14d85e99e8a98 && git checkout -B drift-repro 99e944daf26ac1d2d50e90c5b631349ab45f664f && git merge --no-ff 8a0e89368c4b2ef4a5959766a1a14d85e99e8a98
node scripts/docs-audit/affected-docs.mjs --json 99e944daf26ac1d2d50e90c5b631349ab45f664f
|
Contract reviewServed-tier: Inputs read: card #23178 (body; all thirteen comments, 6139290291 through 6147724004, including triage's direction 6142961139, the seat's landing and release 6142709445, the dispatch 6146033345, the dev report 6147674138 and the seat ACCEPT 6147724004); PR #23285 (body; the one bot comment 6147651038; the 5-file list; the net diff against Check-runs on the head (last read 2026-10-13T14:30Z): 39 runs; 28 conclude ① Derived judgmentsAccept-set and public-surface changes the diff implies, each judged:
② Semver level
③ Boundary flagsEvery deviation and
Implemented-by: VERDICT: PASS |
Fixes #23178
Clause-②: yes (narrowing) — an optional
authGateon the exportedSettingsContextwidens the public surface; the family door's refusal of a held session narrows what it answers.What changed
ADR-0069 holds a signed-in user out of every protected resource while their password has expired or while enforced MFA is not yet enrolled. REST's
enforceAuth, the runtime dispatcher and the four families PR #23200 gated refuse such a session with403and the gate'scode. The settings family (registerSettingsRoutes) resolves its own caller and never asked. This is the last row of #23178, done as triage directed (option A).@objectstack/service-settings,SettingsContext. New optional fieldauthGate, typed by@objectstack/core's existingAuthGate. It is the same shape and meaning asExecutionContext.authGate, and it is present only while the session is held.registerSettingsRoutes, the family doormountFamilyRoute. The door now asks the shared decision,evaluateAuthGate, about the context it resolved. A held session gets403with the gate's owncodeandmessage, in the family's declared envelope, on every route, before the anonymous floor and before any settings logic. That is the order and the answer ofenforceAuth. No copy of the allow-list or of the gate decision is written here.SettingsServicePlugin, its verified resolver. It keeps the user of the session itsgetSessionclosure already reads forresolveAuthzContext, and putsnormalizeAuthGate(sessionUser)on the context it returns. This is the shape PR fix(services)!: the datasource admin, share-link, webhook redeliver and storage families refuse a session the ADR-0069 policy holds (#23178) #23200 used for share links. One session read serves the identity and the posture.@objectstack/coreis read, not edited.A host resolver that sets no
authGatemounts the family exactly as before, because the field is optional. A host that bridges the routes onto its own server with its own resolver sets the field to have its held sessions refused too.Where the field is declared.
SettingsContextis declared insettings-service.types.ts, not insettings-routes.tsas the claim's file surface says.settings-routes.tsimports it from there. The field went where the type lives, in the same package. That is the claim's intended change, at the real declaration site.Measured first (the PM's mechanism assumptions)
origin/mainat6d7f4df3c,registerSettingsRoutesmounts all four of its routes throughmountFamilyRoute, and the door resolves its caller throughcontextFromRequest, which returnsSettingsContext. The pin's census reads the registration: four routes, equal toSETTINGS_ROUTE_LEDGER, no middleware, and onlyGET/PUT/POSTverbs. Held: holds.getSessionclosure thatresolveAuthzContextcalls. The session user it returns carriesauthGatefrom the authcustomSessionenrichment.resolveAuthzContextcalls that closure only when no API key admitted the caller, so an API-key caller has no session posture to carry. The pin counts one session read per request. Held: no second read is added.503 SERVICE_UNAVAILABLEwhen the gate is active and its own session read fails. REST answers the same whenisAuthGateActive()is true and its gate re-read fails after the caller was resolved. Both come from a SECOND read, separate from the one that resolved the caller. The settings resolver reads the session once. A read that fails resolves no caller either, so the anonymous floor refuses it with401, which is also REST's answer when its first read fails. That state does not exist here, so there is no 503 arm. An authorization-store outage raised byresolveAuthzContextis still relayed as503by the door, unchanged.evaluateAuthGatewith the empty path, the predicate's declared fail-closed input, as the anonymous floor already does. AbasePathmoved under an allow-listed name inherits no exemption, and a pin case shows it, with a non-vacuity check that the allow-list really would exempt that base if asked.@objectstack/service-settingswas built fromsrcbefore the change (at6d7f4df3c) and after it, and the twodist/index.d.tswere diffed (index.d.ctsis byte-identical toindex.d.tsin both builds). The diff holds:authGate?: AuthGate;onSettingsContext, with its doc comment;AuthGatejoining the existing@objectstack/coreimport line;settings-routes.ts, whose description of the door now names the gate (prose only);builtinSettingsManifestswhose 19 members print in a different order. The member set is identical (checked), and the order followstsc's type-creation order, which the new import moves.No declaration is added, removed or changed besides the field. Sizes: 129638 bytes before, 130655 after.
Pins
New file
settings-routes.auth-gate.pin.test.ts, 22 tests, laid out like PR #23200's pins. Routes are named in test titles by the service member their own work calls (listManifests,getNamespace,setMany,runAction). The names are read off a served request, not typed into the file.OPTIONSroute, so a CORS preflight never reaches the door and stays the host's answer.PASSWORD_EXPIRED,MFA_REQUIRED), plus an async resolver, is refused. The assertions arestatus403,error.code, the gate'smessageand nodata, and the service is never reached. Also: a held session under an allow-listedbasePathis refused.authGategets200on every route, and the service sees that very context.SettingsServicePlugin, booted for real (init,start,kernel:ready), refuses a held session on every mounted route under both postures, with one session read per request. The context'sauthGateequalsnormalizeAuthGate(sessionUser), not a verbatim copy. An un-held session's context has noauthGatekey, and the index serves it200.Ablation (after commit
8a0e89368, throughscripts/ablation-replace.mjsWRAP mode, under a restore trap)refuseHeldSessionline deletedTests 15 failed | 7 passed (22): every held case (8 per posture, 4 async, the allow-listed base, 2 producer);expected 500 to be 403,expected 200 to be 4030dbf0723ee5b== HEAD,git diff HEADemptyauthGatespread deletedTests 3 failed | 19 passed (22): the 2 producer held cases and the normalization case;expected 200 to be 403,expected undefined to deeply equal …a74f80c0c265== HEAD,git diff HEADemptyOnly the held cases went red in each leg, and each half is pinned by its own cases. The pins import the family from
srcand@objectstack/corethrough the package's vitest alias, so nodist/leg applies.Verification (tree
8a0e89368)pnpm --filter @objectstack/service-settings test: 44 files, 810 tests, all passed (exit 0). The new pin alone: 22 passed.pnpm --filter @objectstack/service-settings typecheck: exit 0. The new pin is in the package's typecheck program (tsc --listFilesOnly: 1 hit).pnpm --filter @objectstack/service-settings build: exit 0,check-dts-emitted2 of 2 declaration files present. The declaration diff is under Measured first, item 5.dispatch-gates --commands --repo objectstack-ai/objectstackon this tree derived 66 commands. All were run and each exit code recorded before any pipe.--ranreconcile:66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN. Every command exits 0.check:dual-build-cjs-loadsfirst answered PREREQUISITE NOT MET (54 unbuilt packages). After a fullturbo run build(74 tasks, 73 cached) it exits 0, and the four other dist-reading gates (check:dts-closure,check:published-files,check:lean-entry-closure,check:sourcemap-no-sources-content) were re-run on the built tree and exit 0.check-changeset-no-majorwith this body as the event payload: exit 0, readingClause-②: yes (narrowing)with no package gradedpatch.check-adr-0087-registration: exit 0, 1 declared-breaking changeset carryingnot-required (no-migration-prescription).eslint.config.mjs: itsfilesglobs are.ts/.js-family only, so the changeset is outside it.eslint --no-inline-config --format jsonover the 4 changed.tsfiles: 4 files linted, 0 errors, 0 warnings. The config never enables type-aware linting (noparserOptions.project, noprojectService), so this diff cannot move a verdict on an untouched file.SettingsContext(git grep, docs aside). The requiredTypeScript Type Checkjob type-checks every package in CI.Acceptance notes
resolveAuthzContextadmits the API key and never reads the session, so this resolver carries no posture for that request. REST re-reads the session for its gate and would refuse it. The share-link resolver PR fix(services)!: the datasource admin, share-link, webhook redeliver and storage families refuse a session the ADR-0069 policy holds (#23178) #23200 landed has the same shape, and a held user's API key alone is admitted by REST too. Noted, not filed.ExecutionContext.authGate.codeis declared as a bare string, so this door narrows it toErrorCodewith a cast, as the four sibling doors do (PR fix(services)!: the datasource admin, share-link, webhook redeliver and storage families refuse a session the ADR-0069 policy holds (#23178) #23200's note).minorwith the BREAKING banner and the bang summary, and ADR-0087not-required (no-migration-prescription). The changeset is new (.changeset/23178-settings-auth-gate.md); PR fix(services)!: the datasource admin, share-link, webhook redeliver and storage families refuse a session the ADR-0069 policy holds (#23178) #23200's changeset is not edited.Generated by Claude Code