Description
Browser scripts can read cookies that do not have the HttpOnly attribute.
Potential impact
XSS can expose the value of a session or authentication cookie.
Remediation
Set CookieOptions.HttpOnly = true on cookies that client-side scripts do not need to read.
Examples
Before
csharp
response.Cookies.Append("sid", value);
After
csharp
response.Cookies.Append("sid", value, new CookieOptions { HttpOnly = true });
Check the response’s Set-Cookie header for the HttpOnly attribute on sid.