Louisville Institute of Technology (LIT) – Louisville, KY

Louisville Institute of Technology builds practical AI, automation, cybersecurity, and workforce technology learning through real implementation and human-centered systems.

One Session Cookie, Three Separate Controls: Secure, HttpOnly, SameSite

Premium isometric illustration of a Louisville secure-app workbench with one session cookie protected by three distinct shields labeled by symbol, no secrets shown

Secure, HttpOnly, and SameSite are not three names for the same protection. Each changes a different browser behavior.

OWASP’s Session Management Cheat Sheet recommends deliberate cookie controls for session identifiers. A strong configuration still does not replace server-side authentication, authorization, session rotation, expiration, CSRF defenses, secure coding, or repair of an underlying vulnerability.

The three-control map

Attribute Primary job What it does not prove
Secure Restricts the cookie to encrypted HTTPS requests The application has no XSS, CSRF, authorization, or server compromise
HttpOnly Prevents browser scripts from reading the cookie through document.cookie Malicious script cannot act through the user’s browser or send authenticated requests
SameSite Controls when the browser sends the cookie with cross-site requests Complete CSRF defense or correct authorization

Build safely in an owned app

  1. Use a local, isolated, or explicitly authorized application and synthetic accounts.
  2. Open browser developer tools and inspect only the cookie attributes—never copy the session value into notes, screenshots, public AI, or source control.
  3. Confirm HTTPS and the Secure attribute in the intended environment.
  4. Confirm HttpOnly when client-side script does not need access.
  5. Choose SameSite=Strict, Lax, or a justified None; Secure from the actual cross-site workflow.
  6. Keep server-side authorization and an appropriate CSRF defense.
  7. Repair the configuration, invalidate test sessions, and retest from a fresh browser context.

Evidence without secrets

Evidence field Safe record
Environment Local, isolated lab, or exact owned application—not a private production URL
Observed attributes Present or missing; never the cookie value
Expected policy Approved configuration and its reason
Repair Code/config change and responsible reviewer
Retest Fresh-context result and old-session rejection where applicable
Stop point Unknown ownership, exposed secret, broken workflow, or unauthorized target

Example pattern

OWASP shows a host-scoped pattern such as __Host-SessionID=<value>; Secure; HttpOnly; SameSite=Strict; Path=/. Do not paste a real value into a tutorial. The __Host- prefix has additional browser-enforced rules; it is not a decorative name.

AI boundary

Use AI to review a synthetic header or a redacted configuration pattern. Do not provide production cookies, credentials, private configuration, customer data, undisclosed vulnerabilities, or access routes to a public AI service. A responsible human owns the policy, test authority, repair, release, and rollback.

Repair, retest, preserve

After repair, invalidate the test session, sign in again, verify the expected attributes, exercise the authorized workflow, verify server-side authorization, and preserve only redacted evidence. If a required cross-site flow breaks, roll back or hold release and redesign from the documented requirement.

Primary source

OWASP — Session Management Cheat Sheet.

One Session Cookie, Three Separate Controls: Secure, HttpOnly, SameSite

Discover more from Louisville Institute of Technology (LIT) - Louisville, KY

Subscribe to get the latest posts sent to your email.

Scroll to top