Skip to content

Leave SameSite unset on the OAuth state cookie in dev (upstream #2946, new head) - #5

Merged
verveguy merged 1 commit into
self-hosted-patchesfrom
upstream-pr/2946-dev-samesite
Nov 21, 2026
Merged

verveguy merged 1 commit into
self-hosted-patchesfrom
upstream-pr/2946-dev-samesite

Conversation

@verveguy

Copy link
Copy Markdown

Takes the new head of upstream instantdb#2946 (by RaphaelFakhri), cherry-picked unchanged from 2954f04 with -x. It goes on top of #3, which carried the PR's earlier head (2cde2fa).

What it changes. #3 set the OAuth state cookie to SameSite=Lax explicitly whenever the cookie isn't Secure, which only happens in dev. An explicit Lax turns off Chrome's two-minute "Lax + POST" allowance, which applies only to cookies with no SameSite, so quick generic-provider sign-ins over plain HTTP in dev could fail. Now the attribute is left unset in that case, as it was before #3. Our review of #3 raised this, and the upstream author took the suggestion.

With Secure (every non-dev environment, including ours) nothing changes: the cookie still gets SameSite=None.

Tests (on the Mac, against a local Postgres 17 test database):

  • instant.runtime.routes-test: 25 tests, 256 assertions, 0 failures.

Tracking. The upstream head we take moves from 2cde2fa to 2954f04 in our tracker. If upstream merges the PR, we'll drop both commits when we rebase.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HRKkuGrp63pNCgPK1hVdC7

An explicit SameSite=Lax turns off Chrome's two-minute "Lax + POST"
allowance, which only applies to cookies without a SameSite attribute,
so form_post callbacks over plain HTTP in dev stopped receiving the
cookie. Set SameSite=None only when the cookie is Secure.

(cherry picked from commit 2954f04)

@liminisapp-pruefer liminisapp-pruefer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the one staged entry, 0001, which changes the OAuth state cookie attributes in server/src/instant/runtime/routes.clj. The cookie map is now built with cond->. :same-site :none is added only when secure? is true, which is every non-dev environment. In dev the attribute is omitted, so the cookie goes out without SameSite, as it did before #3. That matches the PR description's reasoning about Chrome's Lax+POST allowance.

I counted the closing parentheses on the last line (secure? (assoc :same-site :none)))))))) and they balance. Production behavior is unchanged: HttpOnly, Secure, SameSite=None, expiry and path are all as before. In dev, :secure false is still passed explicitly and only :same-site is dropped. I found nothing to flag. I did not run the tests, and the diff includes no test change that covers the dev-only unset case.

PRUEFER_COVERAGE: complete

@verveguy
verveguy merged commit bde4748 into self-hosted-patches Nov 21, 2026
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.

2 participants