Published 25 December 2024 · Updated 11 October 2026
Use HTTPS and appropriate attributes
The Secure attribute restricts shipping to HTTPS. HttpOnly prevents ordinary client-side JavaScript from reading the cookie. SameSite affects shipping when requests are made from other sites.
Limit the scope and duration
Choose an appropriate path, domain scope and expiration time. Do not store passwords or unnecessary personal data in a cookie. For authentication, the server must reliably validate the session.
Cookies are not the whole security
Safe cookies do not replace control over permissions or protection against unwanted requests. Keep track of your application and dependencies and check your session management.
Test the actual user stream
Check login, log out and run out of a session. External payment or login flows may request a different SameSite choice than a regular website.

