G'day! Further to 40781534, for which the accepted answer is to set SameSite=Lax
:
How can I set SameSite=Strict
cookies on a redirection to myself in such a way that I'll get the cookie back from Chrome 56.0.2924.87
, even if the user's request was itself a redirection from a login page on my OAUTH2 provider?
The full request chain is:
POST https://provider.com/callback
→302 FOUND
with:Location: https://me/login?code=xxx&state=yyy
GET https://example.com/login?code=xxx&state=yyy
→302 FOUND
or303 SEE OTHER
(doesn't seem to matter) with:Location: https://example.com/destination Set-Cookie: sid=zzzz; Secure; HttpOnly; SameSite=Strict; Path=/
GET https://example.com/destination
→401 GET OFF MY LAWN
because the browser didn't present thesid
cookieGET https://example.com/destination
→200 OK
if I refresh, because then the site is the same and my browser presents thesid
cookie
I appreciate the CSRF potential of presenting sid
to /destination
for the general case of the user's last loaded page not being on example.com
, but I only just set it from /login
, and I'm the one now redirecting to /destination
.
Sure, I could set SameSite=Lax
, but then wouldn't there be some potential for click-jacking if someone could find some way to trigger redirection of their choice from my site by mal-forming a URL?