Pcornel
Security · Web Security

Cookies

Cheat sheet · https://pcornel.dk/topic.php?topic=4751

Back to the Topic

Answer

Cookies store session and state data in the browser. Mark session cookies Secure, HttpOnly and SameSite, scope them to the right domain and path, and give them sensible lifetimes.

Remember

  • Set Secure, HttpOnly and SameSite on session cookies.
  • Scope domain and path narrowly.
  • Use sensible lifetimes.

First checks

  • curl -sI https://<site> | grep -i set-cookie — cookie flags
  • Secure, HttpOnly, SameSite on session cookies — flags
  • __Host- prefix — scoping

Verify in this order

server Set-Cookie → browser stores with flags → sent per rules

Where it usually breaks

First mismatch in asset/subject identity → trust/authentication → authorization/policy → enforcement/control → telemetry/detection → protected outcome/response; preserve identity/policy/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4751

Confirmation

Confirm action

Continue?