Repository navigation
Description
domain:server#3 · marchtian · session_017ihL2dFb2QdZEHEJ83cR2B
Filing gate: a follow-up carved out by a maintainer ruling. #30965 was ruled D + A + V1 (ruling 6709033929, 田騏 2026-11-07 15:29Z): that card lands OIDC now; SAML moves here, upstream first. This card inherits that ruling and does not go back to the decision box, except for the one return named below. Consumer: objectstack-ai/cloud#3666 (Enterprise SSO with Okta / Entra ID, SAML is Entra's default).
维护者速读
SAML 登录被拒时(断言过期、签发方不对、签名坏了、证书换了),平台仍只说一句「Invalid SAML response」。原因在 @better-auth/sso 内部就被丢掉了,我们不改包读不到。按裁定,先给 better-auth 提一个约 30 行的上游 PR,让它把 samlify 的错误原因带出来,合并后升级依赖,再在 plugin-auth 里映射成和 OIDC 同一份清单的原因 token。
Measured (card thread report 6708108101, analysis 6708199006)
@better-auth/sso1.7.12processSAMLResponsewrapssp.parseLoginResponsein acatchwith no binding, logs the constantSAML response validation failed, and throws a constantAPIError('Invalid SAML response'). The ACS endpoint turns that intoerror=saml_error. samlify's causes (FAILED_TO_VERIFY_SIGNATURE,ERR_UNMATCH_ISSUER,ERR_SUBJECT_UNCONFIRMEDfor NotBefore/NotOnOrAfter,ERR_EXPIRED_SESSION) never leave the package.- Still the same in 1.7.18 (npm latest) and 1.8.0-beta.6, per the Fable analysis thread's download of each
dist/index.mjs. - Already distinct today, so out of scope: audience / recipient (
invalid_saml_response+ message), replay (replay_detected), InResponseTo. pnpm patchin this repo does not reach cloud's npm install of@objectstack/plugin-auth(ruled out as option C).
Plan (ruling execution, section 7 of 6708199006)
- The seat drafts the better-auth upstream PR: inside that
catch, keep the samlify error and map its code onto theAPIError'scode, so the ACS endpoint's existing lower-casing puts it inerror=(or a hook, whichever upstream prefers), plus a test. Draft text goes to this card. - Maintainer action: submitting it needs 田騏's account or an authorization, because the upstream repository is outside this project's write scope.
- After upstream merges and releases: bump the
@better-auth/ssopin, then map the cause onto the token list plugin-auth SSO: every OIDC and SAML refusal answers one opaque error (token_not_verified / Invalid SAML response), so an admin cannot tell expiry, audience, issuer or key apart #30965 exports, with the same docs page and the same structuredwarnline (providerId,protocol: 'saml',cause). Tokens:assertion_expired,assertion_not_yet_valid,assertion_issuer_mismatch,assertion_signing_key_unknown,assertion_signature_invalid. ⛔ No assertion XML, NameID, email, or account signal. - The one return to the box: if the upstream PR has not moved two weeks after submission, option B (plugin-auth re-parses with samlify only to label an already-refused response) goes back to the decision box once, with its preconditions stated.
Acceptance
- Each SAML refusal class yields its own token and log line on the real plugin, with a CONTROL valid assertion and a no-leak pin. The SAML cases among cloud#3666's
it.todocases can go live.
Blocked-by: #30965
Serial: #30965 creates the exported token list and docs page this card extends; #30967 and #30966 touch the same SSO mount.
Dedupe (open and closed): Invalid SAML response → #30965 (the parent), #6015 (triage seat post); processSAMLResponse → none. None is this card.
Suggested-grade: p2 · Enterprise priority (maintainer); the parent's p1 rested on a protocol addition, which V1 removed.
Maintainer-action: run the upstream checks in notes.md and submit upstream-pr.md + upstream.patch to better-auth/better-auth from an account with access (or authorize a named account to do it) — done when an upstream PR URL is on this card
Activity
objectstack-fleet commentedon Nov 7, 2026
triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U
Path: none
Triage: audit · p1 ·
domain:server· 2026-11-07T15:58Z⛔ Not a claim.
@better-auth/ssokeeps samlify's error: an upstream PR of about 30 lines first, then the dependency bump, then the mapping onto the same reason tokens as OIDC.domain:server.findingremoved,pm:queue.Generated by Claude Code
objectstack-fleet commentedon Nov 7, 2026
domain:server#3 · marchtian · session_017ihL2dFb2QdZEHEJ83cR2B
Claim: PM loop round 2 · step 1 only (draft the upstream PR; no external write) · 2026-11-07T16:40Z
Session:
session_017ihL2dFb2QdZEHEJ83cR2BAccount:
marchtianBranch:
claude/project-thread-gcjpwsWorktree:
objectstack-issue-31168(the card thread's own checkout)Domain:
domain:serverSeat:
domain:server#3File surface: none in this repo: step 1 writes only
/mnt/project-files/issue-31168/(upstream PR text, patch, notes) and the os-dev-report on this card. ⛔ no external write (no fork, push, issue, PR or comment on better-auth/better-auth); submitting is the maintainer action that follows (stop on breach; explain in the report)Container & model:
S,mode:thread(card thread cmsg_01VmuUhXU9SSUzqJYyXSmYSiJybC7yeNbhTEC6T4Kg9ZYS of this account's project),model: TIER_DEFAULT — dispatch-gates --tier: no path-derived mandate,effort: session default — card-thread effort is set by the maintainer only; the seat's reading is medium (S; read upstream source and draft)Clause-②: no — step 1 changes no objectstack file
Metadata-protocol: none
Responsibility: n/a — follow-up carved by ruling 6709033929
Thread-read: 6709440634
Premise: holds — ruling D + A + V1 (6709033929) carved SAML out of #30965; triage 6709440634 says step 1 (the upstream PR draft) is unblocked. The bare catch in
processSAMLResponsewas measured in @better-auth/sso 1.7.12 (6708108101) and reported unchanged in 1.7.18 / 1.8.0-beta.6 (6708199006); the thread re-reads upstream mainSerial constraints cleared: none for step 1 (no objectstack file); steps 3+ (pin bump and mapping) wait for #30965, which creates the exported token list
The dispatch order is the card thread's opening message (files
server-seat-3/orders/_standing.md+server-seat-3/orders/31168.mdin this account's project); slot granted by the project coordinator.objectstack-fleet commentedon Nov 7, 2026
domain:server#3 · marchtian · session_017ihL2gS7851QofFsGUpWYw
os-dev-report
{ "issue": 31168, "status": "done", "branch": "claude/project-thread-gcjpws (no commits: step 1 changes no objectstack file)", "pr": null, "session": "session_017ihL2gS7851QofFsGUpWYw", "premise_still_valid": true, "summary": "Step 1 only: drafted the better-auth upstream PR; nothing submitted anywhere. Premise re-measured on upstream main ba59f5d8ecec4741718dc6d16ca135d810a1bef0: packages/sso/src/routes/saml-pipeline.ts processSAMLResponse L393-411 still has the bare catch (constant log + APIError('Invalid SAML response') with no code), and sso.ts L2136-2172 lowercases body.code into error= (default saml_error). The draft binds the error and maps samlify 2.13.1 / xml-crypto 6.4.0 rejections onto new SAML_ERROR_CODES (saml_signature_invalid, saml_signing_cert_mismatch, saml_issuer_mismatch, saml_assertion_expired, saml_assertion_not_yet_valid, saml_session_expired, saml_response_status_not_success; anything else keeps saml_error / Invalid SAML response); samlify reports both validity-window ends as ERR_SUBJECT_UNCONFIRMED, so the draft splits them by reading NotBefore from the sole assertion. Only constant messages leave the function; log line gains { providerId, code }. Files: /mnt/project-files/issue-31168/upstream-pr.md (title + body, CONTRIBUTING shape, no template upstream), upstream.patch (git apply --check clean on ba59f5d), notes.md (token mapping + open questions).", "tests": "NOT RUN. Upstream cloned into the session scratchpad (read-only clone); `git apply --check --verbose upstream.patch` on a ba59f5d worktree :: exit 0, all 8 files. `pnpm install --filter @better-auth/sso...` was REFUSED by the session permission check (Code from External); not routed around. Draft tests: src/saml/parse-error.test.ts (each samlify message -> code, window split both ways, unknown -> null) and saml.test.ts 'samlify rejection causes' (4 real ACS round trips via the mock IdP: altered after signing, other issuer, expired, not yet valid; each pins error=, NameID absent from Location, no account/session written; existing 'accepts a response-only signature' is the CONTROL). Commands to run before submit are in notes.md.", "gates": "n/a: no objectstack file changed (dispatch-gates derives nothing for an empty diff); upstream lint/typecheck not run (same install refusal)", "line_budget": "order said ~30 lines + test; source is +101/-2 (parse-error.ts 68 incl. comments ~49 code, pipeline 12, error-codes 10, timestamp 2), tests +151, docs +15, changeset +5. Over because samlify merges expired/not-yet-valid (~20 lines to split), xml-crypto throws its own message on key rotation, and upstream AGENTS.md requires docs + changeset. Dropping the split brings source near 40.", "deviations": [ "size over the ~30-line target (see line_budget)", "also gives validateSAMLTimestamp's two errors the same codes, so one cause = one error= value whichever check fires", "upstream tests not executed (install refused by permission check)" ], "files_changed": [], "dogfood_battery": "n/a: no PR", "mcp_calls": "0", "api_writes": "1: this comment via post-stamped.mjs (fleet relay)", "open_questions": [ { "question": "Which V1 token does upstream saml_session_expired (SessionNotOnOrAfter passed) map to?", "options": ["A assertion_expired", "B fallback token"], "recommendation": "A: the operator action is the same (user signs in again)" }, { "question": "upstream saml_response_status_not_success (IdP refused, e.g. user not assigned to the app) has no V1 token", "options": ["A fallback token for now", "B add a token (list change, needs a ruling)"], "recommendation": "A now; raise B with the step-3 card if Entra users hit it" }, { "question": "Open an upstream issue before the PR? CONTRIBUTING asks features to be discussed first; the draft is framed fix(sso) because the docs already promise the timestamp errors", "options": ["A PR directly", "B issue first, then PR"], "recommendation": "A; the PR body offers to open an issue" } ], "security_findings": "none", "out_of_scope_findings": [ "class: c · reach: named producer (better-auth upstream, not this repo) · createSP passes samlify clockDrifts only when saml.clockSkew is set, so the documented 5-minute default (DEFAULT_CLOCK_SKEW_MS) is not applied by samlify and an assertion expired 1 minute ago is refused · evidence: packages/sso/src/routes/helpers.ts createSP clockDrifts, samlify validator.verifyTime default [0,0] · dedupe words: clockSkew clockDrifts samlify", "carrier: upstream PR body 'Notes for reviewers' · noted, not filed" ], "premise_note": "submitting is the maintainer step (ruling 6709033929); the 2-week B fallback clock starts at submission" }objectstack-fleet commentedon Nov 7, 2026
domain:server#3 · marchtian · session_017ihL2dFb2QdZEHEJ83cR2B
Step 1 accepted → waiting on the maintainer · 2026-11-07T16:50Z
Draft accepted by the seat (report 6710152080). Files are in the project's
issue-31168/folder:upstream-pr.md(titlefix(sso): name the cause when a SAML response is rejected),upstream.patch(applies cleanly to better-authmainba59f5d8ec), andnotes.md. Upstream main still has the barecatch(packages/sso/src/routes/saml-pipeline.tsL393–411). The patch maps samlify 2.13.1 / xml-crypto 6.4.0 rejections onto seven newSAML_ERROR_CODES, and an unknown error keepssaml_error. It forwards no samlify or xml-crypto message text, since xml-crypto's message embeds the signature value.Seat rulings on the draft's open questions:
saml_session_expired→ ourassertion_expired(the operator's fix is the same).saml_response_status_not_success→ the fallback token for now. Adding a token is a list change, which needs a ruling, so this card does not add one.fix(sso): the upstream docs already promise the timestamp errors that never surface.Not done, named: upstream's tests and typecheck were not run.
pnpm installof an external repo was refused by the session's permission check, and the thread did not route around it. The commands to run before submitting are innotes.md. The size is over the order's ~30-line target (source +101, about 49 lines of code, plus tests, docs and a changeset that upstream's AGENTS.md requires);notes.mdgives the reasons. Upstream finding (createSPpasses no default clock skew to samlify) is mentioned in the draft's reviewer notes; not filed upstream.State:
pm:dispatched→pm:awaiting-maintainer.Maintainer-action: run the upstream checks in
notes.mdand submitupstream-pr.md+upstream.patchto better-auth/better-auth from an account with access (or authorize a named account to do it) — done when an upstream PR URL is on this cardThe two-week clock in ruling 6709033929 starts on the submission date. Steps 3+ (pin bump and mapping onto #30965's exported tokens) follow the upstream release.
objectstack-fleet commentedon Nov 7, 2026
domain:server#3 · marchtian · session_017ihL2dFb2QdZEHEJ83cR2B
Release: session
session_017ihL2dFb2QdZEHEJ83cR2B· 2026-11-07T23:57Z · cause: the maintainer takes the upstream submission himself from another account (「31168 转维护者处理卡片」「我换账户提交」, 2026-11-07 23:56Z) · whereto: stayspm:awaiting-maintainer, no assignee.Maintainer-action: run the upstream checks in
notes.mdand submitupstream-pr.md+upstream.patch(project filesissue-31168/, drafted against better-authmainba59f5d8ec) to better-auth/better-auth from the maintainer's other account — done when an upstream PR URL is on this cardAfter that URL is on the card: the two-week clock of ruling 6709033929 starts (option B returns to the decision box once if upstream has not moved by then). When upstream releases the fix, the card goes back to
pm:queuefor the pin bump and theassertion_*mapping on #30965's token list.objectstack-fleet commentedon Nov 13, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Path: none
Triage: regrade p1 → p2 under the adopted grading rules (#32997) · 2026-11-13T03:10Z
⛔ Not a claim; the card's claim and state are unchanged.
Generated by Claude Code
objectstack-fleet commentedon Nov 19, 2026
epic:#35205#1 · os-warren · session_01JQwxbYJqoPAoSpWTMpH1yq
State:
pm:awaiting-maintainer→pm:blockedon #35265 · 2026-11-19The upstream submission is the maintainer's step and now has its own card, #35265. This card holds the fleet's part: once upstream releases the fix, the pin bump and the
assertion_*mapping onto #30965's token list (#30965 is closed). It waits on the upstream PR first.Blocked-by: #35265
Order: Warren, 2026-11-19 00:32Z, objectstack priorities discussion thread: 「可以拆的都同意。」 Rule: #35259 item 7 (the maintainer's step gets its own card; the dev card closes; blocked cards are released).
Generated by Claude Code