On this page
What this issue is
A cookie is a small piece of data your site stores in a visitor's browser. Three optional attributes control how safely it behaves.
| Attribute | What it does | Risk if missing |
|---|---|---|
| Secure | Browser only sends the cookie over HTTPS | Cookie can travel over plain HTTP and be intercepted |
| HttpOnly | JavaScript cannot read the cookie | An injected script (XSS) can steal the session |
| SameSite | Limits sending the cookie on cross-site requests (Lax, Strict or None) | Easier cross-site request forgery (CSRF) attacks |
The flags matter most for session, login, cart and admin cookies. Marketing cookies such as _ga or _fbp are meant to be read by scripts, so they will not have HttpOnly. That is normal.
Why it costs you leads or sales
A stolen session cookie can let someone act as a logged-in customer or admin. That can mean hijacked accounts, defaced pages, redirected forms or injected scripts that skim leads. Security scanners and some enterprise buyers also flag missing flags during reviews, which can slow a deal. The impact is medium: it rarely breaks a funnel by itself, but it makes other attacks more damaging.
- Visitor logs inSession cookie is set without flags
- Script injectedVia XSS or a compromised third-party tag
- Cookie readNo HttpOnly, so JavaScript can access it
- Session hijackedAttacker acts as the user or admin
A script injected through another flaw reads a cookie that lacks HttpOnly.
How to check if your site has it
Open developer tools
In Chrome or Edge press F12, then open the Application tab. In Firefox open the Storage tab.
Select Cookies for your domain
Expand Cookies in the left panel and click your site address.
Read the flag columns
Look at the HttpOnly, Secure and SameSite columns. Empty cells mean the attribute is not set.
Check the raw header
Open the Network tab, reload, click the first document request and look for Set-Cookie in Response Headers.
Test while logged in
Repeat after logging in, because session cookies are often only set then.
curl -sI https://www.example.com/ | grep -i '^set-cookie'How to fix it
Start with cookies that identify a user: session, login, cart and CSRF tokens. Use Secure and HttpOnly on them, and SameSite=Lax unless you have a reason for something else. Note that SameSite=None only works together with Secure.
Force HTTPS first
Make sure Settings > General uses https:// addresses. WordPress marks its login cookies Secure automatically on HTTPS.
Set flags for PHP sessions
If a plugin or theme uses PHP sessions, add the ini settings shown in the Custom code tab to php.ini or .user.ini.
Update or replace the offender
If a specific plugin sets an unsafe cookie, update it or ask its developer. Check the plugin's settings for a cookie security option.
Know what you control
Shopify sets its own session and cart cookies and you cannot edit their flags.
Check your own scripts
If theme code or an app sets a cookie with JavaScript, add Secure and SameSite there. JavaScript cannot set HttpOnly.
Review cookies your tags set
Cookies written by Custom HTML tags should include ; Secure; SameSite=Lax in the document.cookie string.
Accept the limit
Cookies set by JavaScript can never be HttpOnly. Keep sensitive values out of them.
Platform cookies
Webflow hosting manages its own cookies, so you cannot change their flags.
Custom scripts
If you add cookie code in Project Settings > Custom Code, include Secure and SameSite.
Platform cookies
Cookies set by the hosted funnel or membership area are managed by the platform. Contact support if a scan flags them.
Custom scripts
Add Secure and SameSite to any cookie your own tracking code sets.
Platform cookies
Wix controls its session cookies and you cannot edit them.
Custom code
Add Secure and SameSite to cookies written in Settings > Custom Code or Velo.
Platform cookies
Squarespace manages its own cookies and you cannot edit their flags.
Code injection
Add Secure and SameSite to cookies set in Settings > Advanced > Code Injection.
Set flags in your app
Use your framework's session or cookie settings, or send the Set-Cookie header directly as shown in the snippets.
Use HTTPS everywhere
Secure cookies are ignored on plain HTTP in modern browsers, so redirect HTTP to HTTPS.
Set-Cookie: session=abc123; Path=/; Secure; HttpOnly; SameSite=Lax<?php
session_set_cookie_params([
'lifetime' => 0,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);
session_start();document.cookie = 'pref=1; Path=/; Max-Age=31536000; Secure; SameSite=Lax';Before
- Set-Cookie: session=abc123; Path=/
- Readable by any script on the page
- Can be sent over HTTP
After
- Set-Cookie: session=abc123; Path=/; Secure; HttpOnly; SameSite=Lax
- Hidden from JavaScript
- Sent over HTTPS only
How to confirm it's fixed
- Clear cookies, reload and log in again
- Application tab shows Secure and HttpOnly ticked on session and login cookies
- SameSite shows Lax (or None with Secure where cross-site use is needed)
- Login, cart and form submission still work end to end
- Arriving from an ad or email link keeps the visitor logged in or the cart intact
- A re-run of your security scanner no longer lists the cookie
How to prevent it happening again
- Set cookie defaults in one place, such as your framework or server config
- Review cookies after installing a new plugin, app or embed
- Run a header and cookie scan after each major release
- Keep CMS core and plugins updated (see the related issues on outdated software)
- Avoid storing sensitive values in JavaScript-set cookies
How FunnelGuard handles this
FunnelGuard does not check cookie flags today. It is a possible future check. FunnelGuard is a synthetic monitoring service: a robot visitor runs your real journeys, such as lead forms and checkouts, and checks each step, the tracking hits sent to ad and analytics platforms, and whether test leads arrive.
That is relevant nearby. If a cookie change such as SameSite=Strict or a broken HTTPS redirect stops a login, cart or form from working, a scheduled journey check can show the funnel failing at that step. It will not tell you the flags are missing.
Frequently asked questions
Questions people ask
Why is my cookie missing the Secure flag?
The server or script that sets the cookie did not include the Secure attribute, or your site is still partly on HTTP. Add Secure to the Set-Cookie header or session settings and make sure all pages redirect to HTTPS.
What does HttpOnly do on a cookie?
HttpOnly stops JavaScript from reading the cookie. If an attacker injects a script into your page, they cannot steal an HttpOnly session cookie that way.
Which SameSite value should I use?
Use Lax for most sites. It blocks the cookie on most cross-site requests but still works when someone clicks a link to your site. Use None only when you need cross-site use, and it must be paired with Secure.
Do analytics cookies like _ga need HttpOnly?
No. Analytics scripts must read those cookies, so HttpOnly would break them. Focus the flags on session, login and cart cookies.
Can I change cookie flags on Shopify, Wix or Squarespace?
Not for the cookies the platform sets itself. You can only control cookies written by your own custom code or apps, where you can add Secure and SameSite.
Will adding SameSite break my tracking or login?
Lax rarely does. Strict can log visitors out when they arrive from an ad or email, and None without Secure is rejected by browsers. Test your login, cart and form after any change.
Does FunnelGuard check cookie flags?
No, not yet. It is a possible future check. FunnelGuard does run your real journeys on a schedule, so a cookie change that breaks a login or form would show up as a failing step.
Related issues
- OPS-170Missing Content-Security-PolicyFix guide
- OPS-177Reflected XSS in form fields or searchFix guide
- OPS-180CSRF on formsFix guide
- OPS-171Missing X-Frame-Options / frame-ancestors (clickjacking)Fix guide
- OPS-155Outdated CMS core with known CVEsFix guide
- OPS-156Outdated plugins/themes with known CVEsFix guide