SameSite
A cookie attribute that limits whether the browser sends the cookie on requests started by other websites.
In more detail
Strict never sends it cross-site, Lax sends it only on top-level navigations such as following a link, and None always sends it but requires Secure. It is a main defence against cross-site request forgery.
Example
In the browser: Strict never sends the cookie on cross-site requests, even when following a link. Lax, which Chromium-based browsers apply when no SameSite value is set, sends it on top-level link navigations but not on cross-site form POSTs, fetches or embedded subrequests. None sends it everywhere and requires Secure.Related terms
- cookie — A small named value a server asks a browser to store and send back automatically on later matching requests.
- cross-site request forgery — An attack where another website makes a logged-in user’s browser send an unwanted request that carries their cookies automatically.
- cross-site request forgery — An attack where another website makes the victim's browser send a request to your site, and the browser's cookie makes it look genuine.
- CSRF token — A secret value tied to the user's session that must accompany each state-changing request, which another website cannot read or guess.
Taught in
- Cookies And CORS — Modern API Architecture: REST, GraphQL & gRPC
- Basic Auth, Tokens And Sessions — Modern API Architecture: REST, GraphQL & gRPC
- Client Storage Paradigms: Cookies, Storage Tradeoffs — Frontend Architecture & Web Platform
- CSRF Mitigations, SameSite Cookies And Subresource Integrity — Frontend Architecture & Web Platform
- Session Architecture: HTTP-Only Cookies vs Tokens — Production Full-Stack Engineering
- Session Management: Secure Cookies & Token Validation — Next.js 15 & Modern App Router Architecture
- Secure Defaults — Application Security & Threat Modeling for Engineers
- Cross-Site Request Forgery — Application Security & Threat Modeling for Engineers