Cookie Security Flags: Secure, HttpOnly, and SameSite Explained

Check your own app — free, in about a minute.

The free mini-scan checks your live homepage for TLS/HTTPS basics, response security headers, cookie flags, exposed sensitive files, Firebase/Supabase backend rules, and the WordPress plugin versions your site exposes. You get a score and the finding titles — no account, no card.

Run the free mini-scan →

Cookie Security Flags: Secure, HttpOnly, and SameSite Explained

Cookies carry sessions, auth tokens, and preferences. Three tiny flags on each cookie decide whether those values survive the two most common web attacks. AI-generated apps get the cookies working and stop there — which is why missing cookie flags are among the most frequent findings in automated scans. A passive scan flags a missing Secure flag as high severity, and missing HttpOnly or SameSite as medium. Here's what each flag does and how to check yours.

How to check your cookies right now

In Chrome: DevTools → Application tab → Storage → Cookies → click your site. Look at the columns for each cookie: checkmarks (or values) under Secure, HttpOnly, and SameSite. Any session or auth cookie missing one of these is a finding.

From the terminal, you can see exactly what your server sends:

curl -sI https://your-app.com | grep -i set-cookie

You'll see lines like:

Set-Cookie: session=abc123; Path=/; HttpOnly; SameSite=Lax

Now read that line like an attacker would.

1. Secure — "only send this over HTTPS"

What it does: tells the browser to never transmit the cookie over plain HTTP. Without it, one request over an insecure network — a coffee-shop Wi-Fi, an SSL-stripping proxy — leaks the session token in the clear, and the attacker is now logged in as your user.

What good looks like: every cookie set over HTTPS carries ; Secure. If your site is HTTPS-only (it should be), there's no reason not to set it. Frameworks differ on defaults — some set Secure automatically in production mode, some don't, and AI-generated code rarely overrides the default either way. Check; don't assume.

2. HttpOnly — "JavaScript can't touch this"

What it does: blocks client-side JavaScript from reading the cookie. This is your containment line against cross-site scripting: if an attacker manages to run script on your page, HttpOnly means they still can't steal the session cookie with document.cookie.

What good looks like: ; HttpOnly on every cookie that your frontend JavaScript doesn't explicitly need to read. The honest question is: does your JS actually read this cookie? Session and auth tokens almost never need JS access — set the flag. The one common exception is a cookie your SPA reads directly (like a UI preference); those stay readable, and the real secret moves to an HttpOnly cookie.

Why AI builders miss it: the AI sets cookies to make auth work. The demo passes. Nobody asked for HttpOnly, so it isn't there — and the resulting XSS-to-account-takeover chain is invisible until someone looks.

3. SameSite — "don't send this on cross-site requests"

What it does: controls whether the browser attaches the cookie to requests that originate from other sites. This is the flag that blunts cross-site request forgery (CSRF).

What good looks like: an explicit SameSite value on every cookie — Lax at minimum. A missing SameSite attribute leaves the decision to browser defaults, which vary, and a scanner flags each unattributed cookie as a medium finding.

The quick audit

Run through your cookies with this checklist:

  1. Every cookie set over HTTPS has Secure. (Missing = high severity.)
  2. Every session/auth cookie your JS doesn't read has HttpOnly. (Missing = medium.)
  3. Every cookie has an explicit SameSite value, Lax or Strict unless you have a real cross-site need. (Missing = medium.)
  4. Cookie names don't leak internals (sess_v2_prod_db tells an attacker about your stack; technology-disclosure headers get the same treatment).

It takes five minutes in DevTools and it closes two of the most exploited attack chains on the web.

What a scan adds

Cookie flags are one slice of a passive scan's cookie analysis. The same pass reads your security headers, validates your TLS certificate, checks that HTTP redirects to HTTPS, and probes for exposed /.env and /.git/HEAD files — then an agentic pass probes the live app like a low-grade attacker would. The PreShipIt scan ($29 one-time, no subscription) runs all of it against the URL you submit and writes the findings up in plain English, in priority order, with the fix for each.

The PreShipIt Brief — a short weekly email for people shipping vibe-coded apps: the week's important vulnerabilities and launch-safety checks, in plain English.

New and free. Double opt-in: we email you a confirmation link before anything else arrives. Unsubscribe any time.

Check your own app — free, in about a minute.

The free mini-scan checks your live homepage for TLS/HTTPS basics, response security headers, cookie flags, exposed sensitive files, Firebase/Supabase backend rules, and the WordPress plugin versions your site exposes. You get a score and the finding titles — no account, no card.

Run the free mini-scan →

← Back home · Run a free mini-scan · Scan my app — $29 · See a sample report