Detector registry

Cookie Security Attributes: Secure and HttpOnly

How LaunchTrust reads the Set-Cookie headers on your page for Secure and HttpOnly, why session cookies need both, and how to set them.

Updated 11 Nov 2026httponly secure cookie flagsSignals, not a verdict

Most web apps set at least one cookie on their first response: a session ID, a sign-in token, a theme preference. Two attributes decide how exposed those cookies are. Secure keeps a cookie off plain HTTP connections, and HttpOnly hides it from page scripts. Leaving them out is a one-line mistake with an outsized cost: a single script-injection bug can then read a sign-in token straight out of document.cookie.

This page explains what LaunchTrust reads, how it decides whether a cookie is a session cookie, and how to fix what it finds.

What LaunchTrust checks

LaunchTrust reads every Set-Cookie header in the response to your public page, including the redirects on the way to it (for example from http:// to https://). It keeps cookie names and attributes only; cookie values are never stored or shown.

  • Detected: every cookie on an HTTPS page carries Secure, and every session or sign-in cookie also carries HttpOnly.
  • Not detected (medium): a session or sign-in cookie lacks HttpOnly, or lacks Secure on an HTTPS page. Names such as sessionid, PHPSESSID, connect.sid, laravel_session and *_session count as session cookies, as do names with a segment such as auth, token, jwt, sid, session or remember (for example auth_token or remember_me). A medium result counts as a gap.
  • Not detected (low): only non-session cookies lack Secure on an HTTPS page. It is listed in the report but not counted as a gap.
  • Unable to determine: the response set no cookies, so there was nothing to check; or the only session cookies missing an attribute are set for a parent domain, which browsers keep or refuse by the Public Suffix List. LaunchTrust reads up to 1,000 Set-Cookie headers; a response that sets more is also reported as unable to determine when the first 1,000 show no problem.

CSRF cookies (csrftoken, XSRF-TOKEN) are only checked for Secure, because frameworks often read them from JavaScript on purpose. Cookies that are being deleted (a Max-Age of zero or less, or an Expires date in the past without a valid Max-Age) are ignored.

Cookies that browsers refuse to store are ignored too:

  • a name and value that together exceed 4,096 bytes;
  • SameSite=None without Secure;
  • a __Secure- or __Host- cookie that breaks the rules of its prefix;
  • a Domain that is not the address that set it or a parent of it, or is a top-level domain such as com or a known suffix such as co.uk;
  • Secure sent over plain HTTP.

Each cookie is judged against the address of the response that set it, including redirects. A cookie for a parent domain (such as Domain=example.com set by shop.example.com) is kept or refused by the Public Suffix List, which LaunchTrust does not evaluate (a hosting platform's domain such as vercel.app is a public suffix), so a gap that depends on such a cookie gives unable to determine. Cookies set later by JavaScript, or by pages other than the scanned one, are not visible to this check.

Why it matters

  • HttpOnly limits the damage of a script injection. If an attacker gets JavaScript onto your page, HttpOnly cookies stay out of its reach, so the session cannot simply be copied.
  • Secure keeps cookies off unencrypted connections. Without it, a browser sends the cookie over plain HTTP when a visitor follows an old http:// link before your redirect, the same window the HSTS header closes.
  • It is a standard review item. OWASP's session-management guidance and most security questionnaires ask for both attributes on session cookies.

A concrete example

A response LaunchTrust reports as not detected (medium):

set-cookie: sessionid=…; Path=/
set-cookie: theme=dark; Path=/

The fixed version, reported as detected:

set-cookie: sessionid=…; Path=/; Secure; HttpOnly; SameSite=Lax
set-cookie: theme=dark; Path=/; Secure

How to address it

  1. Find where the cookie is set. Session cookies usually come from your framework's session or auth library, not from your own code.
  2. Turn on the framework setting. For example SESSION_COOKIE_SECURE and SESSION_COOKIE_HTTPONLY in Django, the secure and httpOnly cookie options in Express, or the cookie settings of your auth provider.
  3. Add Secure to every other cookie your HTTPS site sets, and consider SameSite=Lax as a sensible default.
  4. Check the response again. In your browser's developer tools, open the page's response headers and confirm each Set-Cookie line carries the attributes.

Monthly check and monitoring scope

List your app for free and LaunchTrust runs all 38 website detectors on its public website once a month, then emails you how many gaps it found. Which gaps they are, the evidence and how to close them come with paid monitoring or a one-time Launch Audit.

Paid monitoring runs all 40 detectors (38 for websites and 2 for App Store and Google Play listings) and shows each finding with its evidence. Each monitored web app is re-scanned about every 24 hours (with ±6 hours of jitter); email alerts and an optional JSON webhook POST report new gaps.

FAQ

Does LaunchTrust see the values of my cookies? No. It reads each Set-Cookie header for the cookie's name and attributes and discards the value. Reports list cookie names only.

Why is my CSRF cookie not flagged for missing HttpOnly? Many frameworks let JavaScript read the CSRF token on purpose so it can be sent back in a request header. Requiring HttpOnly there would break those apps, so CSRF cookies are only checked for Secure.

Does this check cover cookies set by analytics tags? No. It only sees cookies in the HTTP response to the scanned page. Tracking cookies are covered by the tracking-before-consent check.

Does setting these attributes mean my app passes a security review? No. They close one common gap. LaunchTrust reports signals, not a verdict; it is a compliance aid, not legal advice or certification.

Compliance aid, not legal advice. LaunchTrust reports signals, not a verdict or certification.