# The three labels on a cookie: Secure, HttpOnly, and SameSite
*articles*
Secure, HttpOnly, and SameSite are the three attributes on a login cookie, explained from an everyday comparison. This article covers the accident each one prevents, how V06 in vuln judges them (which names it evaluates, the 20-cookie limit, and its four findings), how to fix them, and what attributes alone cannot prevent. It also includes what we measured on our own site on 23 November 2026.


You know the word "cookie", but Secure, HttpOnly, and SameSite can still sound like a foreign language. When a scan result says "Cookie attributes", it is hard to know what to change.

The short answer is to think of these three as **labels attached to a cookie**. `Secure` means "send it only over https". `HttpOnly` means "do not let scripts read it". `SameSite` means "do not send it from another site". Without these labels, a cookie for a signed-in visitor can be used in ways you did not intend.

## What the three labels are

Picture a membership card. The card is one piece, but it carries small labels such as "carry only inside" or "the holder may read this". A cookie works the same way: the value comes with labels that say when it may be sent.

A cookie is a small string that a server hands to the browser with the `Set-Cookie` header. From the next request onward, the browser sends matching cookies back automatically. Cookie attributes (settings that narrow the conditions for sending a cookie) decide what "matching" means.

Each of the three attributes prevents a different accident.

- `Secure` … do not send it over plain HTTP
- `HttpOnly` … do not let JavaScript read it
- `SameSite` … do not send it on a request that started from another site

## Why it concerns you

The cookie that keeps a visitor signed in (the session cookie) is **the key to the account**. If someone else gets it, they can act as that visitor without knowing the password.

AI-built apps often come with a login component already wired in. That is convenient, but the cookie settings may still be the defaults, and they can be weaker in production. A change such as moving to your own domain and losing `Secure`, or never specifying `SameSite`, is easy to miss.

The three labels close three paths.

- a cookie travelling in plain text over HTTP
- a script mixed into the page reading the cookie
- another site making a signed-in visitor act against their intent

## Secure: send only over https

A cookie with `Secure` is sent only over HTTPS. It is not attached to HTTP pages or HTTP requests, which reduces the chances of it being read in transit.

`Set-Cookie: session=...; Secure; HttpOnly; SameSite=Lax`

During development you may run on `http://localhost`. If only production uses HTTPS, the `Secure` switch has to differ by environment. **Check the production setting once with the HTTPS URL before launch.**

## HttpOnly: keep it away from scripts

A cookie with `HttpOnly` cannot be read through JavaScript's `document.cookie`. If another script ends up on the page, this stops the cookie from being carried away as-is.

`HttpOnly` is not a cure-all, though. A script cannot read the cookie, but it can still **send requests as that visitor**. It does not prevent XSS (scripts mixed into the page) itself.

Cookies that the page's own JavaScript reads and writes, such as a consent banner or a display preference, cannot use `HttpOnly`. It helps to treat the login cookie and the convenience cookie as two different things.

## SameSite: do not send it from another site

`SameSite` decides whether a cookie is attached to a request that started from another site. It is the label that reduces accidents such as being signed in to a bank and having another site's button trigger a transfer.

- `SameSite=Lax` … send it on ordinary link navigation; do not send it in embeds or cross-site form posts
- `SameSite=Strict` … do not send it on requests that started from another site; arriving from an external link may look signed out for a moment
- `SameSite=None` … send it to other sites too; `Secure` is required

When in doubt, `Lax` is the baseline. Consider `Strict` for especially important actions such as payments or settings changes. Use `None` only when a widget really has to work inside another site.

Some browsers now treat an unspecified cookie like `Lax`. That is **not a reason to leave it unspecified**. Older browsers and other paths behave differently, so being explicit is safer.

## How it looks in vuln

vuln ([a free check that runs on a public URL](/en/vuln)) shows cookie attributes as one row, V06.

- V06 Cookie attributes (area: Cookie, priority 3)

