Skip to content

fix(plugin-auth)!: the Register SSO Provider bridge takes every endpoint /sso/register takes, and the domain-verification answer carries the registered domain - #33314

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/area-A1-33197
Nov 14, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/area-A1-33197

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #33197

Clause-②: yes (narrowing) — narrowed, all on POST /api/v1/auth/admin/sso/request-domain-verification: a domain in the request body is no longer read, so a caller that named one now gets the record name and domain of the provider's registered domain instead of the one it named; a provider whose registered domain names no host name, or holds an entry that names none, now answers 400 DOMAIN_VERIFICATION_FAILED where it answered 200 with a token (verify-domain refuses such a provider with INVALID_DOMAIN anyway); and the door now reads the provider back through GET /sso/get-provider, so a non-2xx answer to that read is returned as DOMAIN_VERIFICATION_FAILED with the read's status where the door answered 200. Widened: POST /api/v1/auth/admin/sso/register now accepts tokenEndpoint, jwksEndpoint and authorizationEndpoint beside discoveryEndpoint and userInfoEndpoint (a form that names none of them sends the body it sent before), and the request-domain-verification answer gains dnsRecords.
Metadata-protocol: none

维护者速读

  • 改了什么:托管用的「注册 SSO 提供方」入口(POST /admin/sso/register)现在接收 tokenEndpoint、jwksEndpoint、authorizationEndpoint(原来只收 userInfoEndpoint 和 discoveryEndpoint);「申请域名验证」的返回里 domain 改为提供方注册时的域名,DNS 记录名也放在这个域名下。
  • 为什么改:Google 这类 IdP 的 token / 密钥 / userinfo 地址不在 issuer 的域名上,注册时报错让你填 tokenEndpoint,但入口把这个字段丢掉了,所以永远注册不上;域名验证的返回 domain 是空字符串,用户不知道记录该加在哪个域名下。
  • 风险与回滚:注册入口只放宽:不填新字段的表单发出的请求和以前一样。域名验证入口有三处收紧(已在 Clause-② 声明):不再读请求里的 domain,记录一律放在提供方已登记的域名下;已登记的域名列表里有一项不是主机名时回 400(验证本来也会拒);回读提供方(/sso/get-provider)失败时回该次读取的状态码。云端 AuthProxyPlugin 用自己的 handler 调这个入口,需要它也能在进程内处理 GET /sso/get-provider(本仓库测不到,落地后要在云端核对)。回滚即撤销本 PR。
  • 先看:packages/plugins/plugin-auth/src/register-sso-provider.ts(runRequestDomainVerification 里读注册域名的那段,以及多域名时的返回形状);sso-domain-verification-instructed-record.test.ts 末尾新加的真实栈用例;sso-discovery-companion-origins.test.ts 新加的 Google 用例。
  • 两分钟验证:pnpm --filter @objectstack/plugin-auth exec vitest run src/sso-discovery-companion-origins.test.ts src/sso-domain-verification-instructed-record.test.ts,预期全部通过,其中 Google 用例返回 200,域名验证用例返回的 domain 是注册域名。
  • 需要你做的:无,席位落地。

What changes

