SameSite Cookie Attribute (SameSite Cookies)
Why SameSite Cookies Is Important
SameSite is the most effective defense against CSRF attacks. When set to Strict or Lax, the browser will not include the cookie in requests initiated by other sites, preventing attackers from making authenticated requests on behalf of users.
Chrome defaulted to SameSite=Lax for cookies without an explicit SameSite attribute starting in 2020. This was a major security improvement that broke some cross-site authentication flows but significantly reduced CSRF vulnerability across the web.
SameSite=Strict is the most secure but can cause usability issues. If a user clicks a link to your site from an external page, cookies are not sent on the initial navigation, so the user appears logged out. SameSite=Lax is the recommended default because it allows cookies on top-level navigations (preserving login state) while blocking them on cross-site form submissions and AJAX requests.
How to Check
A security audit checks the SameSite attribute on your cookies. Session cookies should have SameSite=Lax or SameSite=Strict. If you need cross-site cookie sending (for third-party integrations), use SameSite=None with the Secure flag.