Repository navigation
fix(plugin-auth)!: the Register SSO Provider bridge takes every endpoint /sso/register takes, and the domain-verification answer carries the registered domain - #33314
Conversation
…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>
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 22 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 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
|
|
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. |
|
Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 225eba1 · 2026-11-14T16:29:44Z review#3. |
Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentReading 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 Implemented-by: 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>
|
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 |
|
Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 26fa504 · 2026-11-14T16:46:54Z review#3 (delta). |
Contract reviewServed-tier: Delta over my FAIL at ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentUnchanged from the first record: reading the registered domain back is the right source of truth, the per-host Implemented-by: VERDICT: PASS |
Review carry — PASS standsHead: The delta from my PASS at |
|
domain:server#5 · os-elon-musk · session_016WV4d1NJYFGVi2FRztyBNo ACCEPT · area A1 · Fixes #33197 · head a888896 · 2026-11-14T17:43Z
|
…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>
Requested by Elon · project thread
Fixes #33197
Clause-②: yes (narrowing) — narrowed, all on
POST /api/v1/auth/admin/sso/request-domain-verification: adomainin the request body is no longer read, so a caller that named one now gets the record name anddomainof 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 answers400 DOMAIN_VERIFICATION_FAILEDwhere it answered200with a token (verify-domain refuses such a provider withINVALID_DOMAINanyway); and the door now reads the provider back throughGET /sso/get-provider, so a non-2xx answer to that read is returned asDOMAIN_VERIFICATION_FAILEDwith the read's status where the door answered200. Widened:POST /api/v1/auth/admin/sso/registernow acceptstokenEndpoint,jwksEndpointandauthorizationEndpointbesidediscoveryEndpointanduserInfoEndpoint(a form that names none of them sends the body it sent before), and therequest-domain-verificationanswer gainsdnsRecords.Metadata-protocol: none
维护者速读
POST /admin/sso/register)现在接收tokenEndpoint、jwksEndpoint、authorizationEndpoint(原来只收userInfoEndpoint和discoveryEndpoint);「申请域名验证」的返回里domain改为提供方注册时的域名,DNS 记录名也放在这个域名下。tokenEndpoint,但入口把这个字段丢掉了,所以永远注册不上;域名验证的返回domain是空字符串,用户不知道记录该加在哪个域名下。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/registertakes.runRegisterSsoProviderFromFormnow carriesauthorizationEndpoint,tokenEndpoint,jwksEndpoint,userInfoEndpointanddiscoveryEndpointfrom the flat form intooidcConfig, each under the member of the same name and trimmed, the same handlinguserInfoEndpointalready had (the vendor's schema judges each value as a URL).AuthManager.ssoDiscoveryTrustedOriginsalready trusts the origin of every endpoint a/sso/registerbody 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 onlyuserInfoEndpointanddiscoveryEndpoint.The domain-verification answer carries the registered domain.
runRequestDomainVerificationused the request body'sdomainonly, so a request naming none answereddomain: ""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 samecheckProviderAccessgate as the challenge) and places the record under the registered domain. Adomainin the body is no longer read. A failed read answersDOMAIN_VERIFICATION_FAILEDwith the read's status; a registered domain that names no host name answers400 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
domainon commas, reduces each entry to its lower-cased host name, and requires the TXT record at_better-auth-token-PROVIDER.HOSTfor EVERY listed host, refusing at the first one without it (parseProviderDomainsand the loop inverifyDomain,@better-auth/sso1.7.12). So one record name cannot instruct the admin for such a provider. The answer keepsdomain(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 withdomainin 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 dropsdomainfrom the body and showsdnsRecords. The "What verification decides" bullets are untouched.Tests
All through the real vendor (
@better-auth/sso1.7.12), except the fake-handle error mapping:sso-discovery-companion-origins.test.ts(realAuthManager, discovery stubbed overfetch): 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 relays400 SSO_REGISTER_FAILEDnamingtoken_endpointand the bridge fieldtokenEndpoint, nothing stored. CONTROL: the token endpoint alone moves the refusal on tojwks_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, realAuthPluginroutes, DNS double): a request naming only the provider answers its registered domain and the record under it, and that record verifies; CONTROL: a bodydomaindoes not move the record; a provider listing two domains answers two records, a record under the first alone is refused502, both published verifies.sso-domain-verification-error-codes.test.ts: the read goes to/sso/get-providerfor the same provider with the caller's credential; a refused read and an empty domain answerDOMAIN_VERIFICATION_FAILEDwith no record. The one existing success-path case answers/sso/get-providerin its fake now.Verification
All readings on head
225eba1e(this branch merged withorigin/mainat199e3624), under the shared verify lock.Premise check on origin/main (d4fbb4d)
register-sso-provider.tsread onlydiscoveryEndpointanduserInfoEndpointfrom the form;tokenEndpoint,jwksEndpointandauthorizationEndpointwere dropped.runRequestDomainVerificationbuiltdomainfrom the body only (bareHostname(str(body?.domain))), so a body without it answereddomain: ""and a bare label.@better-auth/sso1.7.12) declares all five endpoint members onoidcConfig, 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, andcheck:test-typecheckOK, ledger unchanged).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 threesso-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)
discoveryEndpoint/userInfoEndpointagain: 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 HEADee4a5510.domainagain 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 HEADee4a5510.Gates
node scripts/pm/dispatch-gates.mjs --commandsderived 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).--ranreconciliation: 97 derived, 94 run, 3 NOT-MEASURED, 0 UNRUN.check-plugin-teardown-shape --self-testfirst exited 3 on the shallow clone; after fetching its pinned positive-control commit it exited 0 (48 cases).check:nul-bytesexit 0.Acceptance notes
register_sso_provideraction inpackages/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).AuthProxyPlugincalls the samerunRequestDomainVerification; its per-environment handler has to serveGET /sso/get-providerin-process for the answer to carry the domain. Not measurable from this repository.Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses. (CI)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo