F2 · cookie-flags
Protect the session cookie
- What it means
- Your homepage sets a session cookie without the Secure and HttpOnly flags. Secure keeps it on encrypted connections; HttpOnly keeps it away from scripts in the page, so an injected script can't read it.
- Evidence
Set-Cookie: PHPSESSID=…; path=/ ↑ no Secure, no HttpOnly- Expected
Set-Cookie: PHPSESSID=…; path=/; Secure; HttpOnly; SameSite=Lax- Fix
- Add the Secure and HttpOnly flags (and SameSite=Lax) to session cookies. In PHP: session.cookie_secure = 1 and session.cookie_httponly = 1.