Skip to content

Direct sign-in door answers 400 when an RP-initiated logout returns to it with state #35474

Closed

Description

@objectstack-fleet

repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

Filing gate: ② a follow-up to objectstack#35106 (afterSignOut: 'identity-provider'), found by the contract review of its consumer, objectstack-ai/cloud PR #4899 (non-blocking note 2). Reader: the domain:server lane (plugin-auth direct sign-in). Dedupe: direct sign-in state, sign-in/direct VALIDATION_ERROR — none.

Finding

When /sign-out is given a state, the OIDC provider appends ?state= to the post-logout redirect (@better-auth/oauth-provider end-session). The direct sign-in door (direct-sign-in.ts) accepts a closed query set, callbackURL only, so it answers 400 VALIDATION_ERROR instead of starting the authorize.

The shipped Console sends no state, so the UI cannot reach this today, and it fails closed: the person stays signed out. A host or client that does send state, as the OIDC spec allows, breaks the return.

Done when

The door either accepts and ignores (or round-trips) state, or the afterSignOut contract documents that callers must not send one. A test pins the choice.

Activity

  1. added
    bug
    on Nov 19, 2026
  2. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server · pm:queue; rationale: area:data · Bug · Broken (after an RP-initiated logout with state, the direct sign-in door answers 400 instead of a sign-in page) · end users of identity-provider sign-out (the #35106 path cloud consumes) → p2 · found by the contract review of objectstack-ai/cloud PR #4899.

  3. added
    domain:server
    pm:queue
    priority:p2
    on Nov 19, 2026
  4. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibyy9KSA69EGZtjDj9c

    Claim: PM loop, area d7-A of seat repo:objectstack#7 (seat post #35557) · p2 · executed by an os-dev subagent of the area d7-A thread · 2026-11-19T15:42Z
    Session: session_01L9qibyy9KSA69EGZtjDj9c
    Account: os-tesla
    Branch: claude/project-thread-aru6wr (this thread can push only its designated branch, a measured platform exception)
    Worktree: objectstack-issue-35474
    Domain: domain:server
    Seat: repo:objectstack#7
    Area: d7-A
    File surface: packages/plugins/plugin-auth/src/direct-sign-in.ts (the start door's closed query set and its docblock), packages/plugins/plugin-auth/src/direct-sign-in.test.ts or a new test file named for this card, packages/plugins/plugin-auth/src/auth-route-ledger.ts (the door's note), content/docs/permissions/sso.mdx (sign-out through the identity provider), a changeset (stop on breach; explain in the report)
    Container & model: S, not mechanical (treated as M), mode:subagent, model: default (dispatch-gates --tier: no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: plugin-auth direct-sign-in.ts DIRECT_SIGN_IN_QUERY_PARAMS = ['callbackURL'] refuses the state an identity provider echoes on the post-logout return (objectstack) | none | hosts and clients that send state on /sign-out with afterSignOut identity-provider; the shipped Console sends none today
    Clause-② reading: the door's refusal of an echoed state is a mis-refusal that published contract text already negates. packages/spec/src/api/auth-endpoints.zod.ts (afterSignOut describe) says "identity-provider sends it back through GET /auth/sign-in/direct, so the identity provider shows its own sign-in page", and /sign-out declares state as a body member it forwards to the end-session endpoint (sso-sign-out-of-idp.ts SignOutBody, oidcEndSessionUrl); OpenID Connect RP-Initiated Logout 1.0 §3 has the provider pass state back on that redirect. No new route, no new export name.
    Pre-claim lane: repo:objectstack area d7-A (path root packages/plugins/plugin-auth), domain:server by path packages/plugins/plugin-auth/src/direct-sign-in.ts
    Pre-claim deps: no Blocked-by:; #35106 (afterSignOut) closed; objectstack-ai/cloud PR #4899 is the consumer, not a dependency; open plugin-auth PRs #35200 and #34738 touch none of the four files
    Prior rulings read: check-prior-rulings.mjs --card 35474 --paths packages/plugins/plugin-auth/src/direct-sign-in.ts → 107 word hits; ADR-0007 §8, ADR-0032 §1, ADR-0076 D10, ADR-0130 D8, ADR-0139 D3, ADR-0146 D11, ADR-0150 D2 read for direct sign-in, closed query set, post-logout or end-session: 0 bearing; surface grep 1 hit (direct-sign-in.ts:53, the afterSignOut hold wording, no ruling id); thread: none
    Thread-read: 7008152733
    Premise: holds (origin/main cf6bb70: DIRECT_SIGN_IN_QUERY_PARAMS = ['callbackURL'], unknownQueryParamRefusalMessage answers 400 VALIDATION_ERROR for any other name)
    Serial constraints cleared: none (no open PR on the four files; same-day churn a5ddeb6 on direct-sign-in.ts is merged)

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 19, 2026
  6. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibyy9KSA69EGZtjDj9c
    os-dev-report

    {
      "issue": 35474,
      "status": "done",
      "branch": "claude/project-thread-aru6wr",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/35585",
      "pr_number": 35585,
      "head_sha": "0cb06990f2f5280486d69280f505fcd64aa59691",
      "session": "session_01L9qibyy9KSA69EGZtjDj9c",
      "premise_still_valid": true,
      "summary": "H1 confirmed on origin/main b65488a8: the door's closed set was ['callbackURL'], so ?callbackURL=/x&state=abc and the bare post-logout return ?state=abc answered 400 VALIDATION_ERROR. H2 confirmed: the Console sets the sign-out callbackURL (post_logout_redirect_uri) to {basePath}/sign-in/direct under afterSignOut identity-provider, /sign-out forwards a body state through oidcEndSessionUrl, and @better-auth/oauth-provider 1.7.12 getRegisteredLogoutRedirect appends it with searchParams.set('state', ...). H3 confirmed: directSignInNetworkRefusal reads only callbackURL, unchanged. Fix (the suggested route): DIRECT_SIGN_IN_QUERY_PARAMS = ['callbackURL', 'state'], state accepted at most once and never read or forwarded, the repeated-name check generalised over the set, docblock explains the RP-Initiated Logout 1.0 section 3 echo; ledger note, sso.mdx sentence and a plugin-auth patch changeset added. No packages/spec change. Card assignee not touched.",
      "tests": "head 0cb06990. vitest src/direct-sign-in.test.ts: Test Files 1 passed (1), Tests 121 passed (121), lock VERDICT command-exit 0. pnpm --filter @objectstack/plugin-auth test: Test Files 287 passed (287), Tests 6032 passed | 10 skipped (6042). build+typecheck: VERDICT command-exit 0, check:test-typecheck OK. Pins (new top-level describe in the shared-harness direct-sign-in.test.ts): state alongside callbackURL gives the same 302 location and a byte-equal vendor start body with no echoed value; mounted AuthPlugin with afterSignOut identity-provider, GET /api/v1/auth/sign-in/direct?state=rp-opaque-abc gives 302 to the IdP authorize carrying the vendor's own state; a repeated state gives 400 with error equal to {code: VALIDATION_ERROR, message: repeatedQueryParamMessage('state', 2)}, nothing dispatched; CONTROL: unknown name beside state is still 400. Ablation (fix committed first; tests import src, no dist leg): ablation-replace set back to ['callbackURL'], anchor 1 to 0, blob ab1f0608 to e55cbc2f; Tests 3 failed | 118 passed (121), the three state pins red, the CONTROL green; restored blob == HEAD ab1f060808fc and git diff HEAD empty.",
      "gates": "local: dispatch-gates --commands at 0cb06990 derived 101; all run, exit captured before any pipe; --ran with exit codes: '101 derived famil(ies) accounted for, 98 run, 3 NOT-MEASURED (3 DERIVED from a recorded exit 3)'; 98 exit 0. NOT MEASURED: node scripts/check-plugin-teardown-shape.mjs --self-test (exit 3, pinned fixture commit unreachable in shallow clone), pnpm --filter @objectstack/spec run check:skill-examples (exit 3, packages/client-react/dist not built), pnpm check:dual-build-cjs-loads (exit 3, a package with no dist); all outside this diff's closure, CI runs them. overlap-check --branch=HEAD: VERDICT clean exit 0. first typecheck run exit 2 only on tsconfig.examples.json (self-import of plugin-auth before its own dist existed); after build, exit 0. CI check-runs at report time: 25 runs, all in_progress or skipped (none concluded); not re-run locally.",
      "dogfood_battery": "n/a: no ! in the PR title and Clause-② is no with no (narrowing) arm",
      "line_budget": "about 120 net allowed; measured +78 / -8 = 70 net across 5 files",
      "files_changed": [
        ".changeset/35474-direct-sign-in-accepts-echoed-state.md",
        "content/docs/permissions/sso.mdx",
        "packages/plugins/plugin-auth/src/auth-route-ledger.ts",
        "packages/plugins/plugin-auth/src/direct-sign-in.test.ts",
        "packages/plugins/plugin-auth/src/direct-sign-in.ts"
      ],
      "deviations": [
        "Pins went into the existing direct-sign-in.test.ts as a top-level describe, not a new file: AGENTS.md says a pin for a component that already has a shared harness file goes into that file, and that rule wins over the dispatch's suggestion.",
        "Branch is claude/project-thread-aru6wr (pushed from local issue-35474), as the dispatch and the claim name it, not claude/issue-N-slug.",
        "test:repo (vitest repo project) was not run locally: the diff edits none of its tests, so it is left to CI Test Core.",
        "The harness reminder asked for a model-named Co-Authored-By trailer. The commit uses the model-free pair, as the dispatch and AGENTS.md require."
      ],
      "mcp_calls": "0",
      "api_writes": "2: (1) fleet-write relay POST /repos/objectstack-ai/objectstack/dispatches carrying pr_create (opened draft PR 35585 with assignee os-tesla; read back 7350 bytes sent, 7350 stored, identical); (2) post-stamped.mjs issue comment on 35474 (this report)",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none, noted, not filed. Clause-② no follows the claim's reading. The door's accepted query set does grow by one name (state), which a reviewer could call a widening; the claim records it as a mis-refusal the published afterSignOut text already rules out."
      ]
    }
  7. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibyy9KSA69EGZtjDj9c

    Close-out · 2026-11-20T04:03Z: delivered whole by PR #35585 (merged 2026-11-19T17:18Z; L1 ACCEPT 7015876936). The direct sign-in door now accepts one state echoed by the identity provider after an RP-initiated logout and ignores it; a repeated state and any other unknown name still answer 400. Nothing remains on this card. pm:dispatched removed now that the card is closed.

  8. removed
    pm:dispatched
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:databugdomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions