Repository navigation
Description
domain:server#4 · os-support-ai · session_01WGufzi1tLRTEYwYGtbNCyk
Ruled: 6764924025 · letter A (gated third-party-initiated entry onto the vendor's SP-initiated flow) · 2026-11-10T10:24Z
Ruling-ref: 6764924025
Decision card for #32086 item 1. #32086 items 2 and 3 proceed without it (PR-A); item 1 (PR-B) waits on this answer.
一句话问题
企业客户在 Okta 或 Entra ID 的应用门户里点 ObjectOS 的 OIDC 应用图标,今天会落到一个 state_not_found 错误页;要让这一下点击能登录,平台需要新增一个「由 IdP 发起、交给我们走标准登录」的入口,而这个入口不是 @better-auth/sso 自带的。
背景
- 实测(cloud#3666,真实 Okta 开发者组织):Okta 的 OIDC IdP 发起登录只有两种模式。
OKTA模式走隐式流,被拒(unsupported_response_type);SPEC模式(OIDC Core §4「第三方发起登录」)把浏览器带到initiate_login_uri,只带iss(和可选target_link_uri),不带 code。ObjectOS 现在回?error=state_not_found。Entra ID 的 OIDC「My Apps」也是打开应用的登录地址,不发 code。 - SAML 的 IdP 发起登录已经可用(plugin-auth SSO: expose the operator knobs Enterprise SSO needs — IdP-initiated sign-in, IdP group to role / permission set, and refusing unknown users instead of JIT #30967 落地)。
- plugin-auth SSO: expose the operator knobs Enterprise SSO needs — IdP-initiated sign-in, IdP group to role / permission set, and refusing unknown users instead of JIT #30967 的
bounceIfIdpInitiated只处理「带 code、不带 state」的回调,Okta 从不这样发。
Governing text
- 维护者裁决 A(plugin-auth SSO: expose the operator knobs Enterprise SSO needs — IdP-initiated sign-in, IdP group to role / permission set, and refusing unknown users instead of JIT #30967,记录 6718355623,2026-11-08):「Per-provider IdP-initiated sign-in toggles for SAML and OIDC, default off, every change audited.」以及评估稿的约束:IdP 发起登录「exposes what
@better-auth/ssoalready implements; ⛔ no sign-in mechanism of our own」。 - OIDC Core 1.0 §4(Initiating Login from a Third Party):RP 必须校验
iss,必须检查target_link_uri防开放重定向。 Prior rulings read: "idp-initiated" "allowIdpInitiated" "third-party-initiated" → 6718355623 (#30967 ruling A); ADR none; thread: none
前提(带复查命令)
bounceIfIdpInitiated只在有code无state时触发:grep -n "bounceIfIdpInitiated" node_modules/@better-auth/sso/dist/index.mjs(vendor 1.7.12,:4132/:4178)。- 带
iss无code的回调落到state_not_found:SSO interop with real IdPs: OIDC IdP-initiated sign-in cannot work with Okta, SAML name/email attributes are not mappable (Oktanameand Entra's URI claims are ignored), and a SAML certificate mismatch is still "Invalid SAML response" #32086 step-0 读数/mnt/project-files/issue-32086/step0.md(main45f0f81f)。 - 设计入口不铸会话:会话只在 IdP 带
code+ 匹配的state回来、换码成功、ID token 验签通过时由 vendor 创建。
选项
| 选项 | 做什么 | 客户感受 | 工作量 |
|---|---|---|---|
| A. 建入口 | 在现有回调路径 GET /sso/callback/:providerId 上,遇到「只带 iss、无 code/state/error」的请求,且该 provider 已登记、allow_idp_initiated 打开、iss 与登记的 issuer 逐字节相等时,转交 vendor 自己的 POST /sign-in/sso 发起标准 SP 登录(新 state、PKCE),302 到 IdP。任何一条不满足就照旧 state_not_found。target_link_uri 只认同源或受信源。 |
点 Okta/Entra 图标直接进入 ObjectOS;开关默认关,由管理员按 provider 打开。 | server 车道 · 1 个 PR(PR-B)约 400–500 行含测试 · 先例 #30967 的 IdP 发起开关 |
| B. 不建,写明不支持 | 文档写明 OIDC 的 IdP 发起登录不支持,客户在 Okta 用「书签应用」指向登录页,或改用 SAML。 | 企业客户的 OIDC 图标点了报错,需要绕路或换协议。 | devx/文档 · 1 个小 PR |
| C. 等上游 | 向 better-auth 提需求,上游支持后再接。 | 时间不可控,期间同 B。 | 无先例,时程未知 |
业务含义直译
- A:像门禁接受「公司前台打电话来说这人是我们的人」,但我们仍要求访客自己刷卡(走完整的标准登录),前台的电话只是让他直接走到刷卡机前。
- B:前台的电话一律不接,访客得自己从大门绕进来。
- C:等门禁厂商出新版本再说。
四维分析
- 项目长远合理性(≥50%):两年后企业 SSO 的平台样子是:SAML 和 OIDC 都能从 IdP 门户一键进入,这是 Okta/Entra 集成目录的基本要求(Salesforce、Slack 作为 RP 都支持
initiate_login_uri)。A 只加一个翻译入口,登录的每一步安全机制(state、PKCE、换码、验签、建会话)仍是 vendor 的;它与裁决 A「不自建登录机制」的精神一致,只是入口本身是我们的。B/C 让 OIDC 永远比 SAML 少一项能力,而 SAML 的 IdP 发起本身是协议上更弱的那种(维护者在裁决 A 里已接受这个风险)。 - 实际业务拉动:有。cloud#3666 是
cloud/ROADMAP.md第 1 档「外部 IdP SSO 端到端验证」,真实 Okta 组织实测撞上;Entra My Apps 同样。 - 防 AI 犯错:A 的入口是闭合判据(四条全满足才放行,其余原样拒绝并记一行 warn),没有宽容回退;出错时用户看到的是今天的
state_not_found,不会静默登录错人。 - 创业阶段不扩散:A 约 400–500 行,复用现有开关,不加新配置键;B 最省,但把一个已裁定要做的能力(裁决 A 写明 SAML 和 OIDC 都有开关)留成半截。
os-decision-facets
① 长远:A 补齐裁决 A 已承诺的 OIDC 半边,不增新契约键;B/C 留一个永久特例(OIDC 少一项)。
② 拉动:路线图第 1 档客户实测撞上(cloud#3666,Okta + Entra)。
③ 防错:闭合四条判据,失败即今天的拒绝,不铸会话;无静默放行。
④ 不扩散:A 复用现有开关、无新键,约 400–500 行;B 最小但留半截能力。
推荐
A。 只看①选 A;②③④ 是否翻转:否。置信缺口:入口可被任意网站上的链接触发(GET),对已开启开关的 provider 会启动一次 SSO 流程;但它能到达的东西不超过今天任何人都能调用的 POST /sign-in/sso,而且最终登录仍需用户在 IdP 侧通过认证。
不取 B:OIDC 客户无法从门户进入,裁决 A 的 OIDC 开关形同虚设。不取 C:时程不可控,期间等同 B。
安全面说明(人工地板)
本项改变未登录请求能到达的东西:一种新的未登录 GET 形状会得到 302 到 IdP、一个 state cookie 和一条 auth-state 记录(今天得到 state_not_found)。按 pm-dispatch,认证流的放宽是人工地板,席位不代裁。
裁后执行
- 选 A:SSO interop with real IdPs: OIDC IdP-initiated sign-in cannot work with Okta, SAML name/email attributes are not mappable (Okta
nameand Entra's URI claims are ignored), and a SAML certificate mismatch is still "Invalid SAML response" #32086 的卡线程按 step-0 设计写 PR-B(Fixes #32086),pin:入口不发会话 cookie、不写sys_session;随后带外来或缺失 state 的回调仍被拒;开关关闭、iss差一个字符、SAML provider、不受信target_link_uri四个对照组全部维持今天的行为。席位按契约复审档复核后落地。 - 选 B:席位关掉 SSO interop with real IdPs: OIDC IdP-initiated sign-in cannot work with Okta, SAML name/email attributes are not mappable (Okta
nameand Entra's URI claims are ignored), and a SAML certificate mismatch is still "Invalid SAML response" #32086 的 item 1,立一张 devx 文档卡写明不支持与 Okta 书签应用的绕法。 - 选 C:同 B,另在卡上记上游需求链接,挂
pm:on-hold+Restart-when:上游发布。
相关
#32086(item 1)· #30967(裁决 A)· cloud#3666 · step-0 读数 /mnt/project-files/issue-32086/step0.md
Activity
os-support-ai commentedon Nov 10, 2026
Ruling: build the gated third-party-initiated entry onto the vendor's own SP-initiated flow · letter A · maintainer chose "A 建受控入口(推荐)" on the decision card 2026-11-10T10:24Z
What A binds (#32086 item 1, PR-B):
GET /sso/callback/:providerId, a request carryingissand nocode,stateorerroris handed to the vendor's ownPOST /sign-in/sso(fresh state, PKCE) and answered with a 302 to the IdP only when all four hold: the provider is registered; itsallow_idp_initiatedtoggle is on (the per-provider toggle from plugin-auth SSO: expose the operator knobs Enterprise SSO needs — IdP-initiated sign-in, IdP group to role / permission set, and refusing unknown users instead of JIT #30967 ruling A, default off, every change audited);issequals the registered issuer byte for byte;target_link_uriis absent, same-origin, or a trusted origin. Any miss keeps today'sstate_not_foundand writes one warn line. No permissive fallback.sys_sessionrow. A session is created only by the vendor after the IdP returnscodewith a matchingstate, the code exchange succeeds and the ID token verifies. This stays inside plugin-auth SSO: expose the operator knobs Enterprise SSO needs — IdP-initiated sign-in, IdP group to role / permission set, and refusing unknown users instead of JIT #30967's "no sign-in mechanism of our own".sys_session; a later callback with a foreign or missingstateis still refused; the four controls (toggle off,issoff by one character, a SAML provider, an untrustedtarget_link_uri) all keep today's behaviour.Reader who acts: the
domain:serverseat (seat 4) orders PR-B on the #32086 card thread per the step-0 design (Fixes #32086). Labels are the seat's stroke.Generated by Claude Code
objectstack-fleet commentedon Nov 10, 2026
domain:server#4 · os-support-ai · session_01WGufzi1tLRTEYwYGtbNCyk
Ruled A (6764924025, maintainer 2026-11-10).
needs-user-decisionremoved; closed as completed. Executed on #32086 as PR-B (Fixes #32086) by the seat 4 card thread, contract-review tier re-review before landing.feat(plugin-auth, platform-objects): an SSO provider maps the email a…