Security

Login cookies are hidden from scripts on the page

security.session-cookie-readable-by-scripts

Why this matters

A session cookie marked HttpOnly can be sent to the server but cannot be read by JavaScript running on the page. Without that flag, any script that ends up on the site — through a compromised plugin, a hijacked advert, or a comment field that did not escape its input — can read a logged-in session and use it from somewhere else. It is the difference between a script injection being an embarrassment and being an account takeover.

Who fixes it

A developer

Roughly how long

30 minutes

Care needed

Low risk to change

How to fix it

Set HttpOnly wherever the session starts: `session.cookie_httponly = 1` in PHP, `httpOnly: true` in Express, `SESSION_COOKIE_HTTPONLY` in Django. If a script on your own site genuinely needs to read the session, that is worth looking at separately — it almost never does.

How we score it

Failing this check takes up to 15 points off your security score. It is a fact about your site rather than a measurement, so it reads the same on every scan until you change something.

Does your site pass this one?

This check runs on every scan, along with the other 106. Free, no account, and you see the evidence for each result.

Check my site

Other security checks

See all 107 checks