V06 looks at the `Set-Cookie` headers in the top page's response. It does not show values; it checks only the cookie name and attributes.

Only cookies with session-like names are evaluated: a name containing `session`, `sid`, `auth`, `token`, `jwt`, `connect.sid`, or `__session`. The limit is 20 cookies; if there are 21 or more, V06 becomes "Not checked".

There are four judgments. All of them become "Needs work"; none stops at "Check".

- `Secure` or `HttpOnly` is missing: needs work (severity high)
- `SameSite` is missing: needs work (severity medium)
- `SameSite=None` without `Secure`: needs work (severity high)
- the `Domain` attribute contains a dot: needs work (severity medium)

For `Domain`, it only treats the value as a parent-domain setting. It does not check which subdomains actually receive the cookie. **Read it as a sign of a missing setting, and confirm the header yourself at the end.**

## A measurement from our own site

On 23 November 2026 we checked this site's response headers with `curl -sSI https://ismyappok.com` and `curl -sSI https://ismyappok.com/ja`. Neither response had a `set-cookie` line.

So on the public top page there is no cookie for V06 to evaluate, and the result is "Pass". That does **not** mean the cookie settings are perfect. Pages that require login are outside vuln's scope; a session cookie there would not be visible to V06.

This site's consent banner writes `ismyappok_consent` with JavaScript after the visitor chooses. In the implementation, the cookie has `Path=/`, `Max-Age=15552000` (180 days), `SameSite=Lax`, and `Secure` on HTTPS. It has no `HttpOnly`, because the page itself must read and write it; it is a preference cookie, not a login key. Its name is not session-like either, so V06 does not evaluate it.

## How to fix it

Where a cookie is issued depends on your framework or login component. The official steps are here.

- [MDN's official Set-Cookie documentation (English)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie)
- [MDN's official SameSite documentation (English)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite)
- [OWASP's Session Management Cheat Sheet (English)](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html)
- [Next.js's official cookies documentation (English)](https://nextjs.org/docs/app/api-reference/functions/cookies)

The basic move is to add the three labels in the one place that issues the session cookie. In Next.js, pass `httpOnly: true`, `secure: true`, and `sameSite: "lax"` to `cookies().set()`. Other frameworks have the same three settings in their session configuration.

Add `Domain` only when you need it. Without it, the cookie goes to that host alone. Set it only when there is a clear reason, such as sharing a login across subdomains.

If you already force HTTPS, that setting is the premise for `Secure`. [HSTS and always-on HTTPS](/en/articles/hsts-and-http) covers the redirect, and [Security headers, explained](/en/articles/security-headers) covers where to return headers.

## What cookie attributes do not prevent

The three labels do not complete the safety of a login on their own.

With `HttpOnly`, an XSS can still act as the visitor from that page. `SameSite` does not stop every cross-site attack either. Pair important actions with a confirmation token or a re-authentication step.

vuln's V06 looks only at `Set-Cookie` on the public top page. It does not look at `Max-Age`, `Path`, the cookie value itself, or pages behind a login. **A pass means "nothing was found in that range".**

## Wrapping up

The three labels sound technical, but the work is simple: add all three in the one place that issues the session cookie. Start with V06 in vuln; if it says "Needs work", check `Secure`, `HttpOnly`, and `SameSite=Lax` in that order.

The fixes are collected on these pages.

- [Cookie attributes](/en/checks/cookie-attributes)
- [Caching pages that set cookies](/en/checks/cache-with-cookies)
- [Content-Security-Policy (CSP)](/en/checks/csp)

When you have changed the settings, [run vuln](/en/vuln) again. You can check display and links before launch with [audit (no login)](/en/audit) as well.

This article is based on checking our own site's settings. We did not scan anyone else's site for it. The numbers are recommended values and implementation thresholds; the only measurements are the ones with the date and method given in the text.

## Check your own site
Enter a URL and see what is missing before launch. Free, and no login required.
[Run the free check](https://ismyappok.com/en/audit)