Join our Newsletter — 33% off our NHI Course

How should teams handle cookies that do not explicitly set Secure, HttpOnly, and SameSite?

Treat missing cookie flags as a security decision, not a harmless omission. If a cookie carries session or identity state, require Secure, HttpOnly, and SameSite unless a specific workflow justifies an exception. The important control is explicitness, because the application is defining the browser trust boundary at issuance time.

When a cookie carries session state, authentication state, or any other bearer value, the browser is not just storing data, it is enforcing part of the application’s trust boundary. Omitting Secure, HttpOnly, or SameSite leaves that boundary implicit, which makes the cookie easier to misuse and harder to reason about during reviews, incident response, and testing.

The right mental model is not “the cookie still works,” but “what authority does this browser-stored value confer, and under what conditions can it be sent, read, or replayed?” That question determines whether the cookie belongs in transit only, whether script access must be blocked, and whether cross-site requests should be allowed at all.

For session or identity cookies, the safest default is to require all three flags unless a specific workflow needs an exception. That is consistent with cookie hardening guidance and with transport and access control expectations in NIST Cybersecurity Framework 2.0, which both push teams toward explicit control over how state is protected and used.

What each flag protects, and what you lose when it is absent

Secure tells the browser to send the cookie only over HTTPS. Without it, the cookie may be exposed on any downgraded or mixed transport path, which is especially dangerous for authentication state because a copied cookie can often be replayed as a live session.

HttpOnly blocks access from JavaScript running in the page context. Without it, any script that reaches the origin, whether through a bug, injected content, or an unsafe dependency, can read and exfiltrate the cookie value.

SameSite controls whether the browser sends the cookie on cross-site requests. Without it, the browser may attach the cookie more broadly than intended, which increases the chance that a cross-site request can act with the user’s authenticated context. Teams can compare that exposure against the access-boundary expectations described in NIST Cybersecurity Framework 2.0, especially where the browser becomes a trust decision point.

These flags are not interchangeable. Secure protects transport, HttpOnly protects script visibility, and SameSite protects cross-site request behavior. A cookie missing one of them is not automatically broken, but it is incomplete unless the application has explicitly designed around the gap.

How teams should handle exceptions without normalising weak cookies

The practical rule is simple: if the cookie helps establish identity, session continuity, or privileged browser state, default to setting all three flags and treat any omission as a conscious exception. That exception should be tied to a documented workflow, not to convenience or legacy habit.

Use exceptions only when the application genuinely depends on cross-site behaviour or client-side access, and then scope the exception tightly. For example, a temporary workflow cookie may need different handling than a long-lived session cookie, but the review should still ask whether the cookie can be shortened, isolated, or split into separate state objects instead of weakening the main session cookie.

For teams standardising web controls, OWASP cookie guidance is the right baseline for browser-facing state, while OWASP API Security Top 10 is useful when the same application also exposes tokens or session-bound API flows that need distinct handling. The common practitioner error is to treat a working cookie as a compliant cookie.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP ASVS and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP ASVS V7 — Session Management Cookie flags directly affect session cookie handling and browser session state protection.
V10 — OAuth and OIDC If cookies back federated sessions, same-site and transport protections influence token and session handling.
Recommendation — Enforce secure session cookie attributes and reject session cookies missing required protections. Align browser session-cookie handling with federated auth flow requirements.
NIST CSF 2.0 PR.AA-05 — Enforce Least Privilege Cookie scope should be minimized so browser-held state only enables necessary access.
PR.DS-02 — Protect Data-in-Transit Secure controls whether the cookie can traverse unprotected transport paths.
Recommendation — Minimize cookie authority and restrict each cookie to the smallest necessary access path. Require TLS-backed transport for any cookie that carries sensitive state.

Practitioner Guidance

What to verify: Check which cookies actually carry session, authentication, or privilege state, then confirm that each one has an explicit security decision recorded for transport, script access, and cross-site behavior. If the cookie is only harmless preference data, the bar can be lower, but it should still be intentional.

Decision rule: If a cookie can authorize an action, authenticate a user, or restore a session, require Secure, HttpOnly, and an explicit SameSite choice unless a documented workflow exception is approved. If it cannot, keep the review lightweight but still require clarity about why the flags were omitted.

Common mistake: Teams often fix missing flags only on the login cookie and leave auxiliary session cookies, remember-me cookies, or application state cookies untreated. That creates uneven protection and makes the weakest cookie the easiest path into the account flow.

Practitioner takeaway: The goal is not “all cookies look the same,” it is “every cookie that carries authority has an explicit, reviewable browser trust decision attached to it.”