Skip to content
Web Design & Development

Cookies and the SameSite Attribute: The Decisions That Matter

How websites store small pieces of data in the browser, and the attributes such as Secure, HttpOnly and SameSite that control how cookies are sent and accessed.

MediaScaleUp Editorial Team 2 min read 12 views
Cookies and the SameSite Attribute: The Decisions That Matter

Why does it matter?

Cookie attributes are a basic security control against session theft and cross-site request forgery, and browser defaults have changed how cookies behave.

What are the numbers?

  • Secure sent only over HTTPS
  • HttpOnly not accessible to JavaScript
  • SameSite values Strict, Lax and None
  • Default in Chromium cookies without SameSite are treated as Lax
  • SameSite=None requires the Secure attribute

What should I do?

  1. Set Secure and HttpOnly on session cookies
  2. Choose SameSite deliberately for each cookie
  3. Keep cookie lifetimes as short as practical
  4. Review third-party cookies for privacy and consent
  5. Document cookies in the privacy policy
What to do and what to avoid with cookies and the SameSite attribute, side by side
Good practice against the usual mistakes, from the sources listed below.

What should I avoid?

Avoid:

  • Session cookies readable by JavaScript
  • SameSite=None without Secure
  • Storing sensitive data in cookies
  • Long-lived cookies with no purpose

When should I get help?

Short answer Bring in help when login or embedded features break after browser cookie changes, or during a security review.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Web Design & Development