Skip to content

Insecure cookie (ARCH325)

Key dotnet.security.insecure-cookie · Severity warning · Category security · CWE CWE-614

Cookies without the Secure flag can be transmitted over unencrypted HTTP connections. This lets network eavesdroppers capture session cookies.

Response.Cookies.Append("session", token, new CookieOptions
{
HttpOnly = true
});
Response.Cookies.Append("session", token, new CookieOptions
{
HttpOnly = true,
Secure = true,
SameSite = SameSiteMode.Strict
});

Set Secure = true on all session and auth cookies, and enforce it globally via CookiePolicyOptions where possible.