Join our Newsletter — 33% off our NHI Course
Authentication, Authorisation & Trust

Cookie Attributes

← Back to Glossary
By NHI Mgmt Group Updated October 29, 2026 Domain: Authentication, Authorisation & Trust

Cookie attributes are the flags and parameters attached to an HTTP cookie that control how browsers store, send, and protect it. Common attributes include Secure, HttpOnly, SameSite, Path, Domain, Expires, and Max-Age, which govern transport, script access, scope, and lifetime.

Cookie attributes are the policy controls attached to a cookie when it is issued. They tell the browser when to send the cookie, whether scripts can read it, which paths and domains may receive it, and how long the cookie should persist.

These settings shape the security boundary of the cookie itself. A cookie that is intended for an authenticated session behaves very differently from one used for preferences or analytics, so the attribute set must match the cookie’s purpose rather than relying on default browser behaviour.

The main security value of cookie attributes is that they reduce accidental exposure. Cookie Security Guide covers the safe use of Secure, HttpOnly, SameSite, Domain, Path, and cookie prefixes for session protection. Attributes can stop a cookie from being sent over cleartext transport, limit script access, and constrain where it is valid inside an application.

That matters because cookies often carry session state. If a sensitive cookie is accessible to JavaScript, sent too broadly across subdomains, or accepted in unsafe cross-site contexts, an attacker may gain a path to session theft, request forgery, or scope confusion. The attribute set is therefore part of the trust model, not just a formatting detail.

Secure limits transmission to HTTPS, which protects the cookie in transit. HttpOnly blocks access from client-side script, which reduces the value of a script injection or stolen DOM context. SameSite changes when the browser sends the cookie in cross-site requests, which helps limit cross-site request forgery and related abuse.

Path and Domain define the cookie’s scope. A broad Domain value can expose a cookie to more hosts than intended, while a narrow Path can keep a cookie tied to only one application area. Expires and Max-Age determine lifetime, which affects how long a stolen or misplaced cookie remains useful.

Modern hardening also uses the __Host- and __Secure- prefixes, plus newer patterns such as partitioned cookies, to make unsafe combinations harder to deploy. These conventions do not replace good application design, but they help browsers enforce safer defaults.

Cookie attributes are most effective when they match the type of data stored in the cookie. A session cookie, a preference cookie, and a tracking cookie should not share the same security posture. Sensitive cookies should be short-lived, narrowly scoped, and protected against script access and unwanted cross-site delivery.

They also need to be paired with server-side discipline. If the server accepts a cookie over the wrong origin, trusts a broad domain boundary, or keeps sessions alive too long, the browser settings only partially reduce exposure. Good cookie hygiene is therefore a joint browser-and-application control.

Subdomain Takeover Response Playbook is relevant where a broad Domain cookie might still be sent to hosts that should no longer exist or be trusted. That connection makes cookie scope review part of wider domain and subdomain hygiene.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP ASVS, NIST SP 800-53 Rev 5 and CIS Controls v8 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
OWASP ASVSV7 — Session ManagementCookie attributes directly shape session handling, transport, and lifetime controls.
Recommendation — Set Secure, HttpOnly, SameSite, and expiry rules for session cookies.
NIST SP 800-53 Rev 5SC-23 — Session AuthenticityCookie attributes help protect browser session tokens from disclosure and misuse.
IA-5 — Authenticator ManagementCookie lifetimes and handling affect the lifecycle of authentication material.
Recommendation — Bind session cookies to protected transport and reduce script exposure. Limit the lifetime and handling of cookie-based authentication material.
ISO/IEC 27001:2022A.8.24 — Use of cryptographySecure transport for cookies supports protection of sensitive authentication data in transit.
Recommendation — Protect cookie-bearing traffic with strong encrypted transport.
CIS Controls v8CIS-6 — Access Control ManagementCookie scope and browser delivery rules influence who can access protected application state.
Recommendation — Restrict cookie scope so only intended applications and paths receive it.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 29, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org