Skip to content

Cookie security checker

Free, no sign-up Runs in your browser

Paste Set-Cookie headers and check each cookie for Secure, HttpOnly and SameSite, the __Host- and __Secure- prefix rules, Domain scope, lifetime, Partitioned.

One header per line, with or without the Set-Cookie: name. Replace real session values before you paste, if you prefer: only the attributes are checked.

Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.

How to use the cookie security checker

  1. Copy the Set-Cookie headers from curl -sI or from your browser’s Network tab.
  2. Paste them, one header per line. You can replace the values first: only the attributes are checked.
  3. Read the table for each cookie’s flags, scope and lifetime.
  4. Work through the findings, worst first.

About this tool

A session cookie is a password that the browser sends for you with every request. Three attributes decide how exposed it is. Secure keeps it off plain HTTP. HttpOnly hides it from JavaScript, so a cross-site scripting bug cannot read it. SameSite controls whether it travels with requests that start on another site, which is the basis of cross-site request forgery.

Scope and naming matter too. A Domain attribute shares the cookie with every subdomain, so a weaker subdomain can read or overwrite it. The __Host- name prefix is the strongest setting available: browsers accept such a cookie only with Secure, Path=/ and no Domain, which pins it to one host. __Secure- only requires Secure. A cookie that breaks its prefix rule is rejected, so the name is a guarantee rather than a hint.

The checker reads each Set-Cookie header and reports which protections are missing, with the fix. Not every finding applies to every cookie: a CSRF token that scripts must read cannot be HttpOnly, and a cookie used inside an embed needs SameSite=None. Treat the output as a list of rules to weigh, not a verdict on the application.

Sources

Questions

What are the Secure and HttpOnly cookie flags?

Secure tells the browser to send the cookie over HTTPS only, so it cannot be read on the network. HttpOnly keeps it out of document.cookie, so scripts, including injected ones, cannot read it. A session cookie should have both.

Which SameSite value should I use?

Lax suits most session cookies: the cookie is sent when the user follows a link to your site, but not with cross-site form posts or embedded requests. Strict never sends it cross-site. None sends it everywhere, requires Secure, and is only for cookies that must work inside another site.

What is the __Host- cookie prefix?

A cookie whose name starts with __Host- is accepted by browsers only if it is Secure, has Path=/ and has no Domain attribute. That ties it to the exact host that set it over HTTPS, so a subdomain or a network attacker cannot plant or replace it.

What does the Partitioned attribute do?

Partitioned opts a third-party cookie into a separate cookie jar for each top-level site (CHIPS). An embedded service keeps its state inside each site that embeds it but cannot track a user across sites. It requires Secure.

Related tools