OOmnistu

Blog / Engineering Playbooks

Engineering Playbooks

Cookies for site owners: what they do and the security settings that matter

Learn how cookies support sessions and which security settings matter when a site stores and sends browser state.

OOmnistu
Reviewed 2026-11-16 · 3 min read

A cookie is, per MDN's guide (https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Cookies), a small piece of data a server sends to the browser, which may store it and send it back with later requests. Because HTTP is stateless by default, cookies let sites remember state.

What cookies are used for

MDN names three main purposes: session management (sign-in status, shopping cart), personalization (language, theme) and tracking (recording and analysing behaviour). In a basic sign-in system, the server sets a cookie containing a session ID after correct credentials, the browser sends it with later requests, and the server checks the ID to decide what to show.

Security attributes

MDN warns that cookie values are by default visible to, and changeable by, the end user, and that a stolen session ID could let someone appear logged in as another person. Settings it describes:

MDN also suggests using an opaque identifier that the server looks up, instead of putting sensitive information in a cookie.

Third-party cookies and privacy

MDN says third-party cookies have legitimate uses such as counting ad impressions or analytics across related domains, but can also build profiles of browsing habits. It reports that browser vendors have started blocking third-party cookies by default or planned to, and that this can break components like social widgets. Developers should look at reducing reliance on them. This matters if you plan analytics or advertising: check each vendor's current behaviour and the browsers you care about.

Regulations

MDN lists the GDPR, the ePrivacy Directive and the California Consumer Privacy Act as laws covering cookies, says they can reach sites accessed from those jurisdictions, and says the burden of knowing and complying is on you. We have not researched Indian rules or any of these laws, and this article is not legal advice. Ask qualified counsel what applies to your site.

Checklist for your developer

  1. Do session cookies have Secure, HttpOnly and a deliberate SameSite value?
  2. Is anything sensitive stored directly in a cookie?
  3. Which cookies do third-party scripts set, and do we need them?
  4. Have cookie consent and notice requirements been checked with counsel?

The checklist is ours, based on the guide.

Limits

We did not read MDN's Set-Cookie reference or its third-party cookies article.

By Omnistu.

Sources

Previous
Content Security Policy (CSP) explained for site owners