🔐SameSite Cookie Attribute
Also known as SameSite, SameSite Cookie, SameSite=Lax, SameSite=Strict, SameSite=None
A cookie setting. It keeps the cookie off requests that start on other sites.
Think of it like
Think of it like a pass that only works at the front door. Use a side door, and it does not count.
Example
Emma sets her login cookie to SameSite=Lax. A bad page posts a hidden form to her app. The browser sends it with no cookie, so the request fails.
Why it matters
One word on the cookie stops most forged requests, even where an app forgot its form check.
Definition
Example code
http
Set-Cookie: session=7f3a9c; Secure; HttpOnly; SameSite=LaxCommon mistake
Key takeaways
- 1Lax. Sent on links, not on forms from other sites.
- 2Strict. Never sent on requests from other sites.
- 3None. Always sent, and must be Secure.