Cookie

Security

// Definition

A small name-value string the browser stores and automatically attaches to every request matching the cookie's domain and path. Set by the server via the Set-Cookie response header; read by the server from the Cookie request header; readable by JavaScript via document.cookie unless the HttpOnly flag is set. Key security attributes: HttpOnly (blocks JS access, mitigating XSS token theft); Secure (HTTPS-only transmission); SameSite (controls cross-site attachment — Strict, Lax, or None); Domain and Path (request scope). QA testing checklist: session cookies must have HttpOnly and Secure; auth cookies should be SameSite=Lax or Strict; sensitive data should not be stored in cookie values unencrypted; cookies should expire or be cleared on logout.

// Related terms