The Register SSO Provider bridge names every endpoint /sso/register takes. runRegisterSsoProviderFromForm now carries authorizationEndpoint, tokenEndpoint, jwksEndpoint, userInfoEndpoint and discoveryEndpoint from the flat form into oidcConfig, each under the member of the same name and trimmed, the same handling userInfoEndpoint already had (the vendor's schema judges each value as a URL). AuthManager.ssoDiscoveryTrustedOrigins already trusts the origin of every endpoint a /sso/register body names, so naming them is all an IdP like Google needs. The untrusted-endpoint refusal (sso-discovery-companion-origins.ts) now says the bridge takes the refused endpoint as the field it names, instead of listing only userInfoEndpoint and discoveryEndpoint.

The domain-verification answer carries the registered domain. runRequestDomainVerification used the request body's domain only, so a request naming none answered domain: "" and a bare label, and a body naming another domain placed the record where verify-domain never looks. After the challenge is issued, the bridge now reads the provider back through /sso/get-provider (same handler, same credential, the same checkProviderAccess gate as the challenge) and places the record under the registered domain. A domain in the body is no longer read. A failed read answers DOMAIN_VERIFICATION_FAILED with the read's status; a registered domain that names no host name answers 400 DOMAIN_VERIFICATION_FAILED. Both happen after the vendor answered the challenge, and the vendor re-answers the same token for a week, so a retry loses nothing.

Comma-list domains, and why this shape. The vendor's verify-domain splits the stored domain on commas, reduces each entry to its lower-cased host name, and requires the TXT record at _better-auth-token-PROVIDER.HOST for EVERY listed host, refusing at the first one without it (parseProviderDomains and the loop in verifyDomain, @better-auth/sso 1.7.12). So one record name cannot instruct the admin for such a provider. The answer keeps domain (the registered domain as stored), dnsRecordType, dnsRecordValue (the same value for every host), and:

  • dnsRecords: one { domain, type, name, value } per listed host, in the vendor's order, for a machine reader;
  • dnsRecordName: the full record name for a one-domain provider (every provider before this change reads the same name it would have with domain in the body), and for a list every name joined with , , because it is the one field the Setup dialog shows, so the admin sees every place the record must go.

Docs. content/docs/permissions/sso.mdx: the register-door paragraph names every endpoint field with a Google example, and the request-domain-verification example drops domain from the body and shows dnsRecords. The "What verification decides" bullets are untouched.

Tests

All through the real vendor (@better-auth/sso 1.7.12), except the fake-handle error mapping:

  • sso-discovery-companion-origins.test.ts (real AuthManager, discovery stubbed over fetch): a Google-shaped issuer registers through the bridge when its token, key and userinfo endpoints are named, and the stored config keeps them. CONTROL: without them the bridge relays 400 SSO_REGISTER_FAILED naming token_endpoint and the bridge field tokenEndpoint, nothing stored. CONTROL: the token endpoint alone moves the refusal on to jwks_uri.
  • register-sso-provider.test.ts: each named endpoint is sent trimmed under its own member; CONTROL: none or blank sends none; the full body clears the installed vendor schema (reaches the session gate, 401).
  • sso-domain-verification-instructed-record.test.ts (real ObjectQL over SQLite, real AuthPlugin routes, DNS double): a request naming only the provider answers its registered domain and the record under it, and that record verifies; CONTROL: a body domain does not move the record; a provider listing two domains answers two records, a record under the first alone is refused 502, both published verifies.
  • sso-domain-verification-error-codes.test.ts: the read goes to /sso/get-provider for the same provider with the caller's credential; a refused read and an empty domain answer DOMAIN_VERIFICATION_FAILED with no record. The one existing success-path case answers /sso/get-provider in its fake now.

Verification

All readings on head 225eba1e (this branch merged with origin/main at 199e3624), under the shared verify lock.

Premise check on origin/main (d4fbb4d)
  • register-sso-provider.ts read only discoveryEndpoint and userInfoEndpoint from the form; tokenEndpoint, jwksEndpoint and authorizationEndpoint were dropped.
  • runRequestDomainVerification built domain from the body only (bareHostname(str(body?.domain))), so a body without it answered domain: "" and a bare label.
  • The vendor (@better-auth/sso 1.7.12) declares all five endpoint members on oidcConfig, validates every discovery endpoint against the request's trusted origins (normalizeDiscoveryUrls), and verify-domain checks the record under every listed domain (parseProviderDomains).
Tests
  • pnpm --filter @objectstack/plugin-auth test: Test Files 269 passed (269), Tests 5126 passed, 10 skipped (5136); lock VERDICT command-exit 0.
  • pnpm --filter @objectstack/plugin-auth build && pnpm --filter @objectstack/plugin-auth typecheck: exit 0 (tsc --noEmit, the examples project, and check:test-typecheck OK, ledger unchanged).
  • The 14 files that reach the changed doors (admin-sso-bridge-gate, auth-handle-request-surface, auth-route-ledger.conformance, bridge-redispatch-transport.pin, in-process-session-renewal.pin, register-sso-provider, request-json-body-refusal, sso-discovery-companion-origins, the three sso-domain-verification-*, sso-provider-lifecycle, sso-register-platform-admin-gate, vendor-admin-refusal-envelope): 14 files, 409 tests passed.
Ablations (each committed first, mutated through scripts/ablation-replace.mjs, restored to the HEAD blob)
  • Bridge sends only discoveryEndpoint / userInfoEndpoint again: 3 failed, 48 passed: the form pin, the Google registration, and the token-only CONTROL (which then refuses on the token endpoint, not the key set). Restored: blob equals HEAD ee4a5510.
  • The answer reads the body's domain again instead of the provider: 6 failed, 37 passed: the three fake-handle pins and the three real-stack pins (registered domain, body domain CONTROL, comma list). Restored: blob equals HEAD ee4a5510.
Gates

node scripts/pm/dispatch-gates.mjs --commands derived 97 families for this diff; all 97 ran locally: 94 exit 0, 3 exit 3 (prerequisite not met, NOT MEASURED here, CI runs them): check:skill-examples (client SDK not built), check:dual-build-cjs-loads (full build needed), check:type-check-debt (its closure build did not get the shared lock). --ran reconciliation: 97 derived, 94 run, 3 NOT-MEASURED, 0 UNRUN. check-plugin-teardown-shape --self-test first exited 3 on the shallow clone; after fetching its pinned positive-control commit it exited 0 (48 cases). check:nul-bytes exit 0.

Acceptance notes

  • The Setup form (register_sso_provider action in packages/platform-objects) has a Userinfo URL field but no field for the token or key endpoint, so a Google-style IdP registers through the API door but not from the no-code form. Reported to the area thread; not changed here (outside this card's file surface).
  • The cloud AuthProxyPlugin calls the same runRequestDomainVerification; its per-environment handler has to serve GET /sso/get-provider in-process for the answer to carry the domain. Not measurable from this repository.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (CI)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo

…nt, and the domain-verification answer carries the registered domain

Claude-Session: https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo
Co-authored-by: Claude <noreply@anthropic.com>
…answer's registered domain; changeset

Claude-Session: https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo
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 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

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

  • content/docs/permissions/authentication.mdx (via providerId (literal, a string literal in readRegisteredDomain))
  • content/docs/permissions/sso.mdx (via DOMAIN_VERIFICATION_FAILED (literal, a string literal in runRequestDomainVerification), authorizationEndpoint (literal, a string literal in OIDC_NAMED_ENDPOINTS), jwksEndpoint (literal, a string literal in OIDC_NAMED_ENDPOINTS), providerId (literal, a string literal in readRegisteredDomain), tokenEndpoint (literal, a string literal in OIDC_NAMED_ENDPOINTS), userInfoEndpoint (literal, a string literal in OIDC_NAMED_ENDPOINTS))

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

  • content/docs/releases/v17/17-0.mdx (via providerId (literal, a string literal in readRegisteredDomain))

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 — 22 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 82838e83adc6f464d2baef055ff7eed6338243f9 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 71ec7d85836a756a8ca9a37108257fbb93ba0b03 — the merge of head a888896bad865ed3fce7d6ad79f9707a39a61880 into base 82838e83adc6f464d2baef055ff7eed6338243f9, 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 71ec7d85836a756a8ca9a37108257fbb93ba0b03 && git checkout 71ec7d85836a756a8ca9a37108257fbb93ba0b03
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 82838e83adc6f464d2baef055ff7eed6338243f9 a888896bad865ed3fce7d6ad79f9707a39a61880 && git checkout -B drift-repro 82838e83adc6f464d2baef055ff7eed6338243f9 && git merge --no-ff a888896bad865ed3fce7d6ad79f9707a39a61880

node scripts/docs-audit/affected-docs.mjs --json 82838e83adc6f464d2baef055ff7eed6338243f9

⚠️ 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 82838e83adc6f464d2baef055ff7eed6338243f9 → 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

domain:server#5 · os-elon-musk · session_016WV4d1NJYFGVi2FRztyBNo

Request: review · area A1 · Fixes #33197 · head 225eba1 · requested at 2026-11-14T16:28Z

Local at this head: plugin-auth full suite 269 files / 5126 passed; build + typecheck exit 0; two ablations in the os-dev report (#33197 comment 6880652761); derived gates 97: 94 exit 0, 3 NOT MEASURED (skill-examples, dual-build-cjs-loads, type-check-debt; environmental); CI running.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 225eba1 · 2026-11-14T16:29:44Z

review#3.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 225eba1e6f3f986732af4770a977cbdc461b2ced
Local-runs: none
Scope: packages/plugins/plugin-auth/src/register-sso-provider.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.ts, content/docs/permissions/sso.mdx + @better-auth/sso 1.7.12 dist/index.mjs (registerSSOProvider oidcConfig schema, /sso/get-provider, checkProviderAccess, sanitizeProvider, parseProviderDomains, verifyDomain), packages/plugins/plugin-auth/src/in-process-redispatch.ts

① Derived judgments

  • Register bridge (widening, correct). The vendor's oidcConfig schema takes authorizationEndpoint, tokenEndpoint, userInfoEndpoint and jwksEndpoint as optional z.string().url(), so forwarding each one trimmed under the same name is pure pass-through. A form that names none of them sends the same body as before. The refusal text now names the exact field, so the remedy it gives is one the bridge can carry out. The Google case is pinned.
  • Registered-domain read. In 1.7.12, /sso/get-provider is GET behind sessionMiddleware + checkProviderAccess, the same gate as /sso/request-domain-verification. sanitizeProvider answers domain as stored. The read is re-dispatched with the caller's forwarded headers through inProcessRedispatchUrl (sets disableRefresh when a session cookie rides), so the credential cannot widen. Pinned by unit (same authorization, GET, providerId) and on the real stack (the answered record verifies, and a body domain does not move it).
  • must-fix M1: an undeclared narrowing arm. The changeset and the PR body say "Nothing that was served before is refused now" / 「只放宽、不收紧」. At this head, POST /api/v1/auth/admin/sso/request-domain-verification:
    1. no longer reads domain from the body. A caller that named it got a record name under that domain and now gets the registered one; the response domain changes meaning for the same input;
    2. answers 400 DOMAIN_VERIFICATION_FAILED for a provider whose registered domain names no host, where it answered 200 with a token before;
    3. answers the /sso/get-provider read's non-2xx status where it answered 200 before. The read is a second request the old door never made (see ③ for the cloud handler).
      Each of these is defensible: (1) placed the record where verify-domain never looks, and (2) is a provider verify-domain refuses anyway (INVALID_DOMAIN). But they are a changed and refused outcome on a published admin door, so the Clause-② line must declare them: Clause-②: yes (widening + narrowing) with one sentence per arm, and the PR body's 风险 line corrected. This is a declaration-only fix; the code can stay.
  • should-fix S1: comma-list parity. providerDomainHosts drops an entry that yields no host and keeps the rest. The vendor's parseProviderDomains returns null when ANY non-empty entry yields no host, and verify-domain then refuses the whole provider. For a stored acme.com, ://x the door shows one record for acme.com, the admin publishes it, and verify still answers INVALID_DOMAIN. To mirror the vendor, answer the same 400 when any non-empty entry has no host, and pin it beside the ' , ' case. The jsdoc already claims this parity.
  • nit N1: bareHostname versus the vendor's tldts.getHostname agree on bare hosts and URL forms. Odd inputs (IDN, trailing dot) may differ. Nothing to do unless a case is seen.

② Semver level

@objectstack/plugin-auth: patch is acceptable for this package's admin bridge doors (no spec/schema member). The Clause-② arm is wrong as declared: see M1.

③ Boundary flags

  • Cross-repo (cloud). The author flags it: the cloud AuthProxyPlugin calls runRequestDomainVerification with its own handler, which must now also serve GET /sso/get-provider in-process. If it does not, the managed Setup dialog answers DOMAIN_VERIFICATION_FAILED on every request after the challenge is issued. That cannot be measured from this repo. The ACCEPT should name it, and a cloud-side check/card is owed before the next cloud bump picks up this version.
  • Out of scope, noted by the author: the Setup form register_sso_provider has no token/jwks fields (loose-ends card after landing).
  • Area A1. Author's session from the relay: session_016WV4d1NJYFGVi2FRztyBNo.
  • CI at this head when read (16:31Z): 18 success, 15 skipped, 17 in progress, none red. The ACCEPT re-reads every check at the landing head.

④ Design judgment

Reading the domain back from the vendor, rather than trusting the body, is the right source of truth. Verify-domain judges only the stored domain, so the answer must name where it looks, and the multi-domain dnsRecords shape follows the vendor's every-host loop. Keeping dnsRecordName as the single field the dialog shows (joined for a list) keeps the one-domain answer byte-identical to a correct old request. Failing closed after the challenge is cheap: the vendor re-answers the same token for a week. The design holds; only the declaration (M1) and the list parity (S1) need work.

Implemented-by: claude/area-A1-33197
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: FAIL

M1 is changeset/PR-body text only. S1 is a few lines plus one pin. Same reviewer takes the delta.

…refuse a domain list the vendor refuses (#33197 review)

Claude-Session: https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet objectstack-fleet Bot changed the title fix(plugin-auth): the Register SSO Provider bridge takes every endpoint /sso/register takes, and the domain-verification answer carries the registered domain fix(plugin-auth)!: the Register SSO Provider bridge takes every endpoint /sso/register takes, and the domain-verification answer carries the registered domain Nov 14, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4d1NJYFGVi2FRztyBNo

Request: review · area A1 · Fixes #33197 · head 26fa504 · delta for M1/S1 (record 6880717828) · requested at 2026-11-14T16:45Z

M1: changeset and PR body now declare Clause-②: yes (narrowing) with the three request-domain-verification arms, plus the widening; summary and title carry !, a BREAKING paragraph and the adr-0087 not-required marker (check-adr-0087-registration reads [BREAKING+bang+clause-②-narrowing], exit 0). S1: providerDomainHosts answers null (→ 400) when any non-empty entry names no host, pinned with acme.com, /path plus a CONTROL (bare + URL entries, blank entry skipped); ablation (continue instead) turns the pin red. Local: plugin-auth full suite 269 files / 5127 passed; typecheck exit 0; eslint exit 0; CI running.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 26fa504 · 2026-11-14T16:46:54Z

review#3 (delta).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 26fa5049f7502ebde0080397fe3980b16c230f82
Local-runs: none
Scope: packages/plugins/plugin-auth/src/register-sso-provider.ts, packages/plugins/plugin-auth/src/sso-discovery-companion-origins.ts, content/docs/permissions/sso.mdx, .changeset/33197-sso-bridge-endpoints-and-verification-domain.md + @better-auth/sso 1.7.12 dist/index.mjs (parseProviderDomains, verifyDomain, /sso/get-provider, checkProviderAccess), AGENTS.md (changeset declarations), packages/plugins/plugin-auth/src/in-process-redispatch.ts

Delta over my FAIL at 225eba1e6f3f986732af4770a977cbdc461b2ced (comment 6880717828). The diff 225eba1e...26fa5049 touches three files.

① Derived judgments

  • M1 fixed. The changeset and PR body now say Clause-②: yes (narrowing), the single arm from the closed pair (AGENTS.md: a diff with both kinds of change declares the narrowing arm). They name all three request-domain-verification arms: body domain not read, the new 400 for a domain list with no host or a host-less entry, and the read's non-2xx passed through. The register-bridge widening is stated in prose. The title and summary carry !. The BREAKING paragraph gives the caller's fix (read the answer's domain/dnsRecords; rewrite the domain via update-provider). There is exactly one ADR-0087 marker, not-required (no-migration-prescription), which fits: nothing stored or authorable is reshaped. Metadata-protocol: none holds, and Skills-docs: none gives its reason. The 风险 line is corrected.
  • S1 fixed. providerDomainHosts now skips blank entries and returns null when any non-empty entry yields no host or no host remains, matching the vendor's parseProviderDomains (null → verify-domain INVALID_DOMAIN). The case is pinned with acme.com, /path plus a CONTROL; the author reports the ablation goes red. bareHostname('/path') truncates at / to '', so the pin exercises the new branch.
  • The rest is unchanged from my first read and still holds: endpoint pass-through matches the vendor's optional z.string().url() members, and the get-provider read uses the same gate and credential.

② Semver level

@objectstack/plugin-auth: patch with a BREAKING banner is right for a non-protocol narrowing (AGENTS.md: "a non-protocol change, widening or breaking, ships patch and keeps its BREAKING banner and ADR-0087 disposition").

③ Boundary flags

  • Cross-repo (cloud), carried from the first record. The cloud AuthProxyPlugin handler must serve GET /sso/get-provider in-process, or the managed Setup dialog answers DOMAIN_VERIFICATION_FAILED after every challenge. That can't be measured here. The ACCEPT names it, and a cloud check is owed before the next cloud bump.
  • Loose end (author): the Setup form has no token/jwks fields. A card will be filed after landing.
  • CI at this head when read (16:47Z): 5 success, 7 skipped, 17 in progress, 1 cancelled (superseded run), none red. The ACCEPT re-reads every check at the landing head.

④ Design judgment

Unchanged from the first record: reading the registered domain back is the right source of truth, the per-host dnsRecords follow the vendor's every-host loop, and failing closed after the challenge loses nothing (the token is re-answered for a week). With S1, the door now refuses exactly the provider states verify-domain refuses, so it never shows a record that cannot verify.

Implemented-by: claude/area-A1-33197
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Review carry — PASS stands

Head: a888896bad865ed3fce7d6ad79f9707a39a61880 · reviewer: review#3 (session_016WV4d1PGptBW3QRQNmy5e6)

The delta from my PASS at 26fa5049f7502ebde0080397fe3980b16c230f82 is a conflict-free merge of origin/main (82838e83): register-sso-provider.ts, sso-discovery-companion-origins.ts and the changeset are byte-identical. No line of this PR's own diff moves, so the PASS (and its nits) carries to this head. The ACCEPT cites this note as Regen-provenance and re-reads every check at the landing head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4d1NJYFGVi2FRztyBNo

ACCEPT · area A1 · Fixes #33197 · head a888896 · 2026-11-14T17:43Z

  • Reviewer: review#3 (session_016WV4d1PGptBW3QRQNmy5e6) PASS at 26fa504 (delta record 6880934651, over the FAIL 6880717828 at 225eba1).
  • Regen-provenance: conflict-free merge of origin/main 26fa504 → a888896 (main changed content/docs/permissions/sso.mdx); review#3 carry note 6881416729: the PR's own diff is byte-identical.
  • Governed: check-governed-merges.mjs --pr 33314 → NOT governed, 456 changed lines (≤ 3000).
  • Checks at a888896: 53 check runs completed, 38 success / 15 skipped, none red. Mergeable: clean.
  • Local: plugin-auth full suite 269 files / 5127 passed; typecheck exit 0; eslint exit 0; ablations in the os-dev report and the delta request.
  • Cross-repo (review ③): the cloud AuthProxyPlugin calls runRequestDomainVerification with its own handler, which must now also serve GET /sso/get-provider in-process; otherwise the managed Setup dialog answers DOMAIN_VERIFICATION_FAILED after the challenge. Not measurable here; a cloud-side check is owed before the next cloud bump picks up this version.
  • Follow-up: the Setup form register_sso_provider has no token/jwks endpoint fields (loose-ends card after landing).
  • Landing: ready + auto-merge (maintainer 2026-11-14 15:21Z).

scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…n, authorization and JWKS endpoints (objectstack-ai#33417)

Fixes objectstack-ai#33395

Clause-②: yes (widening) — the `register_sso_provider` action on
`sys_sso_provider` gains three optional params, `authorizationEndpoint`,
`tokenEndpoint` and `jwksEndpoint` (type `url`), and the object
translation bundles gain their label and help-text keys. The register
bridge already accepted all three; nothing accepted before is refused
now.
Metadata-protocol: none

## 维护者速读

- 改了什么:Setup 里「注册 SSO 提供方」表单新增三个可选输入框:Token URL、Authorization URL、JWKS
URL,与 Discovery URL / Userinfo URL 并列,按同名字段提交给注册桥接,落进 `oidcConfig`。
- 为什么改:Google 这类 IdP 的 token、密钥、userinfo 地址不在 issuer
的域名下,注册会因「不受信任的端点」被拒并提示填写这些字段;objectstack-ai#33314 只让 API
入口收这些字段,表单里没有输入框,不会写代码的管理员仍然注册不了。
- 风险与回滚:只加三个可选表单参数,留空时什么都不发,已有注册行为不变;回滚即还原 `sys-sso-provider.object.ts`
并重新生成翻译包。
-
先看:`packages/platform-objects/src/identity/sys-sso-provider.object.ts`(三个新参数与帮助文字);`packages/plugins/plugin-auth/src/register-sso-provider.test.ts`(新
describe:表单参数到 `oidcConfig` 的钉子);`content/docs/permissions/sso.mdx`。
- 两分钟验证:`pnpm --filter @objectstack/plugin-auth exec vitest run
src/register-sso-provider.test.ts`,预期 43 个用例全绿,其中「the Setup form
register_sso_provider names each endpoint …」两条通过。
- 需要你做的:无,席位落地。

## What changes

- **Setup form.** `sys_sso_provider` action `register_sso_provider`
gains optional **Authorization URL** (`authorizationEndpoint`), **Token
URL** (`tokenEndpoint`) and **JWKS URL** (`jwksEndpoint`) params, type
`url`, between `discoveryEndpoint` and `userInfoEndpoint` (the order of
the bridge's own endpoint list). Each help text says the endpoint is
kept instead of the one the discovery document names, is trusted for
this provider, and is to be named when the registration is refused
because the discovery document names that endpoint on a host the server
does not trust; the token and JWKS texts give Google's URL as the
example.
- **Bridge.** No change. `runRegisterSsoProviderFromForm` already
carries all five named endpoints into `oidcConfig` by name (landed in
objectstack-ai#33314); the new params reach it under exactly those names, now pinned.
- **Translations.** Regenerated with `node
scripts/check-i18n-bundles.mjs --write --filter=platform-objects` (no
hand edit). The translated locales carry the English text for the six
new keys until translated.
- **Docs.** `content/docs/permissions/sso.mdx` names the four endpoint
fields of the Setup form and says a Google registration can fill Token
URL, JWKS URL and Userinfo URL there.
- **Changeset.** `.changeset/33395-sso-form-named-endpoints.md`,
`@objectstack/platform-objects` patch.

## Tests

- `packages/plugins/plugin-auth/src/register-sso-provider.test.ts`, new
top-level describe "the Setup form register_sso_provider names each
endpoint under the oidcConfig member the bridge carries it to": (1) the
form's `url` params are exactly the five endpoints the bridge takes,
each optional; (2) every `url` param the form posts, driven through
`runRegisterSsoProviderFromForm`, arrives in `oidcConfig` under its own
name. It reads the action from `@objectstack/platform-objects` (resolved
through `dist/`), so it crosses the form-to-bridge seam.
- `packages/platform-objects/src/platform-objects.test.ts`: the existing
param-list pin now lists the three new params, and the trusted-endpoint
help-text check covers all five endpoints.

## Acceptance notes

- Nothing beyond this card's scope.

## Verification

Final head before this PR: `4f536ba5e` (main merged at `b63c89493..`
plus 5 incoming commits; the incoming ones touch plugin-auth files this
PR does not).

<details><summary>platform-objects: build, test, typecheck (pre-merge
head e890295)</summary>

```
Test Files  122 passed (122)
     Tests  1957 passed (1957)
check:test-typecheck: OK — @objectstack/platform-objects's test layer compiles under packages/platform-objects/tsconfig.test.json
os-verify-lock: VERDICT command-exit 0
```
</details>

<details><summary>plugin-auth: full suite and typecheck (pre-merge head
e890295, pin as first written)</summary>

```
Test Files  272 passed (272)
     Tests  5247 passed | 10 skipped (5257)
check:test-typecheck: OK — @objectstack/plugin-auth's test layer compiles under packages/plugins/plugin-auth/tsconfig.test.json
os-verify-lock: VERDICT command-exit 0
```
</details>

<details><summary>After merging main (head 4f536ba): scoped
re-run</summary>

```
plugin-auth vitest: register-sso-provider.test.ts, organization-delete-read-fault.test.ts, sso-discovery-companion-origins.test.ts
Test Files  3 passed (3)
     Tests  72 passed (72)
plugin-auth typecheck: check:test-typecheck: OK
platform-objects vitest src/platform-objects.test.ts
Test Files  1 passed (1)
     Tests  156 passed (156)
os-verify-lock: VERDICT command-exit 0
eslint --no-inline-config on the three changed .ts files: exit 0
```
</details>

<details><summary>Ablation A: the form param spelled otherwise
(platform-objects source, rebuilt into dist)</summary>

`ablation-replace.mjs` renamed `{ name: 'tokenEndpoint', label: 'Token
URL'` to `{ name: 'tokenUrl', label: 'Token URL'` (anchor 1 to 0, blob
aaf4547 to 3d63005b49ad), then `pnpm --filter
@objectstack/platform-objects build`, then `ablation-dist-preflight.mjs
@objectstack/platform-objects tokenUrl` (marker present in 6 built
files), then the pin file:

```
× offers every endpoint the bridge takes as an optional url param of the same name
× each url param the form posts reaches oidcConfig under its own name
AssertionError: tokenUrl: expected undefined to be 'https://tokenurl.idp.example.com/path'
Test Files  1 failed (1)
     Tests  2 failed | 41 passed (43)
ablation-replace: ok restored: blob == HEAD (aaf4547) and `git diff HEAD` is empty
```

Restore leg: rebuild, `ablation-dist-preflight.mjs
@objectstack/platform-objects tokenUrl --absent` (absent from all 66
built files; working tree clean against HEAD), pin file `Tests 43 passed
(43)`.
</details>

<details><summary>Ablation B: the bridge pass-through removed
(plugin-auth source)</summary>

`ablation-replace.mjs` replaced `if (value) oidcConfig[member] = value;`
with a no-op (anchor 1 to 0, blob dba2012 to f696afc0abe1):

```
× sends userInfoEndpoint in oidcConfig, where the register door trusts its origin, and skipUserInfo at the top level
× sends each named endpoint, trimmed, in oidcConfig under the member of the same name
× each url param the form posts reaches oidcConfig under its own name
Test Files  1 failed (1)
     Tests  3 failed | 40 passed (43)
ablation-replace: ok restored: blob == HEAD (dba2012) and `git diff HEAD` is empty
```
</details>

<details><summary>Derived gate families (dispatch-gates --commands at
4f536ba)</summary>

98 families derived at 4f536ba; each run with its exit captured before
any pipe; `dispatch-gates --ran` with the exit codes: `98 derived
famil(ies) accounted for — 95 run, 3 NOT-MEASURED (3 DERIVED from a
recorded exit 3)`.

- 93 exit 0.
- NOT MEASURED, prerequisite (exit 3): `pnpm --filter @objectstack/spec
run check:skill-examples` (spec declarations not built), `pnpm
check:dual-build-cjs-loads` (workspace not fully built), `pnpm
check:type-check-debt` (its closure build never got a turn on the shared
verify lock).
- NOT MEASURED, stale local build (exit 1, not a finding): `pnpm
--filter @objectstack/spec run check:docs` (refused:
`packages/spec/json-schema is older than packages/spec/src`, a
gitignored artifact), and `pnpm check:docs-transcript-drift` (4 rows,
all in docs this PR does not touch, reading the validate rule count 65
from a `packages/lint` build taken before the merge of main brought
objectstack-ai#33321's two new rules; the docs say 67).
- Re-running those five needs a rebuild of spec and lint under the
shared verify lock; two 9-minute tries
(`OS_VERIFY_LOCK_SLOT=issue-33395-a1`) never acquired it, held
throughout by another session's dogfood run (holder pid 20551). They are
CI's: Lint & Repo Gates and TypeScript Type Check run each on this PR.
</details>

---

_Generated by [Claude
Code](https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
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/m 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.

Register SSO Provider bridge drops tokenEndpoint (Google-style IdPs can never register on hosted), and request-domain-verification answers domain: ""

2 participants