Skip to content

fix(client): send the cookie transport header on unsafe adapter requests - #234

Merged
Bccorb merged 2 commits into
mainfrom
fix/always-send-transport-header
Nov 3, 2026
Merged

Bccorb merged 2 commits into
mainfrom
fix/always-send-transport-header

Conversation

@Bccorb

@Bccorb Bccorb commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Cookie transport now sends x-seamless-auth-transport: cookie on every unsafe request (POST, PUT, PATCH, DELETE) to the server adapter, including POST /refresh and authorizedFetch calls under the adapter mount.

Why

The v0.21 security review (fells-code/seamless-auth-api#558) found that a body-less form POST from a sibling subdomain reaches cookie-authenticated adapter routes. All four adapters are adding a gate: a body-less unsafe auth request needs a JSON content type or this header, otherwise 415 unsupported_media_type. A custom header forces a CORS preflight, which a cross-site form cannot pass. This client release has to ship before the adapter releases (fells-code/seamless-auth-go#30, fells-code/seamless-auth-python#33, fells-code/seamless-auth-rust#34, and the Node adapters), so current calls such as recovery code generation and sign-out keep working.

Details

  • Safe methods are unchanged, so a cross-origin GET /users/me stays a simple request.
  • Requests to the application's own routes and to other trustedOrigins are unchanged.
  • Bearer mode still sends bearer on everything. A header the caller passes still wins.
  • Behavior change: with an empty apiHost (same origin), an absolute URL under the page origin's /auth mount is now recognized as an adapter call, in both modes.
  • An app whose API is on another origin must allow the header in its CORS configuration. The starters already mirror requested headers. The client and React READMEs say so.

Checks

Jest 857 tests, Vitest (Svelte) 56, lint, typecheck, format and build pass.

Server adapters from v0.23 refuse a body-less unsafe request to their auth
routes that carries neither a JSON content type nor x-seamless-auth-transport.
Cookie transport now names itself on POST, PUT, PATCH and DELETE requests to
the adapter, including POST /refresh and authorizedFetch calls under the
adapter mount, so body-less calls pass. Safe methods stay unmarked to avoid a
CORS preflight, and requests to the application's own routes are unchanged.

Refs fells-code/seamless-auth-api#558
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant