Skip to content

fix(plugin-auth)!: an origin an SSO register or update body names is trusted for that provider's discovery only - #34099

Merged
objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/sso-body-origins-trust-discovery-only
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/sso-body-origins-trust-discovery-only

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill under skills/** teaches trusted origins or SSO provider registration; content/docs/permissions/sso.mdx gains the rule in this change.

维护者速读

  • 改了什么:SSO 注册/更新请求体里写的 issuer 与 oidcConfig 端点的来源(origin),只在该提供方的服务端发现与校验时被信任(注册时的发现与端点校验,以及注册/更新打开“同时退出公司登录”时对登出端点本身的判定;为找该端点而读取的发现文档仍只按部署配置的可信来源),不再计入这次请求本身的来源校验;来源校验只认部署配置的可信来源,与其它 POST 一致。
  • 为什么改:请求体给出的来源只该服务于发现校验,请求自身的来源校验应当只看部署配置。
  • 风险与回滚:两处收紧(均属 BREAKING,见 changeset)。一:在未被信任的来源的浏览器页面上注册/更新 SSO 提供方,会被 403 INVALID_ORIGIN 拒绝;从控制台或配置来源发起不受这一处影响。二:为内网/私有网络上、其来源未列入部署可信来源的 OIDC 身份提供方打开“同时退出公司登录”(注册或更新),main 上会保存,现在被 400 VALIDATION_FAILED(signOutOfIdp)拒绝,即便从控制台发起;处理办法是把该提供方的来源加入 OS_TRUSTED_ORIGINS。回滚即 revert 本 PR。
  • 先看:packages/plugins/plugin-auth/src/auth-manager-auth-instance.ts(可信来源列表不再是按请求的函数)、src/auth-manager.ts(assertSsoSignOutOfIdpSupported 只把请求体来源交给登出端点判定)、src/sso-sign-out-of-idp.ts、src/sso-discovery-companion-origins.ts。
  • 两分钟验证:pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/sso-discovery-companion-origins.test.ts src/sso-sign-out-of-idp.test.ts,预期两文件全部通过(前者 27 例)。
  • 需要你做的:无,席位落地。

What changes

Rule. An origin taken from an SSO register or update request body is trusted only for the server-side discovery fetch and validation of that provider. It never becomes an accepted Origin for the request's own origin check, which sees exactly the deployment's configured trusted origins, as on any other POST.

  • auth-manager-auth-instance.ts: the auth instance's trustedOrigins option is the configured list with the SSO relying party wired too; it is no longer a per-request function.
  • auth-manager.ts: ssoDiscoveryTrustedOrigins reads the parsed body (the same issuer and oidcConfig endpoints, public-routable hosts only) instead of the raw request. It is the one definition of the body-named set, and two server-side readers of the provider take it: the vendor's discovery and validation, and the sign-out check's logout-endpoint verdict:
    • the vendor's /sso/register discovery and endpoint validation: the global before-hook (auth-manager-before-hook.ts) hands the set, with the existing companion origins, to that endpoint as a per-endpoint context change (ssoDiscoveryCompanionContext). This is the seam the companion origins already use: the vendor merges it into the endpoint's own context after its router-level origin check has run;
    • the sign-out capability check (assertSsoSignOutOfIdpSupported) on /sso/register and /sso/update-provider, when the request turns signOutOfIdp on: its verdict on the provider's OIDC logout endpoint alone trusts the body-named set beside the configured list, through trustingBodyNamedOrigins (sso-discovery-companion-origins.ts), an exact-origin match the same as the vendor's. judgeSignOutOfIdpCapability (sso-sign-out-of-idp.ts) takes that predicate as a separate input, isTrustedLogoutOrigin; the discovery document it reads to find the endpoint is fetched under the configured trust (isTrustedOrigin).
  • The vendor's /sso/update-provider endpoint itself fetches no discovery document, and its endpoint validation admits any public-routable host on its own, so the body-named set (public-routable only) changes none of that endpoint's verdicts. The sign-out capability check's logout-endpoint verdict on update is the one reader there, and it takes the set as above.
  • A second, declared narrowing: holding the sign-out check's discovery read to the configured trust means a registration or an update that turns signOutOfIdp on for an OIDC identity provider on a private network is refused 400 VALIDATION_FAILED on signOutOfIdp until that provider's origin is in the deployment's trusted origins (OS_TRUSTED_ORIGINS, or the trustedOrigins option). main saved it. The changeset declares it under "Who moves, too".
  • content/docs/permissions/sso.mdx: states the rule, which checks read a body-named origin on each door, and that the sign-out check's discovery read keeps the configured trust.
  • .changeset/sso-body-origins-trust-discovery-only.md: patch, BREAKING, with "Who moves" and the ADR-0087 not-required marker.

Tests

src/sso-discovery-companion-origins.test.ts, a top-level describe in the shared harness (a real AuthManager with the real sso() plugin over the in-memory engine, the origin check on as a deployment runs it):

  • register: an Origin equal to the body-named issuer is refused by the origin check (403 INVALID_ORIGIN); no provider row is written;
  • register: an Origin equal to a body-named oidcConfig endpoint's host is refused; no row is written;
  • update: an Origin equal to a body-named host is refused, for an endpoint and for an issuer; the provider row is unchanged;
  • with signOutOfIdp on, an Origin equal to a body-named host is still refused, on register and on update; nothing is written or changed;
  • the sign-out check's logout-endpoint verdict trusts a body-named origin: a configured-origin register with the switch on saves, keeping the logout endpoint;
  • the same for a configured-origin update with the switch on;
  • CONTROL: the sign-out capability check still refuses a logout endpoint on a host the body does not name (400 VALIDATION_FAILED on signOutOfIdp), on register (nothing is written) and on update (the row is unchanged);
  • the sign-out capability check trusts a body-named origin for the logout endpoint only: for a provider on a private network whose origin the deployment does not list, a configured-origin register with the switch on is refused 400 VALIDATION_FAILED on signOutOfIdp and nothing is written;
  • the same on update; the row is unchanged;
  • CONTROL: with that origin listed in the deployment's trusted origins, the same register saves and keeps the logout endpoint;
  • CONTROL: the same request naming a different host is refused by the origin check too;
  • CONTROL: a same-origin register naming an external issuer and a foreign endpoint still discovers and registers;
  • CONTROL: a same-origin register whose discovery names an endpoint the body does not is still refused discovery_untrusted_origin;
  • CONTROL: a same-origin update naming a foreign endpoint still validates and is saved;
  • CONTROL: another POST is judged against the configured origins alone.

Every switch-on case installs the identity provider's whole test environment (its discovery documents and its network placement), so none leans on the runner's own environment.

In the companion-origin table describe: the logout-endpoint verdict's predicate, trustingBodyNamedOrigins, admits a body-named origin by exact origin only (another port, scheme, subdomain or protocol, or a non-URL, is refused), and with no body-named origin it is the request's own predicate.

src/sso-sign-out-of-idp.test.ts: judgeSignOutOfIdpCapability with isTrustedLogoutOrigin given accepts a logout endpoint on the origin only that predicate trusts, while its discovery fetch receives isTrustedOrigin; with it absent, the same endpoint is refused on signOutOfIdp (the verdict falls back to isTrustedOrigin).

src/auth-manager.test.ts: the SSO-wired pins assert the configured list (production with a list, production with none: key omitted, non-production: the localhost trio), never a function.

Acceptance notes

  • The before-hook host gains one member (ssoDiscoveryTrustedOrigins), and the auth-instance host drops isSsoWired, which nothing there reads any more.
  • register-sso-provider.ts comments were re-read and still state the rule (an endpoint the registration names is trusted for that registration); no change.
  • origin/main was merged before the PR opened (at dc13f5644e). The round-2 commits were not followed by another merge: the commits on main since then touch neither plugin-auth nor its dependency closure, and there is no conflict.

Verification

Readings at head 027821da02, unless a line names another commit. Source is unchanged since 7a02d7506a; the commit after it changes tests, docs and the changeset only.

Rule tests before the fix, on main's source (commit 44a24a6)

vitest run src/sso-discovery-companion-origins.test.ts: 3 failed, 15 passed. The three request-origin rule tests were red (each answered 200 where 403 is required), and every CONTROL was green, including the different-host refusal.

Sign-out capability tests before the round-2 fix (commit dc13f56 plus the new tests)

vitest run src/sso-discovery-companion-origins.test.ts: 2 failed, 20 passed. The configured-origin register and update with the switch on were both refused 400 VALIDATION_FAILED on signOutOfIdp; the CONTROL for a logout endpoint on a host the body does not name, and the request-origin refusals with the switch on, were green.

Logout-endpoint-only narrowing, measured before the fix (CI at commit 18b8af0, the pins-first commit)

Test Core (7/8) on 18b8af0cea: plugin-auth 3 failed, 5538 passed. The two limit pins answered 200 where 400 is required: before the limit, turning the switch on for a provider on a private network whose origin the deployment does not list was saved on both doors, as on main. That is the verdict the changeset declares under "Who moves, too". The third red was the update-door CONTROL's own setup (its registration's discovery document published the foreign logout endpoint, which the vendor's register discovery refuses); the CONTROL now registers before that endpoint is published.

Ablations (fix committed first, restored from HEAD)
  • Request origin (at dc13f5644e): mutation through scripts/ablation-replace.mjs in auth-manager-auth-instance.ts, giving the trusted-origins option back the body-named origins for a register or update request. Anchor 1 to 0, blob eb0e0dd81971 to c27bae0d860c. Run of sso-discovery-companion-origins.test.ts and auth-manager.test.ts: 6 failed, 349 passed. Red: the three request-origin rule tests and the three SSO-wired configuration pins; every CONTROL stayed green. Restored: blob equals HEAD, marker count 0, git diff HEAD empty. A first attempt of this mutation dropped the original's error handling and threw (500s on the controls too); it was discarded and the faithful one above is the reading.
  • Logout-endpoint-only limit (at 027821da02): mutation in auth-manager.ts, handing the widened predicate back to the whole capability check as isTrustedOrigin. Anchor 1 to 0, blob 14c267f6a2ac to 5cdf115d1918. Run of sso-discovery-companion-origins.test.ts: 2 failed, 25 passed. Red: exactly the two limit pins (register and update); every CONTROL stayed green, the listed-origin CONTROL included. Restored: blob equals HEAD (14c267f6a2ac), marker count 0, git diff HEAD empty.
  • Sign-out capability hand-off, before it was limited (at f87435b23a): mutation in auth-manager.ts, giving the capability check no body-named origins. Anchor 1 to 0, blob eb3148fcb0c4 to e790b896028c. Run of sso-discovery-companion-origins.test.ts: 2 failed, 21 passed. Red: exactly the configured-origin register and update with the switch on. Restored: blob equals HEAD (eb3148fcb0c4), marker count 0, git diff HEAD empty.
Package build, typecheck and tests
  • pnpm --filter @objectstack/plugin-auth build: exit 0.
  • pnpm --filter @objectstack/plugin-auth typecheck: exit 0.
  • pnpm --filter @objectstack/plugin-auth test: Test Files 277 passed (277), Tests 5543 passed, 10 skipped (5553), exit 0.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands at 027821da02: 105 commands for this diff's 10 paths. All 105 run locally, each exit code recorded before any pipe: 102 exit 0, 3 exit 3 (PREREQUISITE NOT MET, nothing measured). --ran reconciliation: 105 derived, 102 run, 3 NOT-MEASURED, 0 UNRUN.

  • NOT MEASURED locally: check:type-check-debt (the shared verify lock was held by other dogfood batteries through two kept-place attempts), and check:skill-examples and check:dual-build-cjs-loads (both read the whole workspace's dist/, which that gate builds). CI at 027821da02: Type Check · debt ledger success and Lint & Repo Gates success.
  • The derivation warns that this branch is behind origin/main on five scripts/pm/ files it derives from. The branch is not re-merged (see Acceptance notes), so the families are this head's.
  • CI at 027821da02: Test Core, TypeScript Type Check, Lint & Repo Gates, Build Core, Governed Surface Queue Guard, Test UI, Live E2E UI, Dogfood Regression Gate and Check Changeset success; 38 success and 15 skipped in all, none failed or running.
Dogfood battery

At 027821da02, under the verify lock, after building the dogfood dependency closure: pnpm --filter @objectstack/dogfood test, Test Files 467 passed, 3 skipped (470); Tests 3962 passed, 42 skipped (4004); VERDICT command-exit 0. Source is unchanged since 7a02d7506a, so this reading covers that commit too. An earlier battery on f87435b23a read the same totals.


Generated by Claude Code

…rusted for discovery only

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
…trusted for that provider's discovery only

The request's own origin check reads the deployment's configured trusted
origins alone; the origins a /sso/register body names reach the register
endpoint's discovery fetch and validation, as the companion origins do.

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
… trusted for discovery only; changeset

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-auth, touching 13 documentable anchor(s).

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/kernel/contracts/auth-service.mdx (via AuthManager (symbol, a top-level class))
  • content/docs/kernel/services-checklist.mdx (via AuthManager (symbol, a top-level class))
  • content/docs/permissions/authentication.mdx (via AuthManager (symbol, a top-level class))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v18/18-2.mdx (via AuthManager (symbol, a top-level class))
  • content/docs/releases/v18/18-3.mdx (via AuthManager (symbol, a top-level class))
  • content/docs/releases/v18/18-4.mdx (via AuthManager (symbol, a top-level class))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json b29f2dd117f4d105d9377aac39f2823bc0dc9e65 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 51dceea70d51420abb999e058e73e55f43a0b4a2 — the merge of head 027821da02010557112814611d6a606be85f178d into base b29f2dd117f4d105d9377aac39f2823bc0dc9e65, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 51dceea70d51420abb999e058e73e55f43a0b4a2 && git checkout 51dceea70d51420abb999e058e73e55f43a0b4a2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b29f2dd117f4d105d9377aac39f2823bc0dc9e65 027821da02010557112814611d6a606be85f178d && git checkout -B drift-repro b29f2dd117f4d105d9377aac39f2823bc0dc9e65 && git merge --no-ff 027821da02010557112814611d6a606be85f178d

node scripts/docs-audit/affected-docs.mjs --json b29f2dd117f4d105d9377aac39f2823bc0dc9e65

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs b29f2dd117f4d105d9377aac39f2823bc0dc9e65 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f

Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (the maintainer routes contract-tier reviews to the review seat, 2026-11-15T19:06Z) · head dc13f56

@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head dc13f56 · 2026-11-15T19:09Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: dc13f5644e30ad1adca9350c68d221a53a27f19f
Local-runs: none
Scope: packages/plugins/plugin-auth/src/auth-manager-auth-instance.ts, packages/plugins/plugin-auth/src/auth-manager-before-hook.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.test.ts, packages/plugins/plugin-auth/src/auth-manager.test.ts + .changeset/sso-body-origins-trust-discovery-only.md, content/docs/permissions/sso.mdx

Read at 2026-11-15T19:19Z. First review of this head; claim: comment 6899725201; lane request 6899700369 on mailbox #33873. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla.

Read, never reviewed (outside the diff): packages/plugins/plugin-auth/src/sso-sign-out-of-idp.ts, packages/plugins/plugin-auth/src/register-sso-provider.ts, packages/plugins/plugin-auth/src/auth-plugin.ts, packages/plugins/plugin-auth/src/sso-provider-lifecycle.test.ts, packages/platform-objects/src/identity/sys-sso-provider.object.ts, and the published sources of better-auth and @better-auth/sso at the locked 1.7.12 (the request context, the hook pipeline, the origin check, the register and update-provider endpoints). Nothing was built or run; every statement below is a reading of the tree.

① Derived judgments

The rule: an origin a register or update body names is trusted only for the server-side discovery fetch and validation of that provider, and never as an accepted Origin for the request's own origin check, which reads the deployment's configured trusted origins alone.

The request-origin half holds on every door I could find.

  • The auth instance's trustedOrigins option is now the configured list in every arm (configured list; key omitted in production with nothing configured; the localhost trio outside production). No per-request function remains, so no door's origin check, callback or redirect validation can read anything a request carries. On main the function added origins for the register and update-provider paths only, so sign-in, callbacks, sign-out, the OIDC authorize gate and every other endpoint read the same list before and after: no legitimate configured flow there moves. Wildcard patterns, the deployment's own origin and env-supplied origins travel the same array path as on a deployment without the SSO relying party, which main already exercises.
  • The two bridge doors (/admin/sso/register, /admin/sso/update-provider and its siblings) re-dispatch a request through the vendor handler, so they meet the same static list and the same before-hook; the register allowance reaches them through the hook, which reads the parsed body, not the URL.
  • The allowance is scoped to one provider and one request: ssoDiscoveryCompanionContext copies the list it is handed, and the vendor merges the hook's answer into a fresh per-dispatch context after its router-level check has run. The shared context is not mutated; I found no cached or shared list and no path for one request's allowance to reach another.
  • Vendor discovery on /sso/register still receives the body-named origins (issuer and each explicit oidcConfig endpoint), and an endpoint that only the discovery document names is still refused.

The discovery half does not hold on every reader. M1.

M1 (must-fix) — The before-hook has a second server-side discovery reader for the same provider on the same request: the sign-out-of-IdP capability check (assertSsoSignOutOfIdpSupported, auth-manager.ts, calling judgeSignOutOfIdpCapability), which runs on /sso/register and on /sso/update-provider and validates the provider's logout endpoint with the hook-time context's isTrustedOrigin. On main that context held the body-named origins on both doors. At this head it holds the configured list only: on register the hand-off is the hook's return value, built after this check has already run, and on update there is no hand-off at all. So a register, or an update, from a configured origin that names the provider's issuer or endpoints and saves the switch on is refused 400 VALIDATION_FAILED on signOutOfIdp where main saved it, unless the operator lists the identity provider's origin. That is the provider's own discovery validation, the one use the rule says a body-named origin keeps. It is also a second narrowing that nothing declares, and three statements in the change are false for it: the PR body's "the body-named origins ... changed none of its verdicts" for update, the same sentence in the sso-discovery-companion-origins.ts header ("An update needs none of them"), and the changeset's "Unchanged: a registration from a configured origin still discovers and registers ...; an update from a configured origin". No test drives a register or update that carries the switch with a body-named origin, so CI is green over it. Either keep the rule on this reader (the body-named origins reach the capability check on both doors, for that check only, with a test pinning each door and a CONTROL that an endpoint the body does not name is still refused), or declare the narrowing in the changeset and PR body with its own remedy and pin it. The Console's Edit Sign-In Options action sends no issuer or endpoint, so it reads the configured list on main and here alike; the reach is the vendor doors called with a body that names both.

Tests. The new describe pins the request-origin half with the controls asked for: a body-named origin refused as Origin on register (issuer and endpoint) and on update (endpoint and issuer) with the rows unchanged; a different-host refusal; a configured origin accepted on register and update; a body-named origin accepted for the vendor's discovery; a discovery-only endpoint still refused; another POST judged on the configured list. auth-manager.test.ts pins the three configuration arms as a list, never a function. The gap is M1's reader.

S1 (should-fix) — content/docs/permissions/sso.mdx says an origin "a registration or an update names" is trusted for that provider's discovery and validation. At this head an update's named origin is handed to nothing. Once M1 is settled, make the sentence say what each door does.

N1 (nit) — the changeset subject reads fix(auth)! and the PR title fix(plugin-auth)!.

② Semver level

patch on @objectstack/plugin-auth, with Clause-②: no (narrowing) and Metadata-protocol: none on both the PR body and the changeset. That is the level AGENTS.md sets for a breaking change that moves no metadata protocol. The changeset carries the BREAKING banner, exactly one ADR-0087 marker (not-required (no-migration-prescription), and nothing stored changes shape, so the disposition fits), the from and to of the option (per-request function to the configured list), who moves, and the one-line remedy (send from a configured origin, or add the page's origin to trustedOrigins / OS_CORS_ORIGIN). For the narrowing it names, the declaration is complete. It is incomplete for M1's second narrowing, and its Unchanged list overstates.

CI at this head: 62 check-runs, all completed; 40 success, 21 skipped, 1 cancelled. The cancelled run is a Check Changeset run superseded by a later Check Changeset success on the same head. Nothing is running or red. Green CI does not cover M1: no test reaches it.

③ Boundary flags

  • The hand-off rides a vendor seam (a before-hook's context answer merged per dispatch, arrays replaced) that the companion origins already use; a vendor upgrade that changes that merge moves both, and the new CONTROL for a foreign endpoint would go red, which is the right alarm.
  • The before-hook host gains ssoDiscoveryTrustedOrigins and the auth-instance host drops isSsoWired; both host interfaces and the wiring in auth-manager.ts agree.
  • Security discipline: this record stays at the rule layer. One pre-existing observation about the discovery allowance, unchanged by this head and outside the rule this PR claims, is held by the review seat outside this record and is not graded here.

④ Design judgment

Against the published surface on main: the declared narrowing makes the spec's own refusal real. trustedOrigins is documented as the deployment's list, and a request body adding to the list its own origin check reads was never a declared capability, so taking it away removes nothing a consumer was promised; the only client that moves is the one the changeset names. Moving the body-named origins onto the per-endpoint seam, next to the companion origins, is the right shape: one seam, one request, one provider.

The design is not finished, though. The rule names "discovery fetch and validation of that provider", and the tree has two readers of that kind on these doors: the vendor's, which the hand-off reaches, and the plugin's own capability check in the same hook, which it does not. The change reasons about the vendor's reader alone, on both doors, and that is where M1 comes from. A must-fix found here is a FAIL.

Implemented-by: claude/sso-body-origins-trust-discovery-only
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: FAIL

…ister or update body's origins

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
…pdate body's origins, for that read only

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
…origins; changeset text

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head f87435b · 2026-11-15T20:04Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f

Delta review on f87435b23a (after FAIL 6899874194; you have claimed it). The PR body now carries the round-2 text: M1 hand-off, S1 docs, the three corrected statements and N1. The dogfood battery on this head is still running locally, and its reading replaces the DOGFOOD_READING line when it lands. CI on this head: 38 success, 15 skipped, 0 failed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: f87435b23aa0967d68d93ecb38f1b9170a5c23e9
Local-runs: none
Scope: packages/plugins/plugin-auth/src/auth-manager-auth-instance.ts, packages/plugins/plugin-auth/src/auth-manager-before-hook.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.test.ts, packages/plugins/plugin-auth/src/auth-manager.test.ts + .changeset/sso-body-origins-trust-discovery-only.md, content/docs/permissions/sso.mdx

Read at 2026-11-15T20:11Z. Delta review of this head against FAIL 6899874194 at dc13f56; claim: comment 6900490763; taken on patrol as owed. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla.

Read, never reviewed (outside the diff): packages/plugins/plugin-auth/src/sso-sign-out-of-idp.ts, packages/plugins/plugin-auth/src/register-sso-provider.ts, and the published sources of better-auth and @better-auth/sso at the locked 1.7.12 (the request context's origin predicate and its pattern match, the hook pipeline). Nothing was built or run; every statement below is a reading of the tree at this head, of the three commits since dc13f564 (a9ed9977 pins, fb2572c8 fix, f87435b2 docs and changeset text), and of the full diff against the merge base d3bea96d.

① Derived judgments

The rule is unchanged: an origin a register or update body names is trusted only for the server-side discovery fetch and validation of that provider, and never as an accepted Origin for the request's own origin check, which reads the deployment's configured trusted origins alone.

Prior M1: closed. The sign-out-of-IdP capability check (assertSsoSignOutOfIdpSupported, auth-manager.ts) now builds its own predicate with trustingBodyNamedOrigins: the request's predicate, and beside it the origins ssoDiscoveryTrustedOrigins reads off that request's parsed body.

  • Both doors. The check is one function, called from the before-hook on /sso/register and on /sso/update-provider, and the hand-off is inside it, so it does not depend on the hook's return value (register) or on a hand-off the update block lacks. A register or an update from a configured origin that names the provider's issuer or endpoints and saves the switch on reads the same origins it read on main: the candidate set is the same (issuer and the five oidcConfig endpoints, public-routable hosts only), taken from the parsed body where main parsed the raw request, and a plain origin is matched by exact origin, which is how the vendor's predicate matches a non-wildcard entry. The undeclared 400 VALIDATION_FAILED narrowing of the last head is gone on both.
  • Bridge doors. /admin/sso/register, /admin/sso/update-provider and their siblings re-dispatch through the vendor handler and meet the same hook and the same function; nothing is bridge-specific. A body that names no issuer or endpoint (the Console's Edit Sign-In Options action) yields an empty list, the helper returns the request's predicate itself, and the check reads the configured list, as on main.
  • Scoped to that one check and that one request. The widened predicate is a closure made per call and passed to judgeSignOutOfIdpCapability alone. Nothing writes to ctx.context.trustedOrigins or to any shared list; the auth instance's trustedOrigins option is still the configured array in every arm; the register endpoint's per-endpoint context change is untouched by these commits; the after-hook that stores the logout endpoint takes the endpoint, not the predicate. I found no path from the body-named origins to the request-origin check, to a callback or redirect validation, or to another request.
  • Pins. sso-discovery-companion-origins.test.ts gains: a same-origin register with the switch on that saves and keeps the logout endpoint; the same on update, naming the issuer in the update body; a CONTROL that a logout endpoint on a host the body does not name is still refused 400 VALIDATION_FAILED on signOutOfIdp with no row written; a pin that the body-named origin with the switch on is still refused 403 INVALID_ORIGIN as the request's Origin on register and on update, rows unchanged; and a unit pin of the helper (exact origin; other port, other scheme, subdomain, non-http scheme and a non-URL refused; an empty list returns the caller's predicate). By reading, the two door pins are red on dc13f564 (the configured list alone does not hold the issuer's origin) and the CONTROL is green on both heads. The pins commit precedes the fix commit.
  • Declaration. The changeset's Unchanged paragraph is now scoped to a request from a configured origin and names the sign-out read on both doors; the header of sso-discovery-companion-origins.ts names the two readers and says the vendor's update endpoint itself reads none; the jsdoc on ssoDiscoveryTrustedOrigins and the comment in auth-manager-auth-instance.ts agree. Each of those statements holds against the code. No second narrowing remains to declare.

Prior S1: closed. content/docs/permissions/sso.mdx now says what each door does: a registration's discovery and endpoint checks read the named origin, and so does the logout-endpoint check when a registration or an update turns the switch on. That matches the tree; an update without the switch hands its named origins to nothing, and the sentence no longer says otherwise.

Prior N1: closed. The changeset subject reads fix(plugin-auth)!, as the PR title does.

New at this head.

S1 (should-fix) — new. The hand-off that closes prior M1 is wider than the one verdict prior M1 named: the body-named origins reach more of the capability check than its verdict on the logout endpoint, as they did on main. Narrow the hand-off to that verdict alone, with a pin per door; if narrowing moves any verdict against main, that is the lane's to measure and declare. This is not a regression against main and it does not touch the request-origin half, which is why it is not a must-fix; the review seat holds the detail.

S2 (should-fix) — new; continues the PR-body part of prior M1. The PR body was not brought to this head. Its "What changes" still says /sso/update-provider "needs no hand-off" and lists no change for the capability check or trustingBodyNamedOrigins; its test list omits the five new cases; the maintainer digest promises 18/18 for a file that now holds 23 cases; and every Verification reading names dc13f5644e, so no red-before-green or ablation reading is reported for the new pins and no package, typecheck or gate reading for this head. The two declaration lines are right. Editing the body does not move the head.

N1 (nit) — new. The CONTROL for a logout endpoint on a host the body does not name drives the register door only; the update door shares the function and the helper has its own unit pin, so the gap is coverage symmetry, not behaviour. In the same family: the jsdoc on ssoDiscoveryTrustedOrigins still calls its argument "the vendor endpoint's parsed /sso/register body" two paragraphs above the line that says an update body reaches it too.

No must-fix.

② Semver level

patch on @objectstack/plugin-auth, with Clause-②: no (narrowing) and Metadata-protocol: none on both the PR body and the changeset: the level AGENTS.md sets for a breaking change that moves no metadata protocol. The changeset keeps the BREAKING banner, exactly one ADR-0087 marker (not-required (no-migration-prescription); nothing stored changes shape, so the disposition fits), the from and to of the option (per-request function to the configured list), who moves, and the one-line remedy. With M1 closed the one narrowing it names is the only one in the tree, and its Unchanged paragraph is true as written.

CI at this head: 57 check-runs, all completed; 40 success, 17 skipped. Nothing is running, cancelled or red. This PASS is not rendered over running checks.

③ Boundary flags

  • The register hand-off still rides the vendor seam the companion origins use (a before-hook's context answer merged per dispatch). The new hand-off does not: it is a plain closure in the plugin's own check, so a vendor change to that merge cannot move it.
  • trustingBodyNamedOrigins matches by exact origin for http and https only. It is equivalent to the vendor's predicate for the plain origins ssoDiscoveryTrustedOrigins yields; it would not be for a wildcard entry, and that function never yields one.
  • Security discipline: this record stays at the rule layer.

④ Design judgment

Against the published surface on main: the declared narrowing still makes the spec's own refusal real. trustedOrigins is documented as the deployment's list, a request body adding to the list its own origin check reads was never a declared capability, and the only client that moves is the one the changeset names.

The last head reasoned about one of the two discovery readers on these doors and narrowed the other without saying so. This head gives the second reader the body-named origins directly, in the function that needs them, on both doors at once, and writes the two readers down in the module header, the jsdoc, the changeset and the docs. For a request from a configured origin the tree now answers as main did on every path I could find, and for a request from an unconfigured origin it refuses as declared. The design is sound for the rule it claims. S1 asks for the hand-off to be as narrow inside the check as it is outside it; S2 asks the PR body to describe the head it will land. Neither changes the verdict on the narrowing.

Implemented-by: claude/sso-body-origins-trust-discovery-only
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

…dy's origins for the logout endpoint only

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
…out check's logout-endpoint verdict only

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 7a02d75 · 2026-11-15T21:03Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f

Note for the delta on 7a02d7506a (claimed): the round-3 fix commit is pushed, and the implementer is still running gates and the dogfood battery on it. The PR body has not yet been brought to this head. The seat posts the replacement body, with this head's readings and the battery, as soon as that report lands. Until then, read the commits (18b8af0cea pins, 7a02d7506a narrowing) as the round-3 record.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 7a02d7506a7c9dca22176c14b3d370dacaf8c279
Local-runs: none
Scope: packages/plugins/plugin-auth/src/auth-manager-auth-instance.ts, packages/plugins/plugin-auth/src/auth-manager-before-hook.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.test.ts, packages/plugins/plugin-auth/src/sso-sign-out-of-idp.ts, packages/plugins/plugin-auth/src/auth-manager.test.ts + .changeset/sso-body-origins-trust-discovery-only.md, content/docs/permissions/sso.mdx

Read at 2026-11-15T21:10Z. Delta review of this head against PASS 6900594238 at f87435b; claim: comment 6901328026; taken on patrol as owed. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla.

Read, never reviewed (outside the diff): packages/plugins/plugin-auth/src/sso-sign-out-of-idp.test.ts, packages/plugins/plugin-auth/src/register-sso-provider.ts, and the published sources of better-auth and @better-auth/sso at the locked 1.7.12. Nothing was built or run; every statement below is a reading of the tree at this head, of the two commits since f87435b2 (18b8af0c pins, 7a02d750 fix with the docs and changeset text), of the full diff against the merge base d3bea96d, and of the PR body as it stands.

① Derived judgments

The rule is unchanged: an origin a register or update body names is trusted only for that provider's discovery and validation, and never as an accepted Origin for the request's own origin check, which reads the deployment's configured trusted origins alone.

Prior S1 (hand-off wider than the logout-endpoint verdict): closed in the tree.

  • Limited to the one verdict. judgeSignOutOfIdpCapability takes a second, optional predicate, isTrustedLogoutOrigin, and it has exactly one reader: the verdict on the provider's logout endpoint. assertSsoSignOutOfIdpSupported passes the request's own predicate as isTrustedOrigin and the widened one (trustingBodyNamedOrigins) as isTrustedLogoutOrigin only. Everything else in the check runs on the request's own predicate. No other caller passes the new input; absent, the verdict falls back to the request's predicate, so the function's other users answer as before.
  • Both doors, and the bridge doors. The check is still one function called from the before-hook on /sso/register and /sso/update-provider; the /admin/sso/* bridges re-dispatch into the same hook. Nothing is door-specific, so the limit holds on all of them. The request-origin half is untouched by these two commits.
  • It moves a verdict against main, as the last record said it might. On main the whole check held the body-named origins; at this head only the logout-endpoint verdict does. A registration or an update that turns the switch on for an OpenID Connect identity provider on a private network, whose origin the deployment does not list, saved on main and is refused 400 VALIDATION_FAILED on signOutOfIdp here. For a publicly reachable provider I found no moved verdict: the two door pins of the last round (a configured-origin register and update with the switch on save and keep the logout endpoint) are unchanged and still describe the tree.
  • Pinned per door. sso-discovery-companion-origins.test.ts gains four cases: the limit on register (refused, no row written); the limit on update (refused, row unchanged); a CONTROL that the same provider saves once the deployment lists its origin; and a CONTROL on update that a logout endpoint on a host the body does not name is refused. By reading, handing the widened predicate back to the whole check turns exactly the two limit pins red (each would save) and leaves every CONTROL green; the listed-origin CONTROL would go red if the limit refused more than it claims. The pins commit precedes the fix commit.
  • Declared in the changeset and the docs. The changeset has a second "Who moves" paragraph with the refusal, the reason and the remedy (list the provider's origin in trustedOrigins / OS_CORS_ORIGIN), and its Unchanged paragraph is re-scoped to a publicly reachable provider; both hold against the code. The module header, the two jsdocs and the interface comment say the same thing. sso.mdx states the limit.
  • Not declared in the PR body: M1 below.

Prior S2 (PR body not brought to the head): changed, and now M1. The body was brought to f87435b2 after the last record, which answered S2 as written. It was not brought to this head, and at this head the gap is no longer bookkeeping.

Prior N1: closed. The update door has its own CONTROL for a logout endpoint on a host the body does not name, and the jsdoc on ssoDiscoveryTrustedOrigins now says its argument is a register or an update body.

New at this head.

M1 (must-fix) — continues prior S2. The PR body contradicts the head on the narrowing this head adds. Its maintainer digest tells the maintainer that a request from the Console or a configured origin is unaffected, "including a register or update that turns the logout switch on"; at this head that is false for the second mover the changeset names. Its "What changes" still describes the wider hand-off of f87435b2, the one these two commits removed, and names no second mover, no refusal and no remedy. Its test list omits the four new cases; the digest promises 23/23 for a file that now holds 27; every Verification reading names f87435b23a, so there is no red-before-green or ablation reading for the two limit pins and no package reading for this head; and the GATES_READING and DOGFOOD_READING placeholders are still unfilled. A BREAKING narrowing is declared on the body and the changeset; here the two disagree about who moves. Editing the body does not move the head.

S1 (should-fix) — new. The docs page does not carry the second mover to the reader. sso.mdx states the limit in a parenthesis, but not who is refused or what to set, and the changeset calls the remedy "the documented setting for an internal identity provider" while no page under content/docs (outside the release notes) documents such a setting. One sentence in sso.mdx naming the refusal and the remedy makes the changeset's claim true.

N1 (nit) — new. Test names lag the rule: the unit case for trustingBodyNamedOrigins and the two saving pins of the last round are still titled for the wider hand-off, which is now the opposite of what the file pins. In the same family, sso-sign-out-of-idp.test.ts has no function-level case for the new input (present, and absent with its fallback); the door pins cover it.

N2 (nit) — new. The four new cases install a double for the runner's environment; the older switch-on cases in the same describe do not and now lean on that environment where at f87435b2 they did not. Giving them the same double keeps the file hermetic.

② Semver level

patch on @objectstack/plugin-auth, with Clause-②: no (narrowing) and Metadata-protocol: none on both the PR body and the changeset: the level AGENTS.md sets for a breaking change that moves no metadata protocol. The changeset keeps the BREAKING banner and exactly one ADR-0087 marker (not-required (no-migration-prescription); nothing stored changes shape, so the disposition still fits with the second mover), names both movers, and gives each its one-line remedy. The second mover's paragraph states where the request lands and the remedy; that it saved before is implied by "Who moves, too" and not written out, which I do not grade.

CI at this head: 53 check-runs; 37 success, 15 skipped, 1 in progress (the Test Core aggregate; its eight shards have all completed with success). Nothing is red or cancelled. The verdict below does not depend on the running check.

③ Boundary flags

  • The limit lives in the plugin's own function, as a second input with a single reader. It rides no vendor seam, so a vendor change cannot widen it.
  • isTrustedLogoutOrigin is optional and falls back to the request's predicate. A future caller that forgets it gets the stricter answer, never the wider one.
  • The register endpoint's own per-endpoint hand-off is unchanged by these commits and is not re-reviewed here.
  • Security discipline: this record stays at the rule layer.

④ Design judgment

Against the published surface on main: the first narrowing still makes the spec's own refusal real, as recorded before. The second is of the same kind. That a request body could widen what the deployment trusts beyond the one verdict about the provider it names was never a declared capability; the configured list is the declared way to trust a provider the platform cannot judge on its own, and the refusal a moved client meets names that remedy. Taking the wider trust away removes nothing a consumer was promised, and the provider that moves has a one-setting fix.

The code agrees with the contract it implements: one extra input, one reader, both doors through one function, pins that go red on the ablation and CONTROLs that would catch an over-tight limit. The tree, the changeset and the code comments tell one story. The PR body tells the story of the last head, and on a BREAKING change the body's risk line is what the maintainer reads before landing, so it has to name the second mover. That is the whole of M1; nothing in the tree needs to move for it.

Implemented-by: claude/sso-body-origins-trust-discovery-only
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: FAIL

…ases hermetic, pin the logout predicate input; name the remedy in docs

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 027821d · 2026-11-15T22:01Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 027821da02010557112814611d6a606be85f178d
Local-runs: none
Scope: packages/plugins/plugin-auth/src/auth-manager-auth-instance.ts, packages/plugins/plugin-auth/src/auth-manager-before-hook.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.test.ts, packages/plugins/plugin-auth/src/sso-sign-out-of-idp.ts, packages/plugins/plugin-auth/src/sso-sign-out-of-idp.test.ts, packages/plugins/plugin-auth/src/auth-manager.test.ts + .changeset/sso-body-origins-trust-discovery-only.md, content/docs/permissions/sso.mdx

Read at 2026-11-15T22:06Z. Delta review of this head against FAIL 6901428226 at 7a02d75; claim: comment 6902072922; taken on patrol as owed. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla.

Read, never reviewed (outside the diff): packages/cli/src/commands/serve.ts (where OS_TRUSTED_ORIGINS is read), content/docs/deployment/environment-variables.mdx, and the CI logs of Test Core (7/8) at 18b8af0c and at this head. Nothing was built or run; every statement below is a reading of the tree at this head, of the one commit since 7a02d750 (027821da: tests, docs and changeset text only; no source file under src outside the tests moves), of the full diff against the merge base d3bea96d, and of the live PR body.

① Derived judgments

The rule is unchanged: an origin a register or update body names is trusted only for that provider's discovery and validation, and never as an accepted Origin for the request's own origin check. Within the sign-out capability check the body-named origins reach the verdict on the provider's logout endpoint only. This round moves no behaviour; it answers the four findings of the last record. Each by id:

Prior M1 (PR body contradicts the changeset on the second mover; stale readings; placeholders): changed. The must-fix part is closed; one residue remains, as S1 below.

  • The contradiction is gone. The maintainer digest now names two narrowings, both BREAKING: the request-origin refusal (403 INVALID_ORIGIN), and the switch-on refusal for an OpenID Connect identity provider on a private network whose origin the deployment does not list (400 VALIDATION_FAILED on signOutOfIdp, saved on main, refused here even from the Console), with the remedy. The sentence that said a configured-origin request with the switch on was unaffected is removed. "What changes" describes the hand-off as this head has it (the logout-endpoint verdict alone, through a separate input) and carries a bullet for the second narrowing that points at the changeset's "Who moves, too". Mover, refusal and remedy agree between body, changeset, docs page and code.
  • The test list matches the files: the four cases added at 18b8af0c, the hermetic set-up, the retitled unit case, and the new function-level case are all listed. The digest's count (27 in sso-discovery-companion-origins.test.ts) is the count at this head; sso-sign-out-of-idp.test.ts holds 15.
  • Verification names this head, and says honestly that source is unchanged since 7a02d750. I checked what a reading can check: the ablation blob for auth-manager.ts (14c267f6a2ac) is that file's blob at this head; the package total (5543 passed, 10 skipped, 5553) agrees with CI's Test Core (7/8) at this head (5542 passed, 11 skipped, 5553); and the red-before-green reading quoted from CI at 18b8af0c is what that job's log says (3 failed, 5538 passed, the two limit pins and the update-door CONTROL).
  • Residue: S1.

Prior S1 (docs do not name who is refused or the remedy; the changeset's "documented setting" documented nowhere): closed. sso.mdx now says that turning the switch on for an OpenID Connect identity provider on an internal or private network is refused 400 VALIDATION_FAILED on signOutOfIdp until the provider's origin is listed in OS_TRUSTED_ORIGINS. The changeset drops the unsupported phrase and points at that page instead. The setting is real: the CLI passes OS_TRUSTED_ORIGINS to the auth plugin as its trustedOrigins, and the variable has its own row in the environment-variables reference. Both movers' remedies in the changeset now name it.

Prior N1 (titles lag the rule; no function-level case for the new input): closed. The unit case for trustingBodyNamedOrigins and the two saving pins are retitled for the logout-endpoint verdict. sso-sign-out-of-idp.test.ts gains one case with both halves: with isTrustedLogoutOrigin given, a logout endpoint only that predicate trusts is accepted while the rest of the check is handed isTrustedOrigin; with it absent, the same endpoint is refused on signOutOfIdp. By reading it goes red on each of three ablations: the verdict ignoring the new input, the new predicate handed to the whole check, and the fallback removed.

Prior N2 (older switch-on cases not hermetic): closed. One helper, stubIdp, installs the identity provider's whole environment, and every switch-on case in the describe uses it; the three limit cases pass the host they make private. The helper is the former double with the host made optional, restored through the describe's existing afterEach.

New defects from 027821da: none found. No test is weaker: the retitles change names only; the older switch-on cases assert what they asserted, now under a fixed environment; the two limit pins and their CONTROLs are byte-for-byte the same assertions under the merged helper. The limit pins still go red on the ablation by reading (the widened predicate handed back to the whole check: both would answer 200), and the listed-origin CONTROL still catches a limit that refuses more than it claims.

S1 (should-fix) — continues prior M1, its residue. The PR body still carries the literal GATES_READING placeholder under "Derived gates", and its "Dogfood battery" section is a pending line that says the seat will replace it. Neither misstates the change, and the head's CI is green, so I do not hold the verdict for them; a BREAKING change should not land with an unfilled reading in its body. Fill both, or strike the sections and say why.

N1 (nit) — new. Two wording leftovers in the PR body's "What changes". The second-narrowing bullet spells the remedy as trustedOrigins, OS_CORS_ORIGIN, while the digest, the changeset and sso.mdx now spell it OS_TRUSTED_ORIGINS; both settings reach the configured list in the code, so nothing is false, but one spelling is better. And the bullet that introduces the two readers of the body-named set still calls both of them reads of the provider's discovery, where the second is the logout-endpoint verdict, as its own sub-bullet says.

N2 (nit) — new. The remedy lists the identity provider's origin in the deployment's trusted origins, which is also the list the request's own origin check reads. sso.mdx could say so in a clause, so an operator knows what the setting covers.

No must-fix.

② Semver level

patch on @objectstack/plugin-auth, with Clause-②: no (narrowing) and Metadata-protocol: none on both the PR body and the changeset: the level AGENTS.md sets for a breaking change that moves no metadata protocol. The changeset keeps the BREAKING banner and exactly one ADR-0087 marker (not-required (no-migration-prescription)), names both movers, and gives each a remedy that the code and the docs bear out. The body and the changeset now declare the same two movers.

CI at this head: 57 check-runs; 40 success, 17 skipped, none failed, cancelled or running (Check Changeset re-ran after the body edit and is green). The verdict does not wait on any check.

③ Boundary flags

  • This commit changes no source outside tests; the boundary notes of the last record stand: the limit lives in the plugin's own function as a second input with one reader, and the input is optional with the stricter answer as its fallback.
  • The remedy text now names one environment variable across changeset and docs. OS_CORS_ORIGIN still feeds the same configured list in the auth instance; the changeset no longer offers it as the remedy, which is the narrower advice.
  • The register endpoint's own per-endpoint hand-off is unchanged by this commit and is not re-reviewed here.
  • Security discipline: this record stays at the rule layer.

④ Design judgment

Against the published surface on main, the judgment of the last record holds and nothing in this commit touches it: both narrowings make the spec's own refusal real and take away no declared capability. That a request body could widen what the deployment trusts beyond the one verdict about the provider it names was never promised; the configured list is the declared way to trust a provider the platform cannot judge on its own, and the docs page now tells the moved operator exactly that, with the refusal they will see and the setting that lifts it.

Each implementing file agrees with the contract it implements. sso-sign-out-of-idp.test.ts pins the function's new input at the function, in both directions. sso-discovery-companion-origins.test.ts pins the rule per door under an environment it owns. The changeset and sso.mdx agree with each other and with the code on who moves, what they meet and what to set. The PR body, which was the whole of the last FAIL, now tells the same story as the tree. What is left is evidence bookkeeping (S1) and wording (N1, N2).

Implemented-by: claude/sso-body-origins-trust-discovery-only
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f

席位核对

ACCEPT at Head-sha: 027821da02010557112814611d6a606be85f178d (2026-11-15T22:18Z).

  • Shape:
    • No-card order from the security#1 seat.
    • 8 source and test files plus docs and changeset, +430 / −76. Not governed.
    • Clause-②: no (narrowing), BREAKING with two declared movers, patch on @objectstack/plugin-auth, ADR-0087 marker not-required (no-migration-prescription), Metadata-protocol: none.
  • Rule: an origin a register or update body names is trusted only for that provider's discovery and validation, and never as an accepted Origin for the request's own origin check. Within the sign-out capability check, the body-named origins reach only the logout-endpoint verdict.
  • Gates:
    • CI on this head: 38 success, 15 skipped, 0 failed.
    • Locally: plugin-auth Tests 5543 passed | 10 skipped, and typecheck OK. 102 of 105 derived families exited 0; the 3 NOT MEASURED (exit 3, prerequisite) are covered by CI's Type Check · debt ledger and Lint & Repo Gates, both green.
    • Ablations were red and restored at each round.
    • Dogfood battery on this head: Tests 3962 passed | 42 skipped (4004), no failures.
  • Review: review#2 at CONTRACT_REVIEW_TIER. It took four records on four heads; the first and third failed:
    • FAIL 6899874194 (M1, the second discovery reader);
    • PASS 6900594238;
    • FAIL 6901428226 (M1, the PR body against the head);
    • PASS 6902182542 on this head, with no must-fix.
    • Its S1 (unfilled readings in the body) was already answered by the body posted at 22:08Z, and both readings are present.
    • Its N1 wording was fixed in the body: one remedy spelling, and the two readers named as what they are.
  • Accepted deviations: N2 (the docs could say the trusted-origins list is also the one the request's own origin check reads) is left as a docs nit.
  • Landing: through the merge queue, by the seat.

Implemented-by: os-dev (security#1 order, session_017xRBcT1w3zpekijraHJE4f) · Reviewed-by: review#2 (session_01L9qibxTeW8xHnxoHxWNHWW).

@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 22:20
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 6feea4e Nov 15, 2026
68 of 69 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/sso-body-origins-trust-discovery-only branch November 15, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants