Backend, Data & Security More detail A2 · Formal specification Platform: Web

Secure Cookie Attributes

Secure cookie attributes control how a cookie travels and whether scripts can read it. They also control cross-site use, which host and path receive it, and how long it lasts.

See how it works
You might call it cookie flagssession cookie hardening

See how it works

Original worked exampleSecure Cookie Attributes

Another example

A response sets `__Host-session` with `Secure; HttpOnly; SameSite=Lax; Path=/` and no `Domain`, then changes it after sign-in. A third-party payment return uses its own limited correlation cookie. It does not weaken every session cookie. Sign-out also ends the server session.

Main parts

  1. 01Name prefix and value
  2. 02Transport/script/site restrictions
  3. 03Scope and lifetime

Use it when

Give a cookie the smallest useful scope and life. Session cookies should normally use `Secure`, `HttpOnly`, a chosen `SameSite` mode, and a host prefix.

Do not use it when

`Path` is not a security wall. Do not set a wide `Domain` without need or put bearer secrets in script-readable cookies. Never use `SameSite=None` without `Secure`.

Name used in code

Set-Cookie: __Host-name=…; Secure; HttpOnly; SameSite=Lax/Strict; Path=/; Max-Age=…

Before you ship

Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.

Request you can copy

Outcome: Design or review Secure Cookie Attributes for this system while keeping data correct, secure, and easy to operate. User context: A response sets `__Host-session` with `Secure; HttpOnly; SameSite=Lax; Path=/` and no `Domain`, then changes it after sign-in. A third-party payment return uses its own limited correlation cookie. It does not weaken every session cookie. Sign-out also ends the server session. Technical concept or control: Secure Cookie Attributes. Why it fits: Give a cookie the smallest useful scope and life. Session cookies should normally use `Secure`, `HttpOnly`, a chosen `SameSite` mode, and a host prefix. Do not use it when: `Path` is not a security wall. Do not set a wide `Domain` without need or put bearer secrets in script-readable cookies. Never use `SameSite=None` without `Secure`. Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary): A formal document may still be a draft, release candidate, or final version. Check its status and browser or platform support. Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.

Check this request

Review the current use of Secure Cookie Attributes. Definition: Secure cookie attributes control how a cookie travels and whether scripts can read it. They also control cross-site use, which host and path receive it, and how long it lasts. Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, report the evidence you found, gaps, severity, and the smallest safe fix.

A2
How official is this term?

Formal specification

A published, versioned formal specification defines this term for the listed technical scope.

A formal document may still be a draft, release candidate, or final version. Check its status and browser or platform support.

Scope
Current HTTP cookie attributes and processing model
Document status
draft
Checked on
2026-07-30

Evidence sources & scope

Authority source + Term reference · IETF HTTP Working Group · draft Cookies: HTTP State Management Mechanism — 5.6 The Set-Cookie Header Field 5.6 The Set-Cookie Header Field Scope: Current HTTP cookie attributes and processing model; direct scope: 5.6 The Set-Cookie Header Field Role here: Direct term reference Source covers: canonical name, definition, semantics, implementation Authority source · IETF HTTP Working Group · draft Cookies: HTTP State Management Mechanism Scope: Current HTTP cookie attributes and processing model Role here: Authority within stated scope Source covers: canonical name, definition, semantics, implementation Authority source · IETF · standards track HTTP State Management Mechanism Scope: HTTP cookies Role here: Authority within stated scope Source covers: canonical name, definition, semantics, implementation

Copy it yourself

The browser could not copy this. Select the request below and copy it yourself.