🔐HttpOnly Cookie
Also known as HttpOnly, HttpOnly Flag, HttpOnly Attribute
A cookie setting. Scripts on the page can never read the cookie.
Think of it like
Think of it like a sealed letter. The postman can carry it, but he cannot read it.
Example
A bad comment on Jack's site runs a script that tries to read each reader's cookies. The login cookie is HttpOnly, so the script gets nothing it can use.
Why it matters
It keeps the login safe even when a script gets in. The script can act on the page, but cannot carry the login away.
Definition
Example code
http
Set-Cookie: session=7f3a9c; HttpOnly; SecureCommon mistake
Key takeaways
- 1Hidden from scripts. Page code cannot read it.
- 2Still sent. The browser adds it to requests.
- 3Not a cure. XSS still needs output encoding.