How to fix: SameSite=None cookie on HTTP page
Cookies set with SameSite=None but without the Secure flag are rejected by browsers, but client-side code can still emit them on HTTP origins. The cookie then flows cross-site over insecure transports.
Why it matters
Cross-site requests over HTTP can carry the cookie, enabling CSRF and session hijacking on downgrade.
The `code-cookie-samesite-none-http` check verifies that the server does not expose the `cookie-samesite-none-http` weakness in the code category. The detection runs against the response headers, body, or auxiliary probes (DNS, TLS, async fetch) as appropriate.
How to fix it
- 1Pair SameSite=None with Secure; on the same origin.
- 2Use SameSite=Lax or Strict for any cookie that does not need cross-site delivery.
- 3Set cookies from the server via Set-Cookie, not document.cookie.
Code examples
SameSite=None requires Secure flag
// SameSite=None without Secure is rejected by modern browsers
// and sends cookies over HTTP (insecure)
// BAD:
// Set-Cookie: session=abc; SameSite=None
// GOOD (if cross-site cookie is required):
res.setHeader("Set-Cookie",
`session=${token}; SameSite=None; Secure; HttpOnly; Path=/`
);
// Only use SameSite=None for legitimate cross-site scenarios (e.g., embedded widgets)References
Detected automatically by VulnRadar. The check id is code-cookie-samesite-none-http, stable across every scan so you can filter or diff on it.
More code checks
- CriticalForm Submits Data Over Insecure HTTP
- MediumPotential Prototype Pollution Sinks Detected
- HighPotential Command Injection Vectors
- HighJWT Decoded Without Signature Verification
- HighPotential Path Traversal Vulnerability
- HighInsecure Authentication Mechanisms Detected
- HighPotential Insecure Deserialization
- Mediumeval() Usage in Inline Scripts
Questions
- How severe is SameSite=None cookie on HTTP page?
- VulnRadar rates this high severity in the code category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id code-cookie-samesite-none-http, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does SameSite=None cookie on HTTP page map to?
- It maps to CWE-1275. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.