Secure attribute
A cookie attribute that tells the browser to send the cookie only over encrypted HTTPS connections.
A session cookie sent over plain HTTP can be captured and reused.
In more detail
Without it, a session handle could travel in plain text over an unencrypted connection and be read by anyone on the network path. Set it on every cookie that carries a session or other sensitive value.
Examples
In the browser: It stops the cookie leaking over plain HTTP, where anyone on the network could read it.The course's unsafe defaults include cookie_secure set to false.Related terms
- cookie — A small named value a server asks a browser to store and send back automatically on later matching requests.
- TLS — The encryption that protects data travelling over a network, the S in HTTPS.
- HttpOnly — A cookie attribute that stops scripts running in the page from reading the cookie, while the browser still sends it on requests.
- HTTP — The protocol web browsers and web servers use to send requests and responses.
Taught in
- Cookies And CORS — Modern API Architecture: REST, GraphQL & gRPC
- Basic Auth, Tokens And Sessions — Modern API Architecture: REST, GraphQL & gRPC
- Client Storage Paradigms: Cookies, Storage Tradeoffs — Frontend Architecture & Web Platform
- Session Management: Secure Cookies & Token Validation — Next.js 15 & Modern App Router Architecture
- Secure Defaults — Application Security & Threat Modeling for Engineers