Repository navigation
Leave SameSite unset on the OAuth state cookie in dev (upstream #2946, new head) - #5
Conversation
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)
There was a problem hiding this comment.
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
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=Laxexplicitly whenever the cookie isn'tSecure, which only happens in dev. An explicitLaxturns off Chrome's two-minute "Lax + POST" allowance, which applies only to cookies with noSameSite, 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 getsSameSite=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