1001Ferramentas
🍪 Security

Cookie __Secure-/__Host- Prefix Validator

Validate Set-Cookie headers against __Secure- and __Host- prefix rules from RFC 6265bis (Secure, Domain, Path).

The prefixes that make a cookie harder to forge

A session cookie can be overwritten by a compromised subdomain or over a plain HTTP connection, even when the main site is configured properly. The __Secure- and __Host- prefixes exist to shut that door: when a cookie name starts with one of them, the browser only accepts it if certain conditions are met, and silently refuses it otherwise.

Paste one or more Set-Cookie headers, one per line, and the page checks each rule. For __Secure-, the Secure attribute is enough. For __Host-, the stricter of the two, three requirements apply at once: Secure present, Path equal to a single slash, and Domain absent. That combination is what binds the cookie to the exact host that set it, with no subdomain able to create or replace it.

The browser's refusal produces no visible error — the cookie simply does not appear, and the symptom is a login that will not stick with nothing in the console. That is why it pays to check the header before shipping. A cookie without a prefix is reported as such here: not an error, just no additional protection, and the validation limits itself to saying so.

Frequently asked questions

Is the prefix part of the cookie name?
It is. The cookie is literally called __Host-session, and that is how it arrives on the server side. There is no separate attribute: the prefix in the name is the mechanism itself, designed that way so older browsers simply treat it as an ordinary name.
Why does __Host- forbid Domain?
Because Domain is precisely what lets a cookie be shared across subdomains — and it is the route by which a compromised subdomain overwrites the main domain's cookie. Without Domain, the cookie stays pinned to the exact host that set it, which is the guarantee the prefix offers.
Does this replace HttpOnly and SameSite?
No, it addresses a different problem. HttpOnly stops JavaScript from reading the cookie, protecting against XSS. SameSite controls whether it is sent on requests coming from another site, mitigating CSRF. The prefixes govern who may write it. A well-configured session cookie usually carries all three.

Related Tools