Repository navigation
fix(plugin-auth)!: SSO discovery fetches only hosts that resolve to public addresses - #35697
Conversation
…ublic addresses The host a registration's discovery document is read from is resolved before the vendor's register endpoint runs, and every address must be public, unless the deployment's configured trusted origins list it. The origins a registration names stay trusted for that registration's discovery checks, handed on only for an admitted actor and only after this check. Claude-Session: https://claude.ai/code/session_016WV4czt69hUUaG5XcgFNYL Co-authored-by: Claude <noreply@anthropic.com>
…discovery-public-hosts
…ne host resolved Claude-Session: https://claude.ai/code/session_016WV4czt69hUUaG5XcgFNYL Co-authored-by: Claude <noreply@anthropic.com>
…ly in the sign-out update case The registration step reads its discovery document only from a host that resolves to public addresses, so the case registers under that resolution and moves the issuer's host to a private address for the update it judges. Claude-Session: https://claude.ai/code/session_016WV4czt69hUUaG5XcgFNYL Co-authored-by: Claude <noreply@anthropic.com>
…discovery-public-hosts
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 21 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 2a913715ffb494d1361fab5b027bcc17b2c94603 && git checkout 2a913715ffb494d1361fab5b027bcc17b2c94603
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d44b5e3daa828f7402c182770d0c025e537ed726 ba221aaa508ff6e65051119bf91fb1447f8a65b9 && git checkout -B drift-repro d44b5e3daa828f7402c182770d0c025e537ed726 && git merge --no-ff ba221aaa508ff6e65051119bf91fb1447f8a65b9
node scripts/docs-audit/affected-docs.mjs --json d44b5e3daa828f7402c182770d0c025e537ed726
|
|
security#2 · os-elon-musk · session_016WV4czt69hUUaG5XcgFNYL Contract-review-claim: session_016WV4czt69hUUaG5XcgFNYL · head 32d1f05 · 2026-11-20T00:19Z |
|
security#2 · os-elon-musk · session_016WV4czt69hUUaG5XcgFNYL Contract reviewServed-tier: Inputs: no card (a no-card order); the PR body, file list and net diff against merge base Check-runs on this head, read once: every completed run is ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
No must-fix. One should-fix (S1), two nits. Implemented-by: VERDICT: PASS |
…the sign-out switch's check A registration whose discovery host does not resolve to public addresses is refused on issuer or oidcConfig.discoveryEndpoint whatever signOutOfIdp says, and the sign-out check reads the discovery document only after the rule has admitted its host. The SSO guide and the module notes say what is checked. Claude-Session: https://claude.ai/code/session_016WV4czt69hUUaG5XcgFNYL Co-authored-by: Claude <noreply@anthropic.com>
|
security#2 · os-elon-musk · session_016WV4czt69hUUaG5XcgFNYL Contract-review-claim: session_016WV4czt69hUUaG5XcgFNYL · head ba221aa · 2026-11-20T01:08Z |
|
security#2 · os-elon-musk · session_016WV4czt69hUUaG5XcgFNYL Contract reviewServed-tier: Delta review. This head is one commit over Check-runs on this head, read twice: 40 ① Derived judgments
② Semver levelUnchanged and still correct: ③ Boundary flags
④ Design judgment
No must-fix, no should-fix. One nit (N3). Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Recorded 2026-11-20T04:48Z. Pre-landing notice for this PR's owner. PR #35610 (card #35321, Tier H, awaiting approval) adds a narrowed leg at the merge queue. Once #35610 merges, a pull that declares a narrowing, as this one does, is refused at the queue unless two things are on its head: an authorized approval (or the authorized account's own enqueue), and a standing PASS contract review at |
Requested by Elon · project thread
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no published skill teaches SSO provider registration; the rule is written into the hand-written SSO guide in this diff
维护者速读
What changes
SSO discovery fetches only hosts that resolve to public addresses.
refuseSsoDiscoveryHostNotPublic,sso-discovery-companion-origins.ts): before the vendor'sPOST /sso/registerendpoint runs, the host whose OpenID Connect discovery document the registration reads (the explicitoidcConfig.discoveryEndpoint, else the issuer's well-known URL, computed with the vendor's owncomputeDiscoveryUrl) is resolved, and every address must be public, judged by the vendor's own predicate (isPublicRoutableHost). Otherwise the registration is refused400 VALIDATION_FAILEDonissuer/oidcConfig.discoveryEndpointand nothing is read from the host. The Register SSO Provider bridge relays it as400 SSO_REGISTER_FAILED.OS_TRUSTED_ORIGINS) list is not resolved here, so an identity provider on an internal network still registers once listed; an address literal and a non-public name are left to the vendor's own synchronous refusals; a name that does not resolve, or a runtime with nonode:dns/promises, is left to the read, as the vendor leaves it.oidcConfig.skipDiscoveryregistration read nothing at registration and resolve nothing; endpoints such as the token, userinfo and key-set URLs are not read at registration either (the vendor resolves them when it reads them at sign-in).auth-manager-before-hook.ts). A request with no session still gets the vendor's401, and resolves no name.VALIDATION_FAILED(plugin-auth's entry), so no error-code ledger change.content/docs/permissions/sso.mdx).Read first
packages/plugins/plugin-auth/src/sso-discovery-companion-origins.ts—ssoRegisterDiscoveryRead/refuseSsoDiscoveryHostNotPublic: which host is resolved, and every early return (configured trust, literal, non-public name, no resolver, lookup failure). Risk: a host the vendor reads that this does not resolve.packages/plugins/plugin-auth/src/auth-manager-before-hook.ts— the/sso/registerbranch: the check sits after the platform-admin, held-actor and domain gates and before the sign-out switch's check (so a registration with that switch on is refused on the same member before anything is read), andbodyOriginsis filled only inside the admitted-actor block. Risk: ordering against the sign-out switch's own discovery read.packages/plugins/plugin-auth/src/sso-discovery-companion-origins.test.ts— the new top-level describes and the shared name-resolution double.Two-minute verification
pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/sso-discovery-companion-origins.test.ts— expect every case green, including the describe "SSO discovery reads only hosts that resolve to public addresses".Tests
All readings on the final head
ba221aaa508, under the shared verify lock (lock outcomecommand-exit, rc 0).@objectstack/plugin-authtest: Test Files 287 passed (287) · Tests 6066 passed, 10 skipped (6076).@objectstack/plugin-authtypecheck: exit 0, includingcheck:test-typecheck: OKfor the test layer.pnpm --filter @objectstack/dogfood test, no shard, no path, after building its dependency closure): exit 0 · Test Files 482 passed, 3 skipped (485) · Tests 4093 passed, 68 skipped (4161) · 1766.26s.node:dns/promisesdouble and a fetch recorder. It covers an issuer whose host resolves to10.0.0.5,127.0.0.1or169.254.169.254(each refused400 VALIDATION_FAILEDonissuer, nothing fetched, no row), a mixed public and private answer, an explicitoidcConfig.discoveryEndpoint, and the bridge (400 SSO_REGISTER_FAILED). With the sign-out switch on, a privately resolving issuer is refused onissuerbefore the sign-out check reads it. Controls: a non-platform-admin session answers403 SSO_REGISTER_FORBIDDEN, asks no name, fetches nothing and stores no row; a public answer registers, the name is asked and exactly the discovery URL is fetched; a configured trusted origin registers on a private answer; no session answers401and asks no name.skipDiscovery, an empty body and no body resolve nothing; configured trust, address literals,localhostand a non-public name resolve nothing; a lookup error and an all-public answer are not refused.auth-manager-before-hook.tsrestored to32d1f053b45(check after the sign-out check), the test file went 2 failed, 42 passed (44): both switch-on cases, fieldsignOutOfIdpinstead ofissuer. Restored toHEAD(blob5ec97d7362,git diff HEADempty).32d1f053b45): withauth-manager-before-hook.tsrestored to the merge base (on-disk blob990a149fe2equal to the merge-base blob, 0 occurrences of the check), the test file went 7 failed, 35 passed (42): the six refusal cases and the public control's resolved-name assertion. Restored toHEAD(blob62eb4d262d,git diff HEADempty).Acceptance notes
@objectstack/core/egressis not reused: it is the connect-time guard of the outbound HTTP surfaces with its own allow-list (OS_EGRESS_ALLOWED_TARGETS). Registration judges with the vendor's own predicate so that registration and sign-in apply one rule with one way out (OS_TRUSTED_ORIGINS).check:type-check-debt: it starts a whole-workspace closure build; stopped (exit 143) to free the shared lock.check:dual-build-cjs-loadsand@objectstack/spec check:skill-examples: exit 3, PREREQUISITE NOT MET (built output outside this closure).test:repo(the vitestrepoproject) not run locally: the diff touches none of its tests and the derivation does not name it; CI's Test Core runs it.Verification
Derived gate families on ba221aa (106)
node scripts/pm/dispatch-gates.mjs --commandsnamed 106 families for this diff. On the final head: 103 exit 0, 2 exit 3 (PREREQUISITE NOT MET), 1 NOT-MEASURED (check:type-check-debt; CIType Check · debt ledgersuccess).--ranreconciliation:✓ dispatch-gates --ran: 106 derived famil(ies) accounted for — 103 run, 3 NOT-MEASURED (2 DERIVED from a recorded exit 3, 1 claimed).Outside the derivation:
pnpm check:error-code-casingexit 0 —✓ no unlisted lowercase error codes in 12955 scanned file(s) (ADR-0112).ADR-0087:
✓ check-adr-0087-registration: 1 declared-breaking changeset(s), each carrying an ADR-0087 disposition.([BREAKING+bang+clause-②-narrowing] not-required (no-migration-prescription))Package and dogfood runs on ba221aa
Ablation legs
Generated by Claude Code