Why it matters
- A session cookie is the key to a visitor's session: their cart, their account. RFC 6265bis gives two attributes to guard it.
HttpOnly“limits the scope of the cookie to HTTP requests”, so page scripts cannot read it.Securelimits it to secure channels, so it does not travel over plain HTTP. - Without
HttpOnly, one injected script, from a compromised plugin or a third-party tag, can read the session and use it elsewhere. - Without
Secure, a visitor who opens anhttp://link (on a network that watches) sends the session in clear. SameSite=NonewithoutSecureis refused outright by current browsers: the cookie is not stored, and whatever needs it (an embedded checkout, a login across sites) fails.
How to fix
Set the flags where the session cookie is made:
http
Set-Cookie: PHPSESSID=…; Path=/; Secure; HttpOnly; SameSite=Lax- PHP:
session.cookie_httponly = 1andsession.cookie_secure = 1in php.ini, orsession_set_cookie_params. - Laravel:
'http_only' => trueand'secure' => trueinconfig/session.php. Express:cookie: { httpOnly: true, secure: true }. - Leave the CSRF token cookie (
XSRF-TOKEN) readable: the page's own script must send it back. This check does not ask forHttpOnlythere.
How we detect
- We read every
Set-Cookieheader of the page's own response. Cookies set by scripts, or by other requests of the page, are not read. - A cookie is a session cookie by its name: the common platforms' (
PHPSESSID,JSESSIONID,ASP.NET_SessionId,connect.sid,laravel_session,sessionid,ci_sessionand others), or a name built onsess,sessionorsession_id. CSRF tokens are left out. - A session cookie without
HttpOnlyis reported; on an HTTPS page, one withoutSecuretoo. Any cookie withSameSite=Noneand noSecureis reported.
A cookie's value is never shown in the report. Preference and analytics cookies are not judged.