Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change DefaultCookieConfig to use the SameSiteLaxMode #22

Merged
merged 2 commits into from
Jan 7, 2023
Merged

Conversation

dghubble
Copy link
Owner

@dghubble dghubble commented Jan 7, 2023

  • Redirecting to a provider's AuthURL as part of Login creates a chain of redirects to the configured backend callback handler to set a session cookie and (typically) redirect to a profile page
  • Strict cookies would not be sent in the request to the profile page because the redirect chain originated with a redirect to the login provider. The original referrer is used throughout the redirect chain. Because of this browser behavior, most users will need to use SameSite lax mode

If you understand the implications, you can still set strict mode:

cookieConfig := sessions.DefaultCookieConfig
cookieConfig.SameSite = http.SameSiteStrictMode

Rel:

* Redirecting to a provider's AuthURL as part of Login creates a chain
of redirects to the configured backend callback handler to set a session
cookie and (typically) redirect to a profile page
* Strict cookies would not be sent in the request to the profile page
because the redirect chain originated with a redirect to the login provider.
The original referrer is used throughout the redirect chain. Because
of this browser behavior, most users will need to use SameSite lax mode

If you understand the implications, you can still set strict mode:

```
cookieConfig := sessions.DefaultCookieConfig
cookieConfig.SameSite = http.SameSiteStrictMode
```

Rel:

* https://www.nogginbox.co.uk/blog/strict-cookies-not-sent-by-request
* https://bugzilla.mozilla.org/show_bug.cgi?id=1453814
@dghubble dghubble merged commit 49f1e26 into main Jan 7, 2023
@dghubble dghubble deleted the patch branch January 7, 2023 22:11
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