Expert Insights

Security headers: why your scanner and your browser disagree

CSP and HSTS headers can be present and still protect nothing. How to judge security headers by what the browser enforces on each page.

ThingsRecon company logo with stylized wing icon on a dark blue background.

Stephane Konarkowski

Chief Product Officer

December 1, 2026

December 1, 2026

Security header checks that only test whether CSP, HSTS or X-Frame-Options are present misjudge risk. Headers can be report-only, too permissive, self-disabling or overridden by another header. Judge each control by what the browser actually enforces and whether the page has anything to protect.

Security header presence checks get protection wrong. I spend a lot of my time looking at other people's attack surfaces, and security headers come up in almost every assessment I see. They’re easy to check: you request a page, read the response, and tick a box for each header you find:

Five headers, five boxes. That simplicity is exactly what bothers me.

Whether a header is there and whether it protects anything are two different questions. A check that only answers the first one gets the second one wrong, in both directions. It gives credit for headers that do nothing, and it penalises pages where a missing header changes very little.

A header can be there and still do nothing

These are the cases I see most often where a header passes a presence check but gives little or no protection:

  • The policy is report-only. Content-Security-Policy-Report-Only tells the browser to report violations, not to block them. It's a good step on the way to enforcement. On its own, it enforces nothing.
  • The policy is too permissive. A CSP whose script-src allows 'unsafe-inline', broad wildcards or a whole scheme like https: does very little against cross-site scripting. Even a policy that only allows a short list of trusted domains is often bypassable, because those domains can host scripts an attacker can reuse. This isn't a niche concern. Google's study CSP Is Dead, Long Live CSP! (ACM CCS 2016) looked at policies on about 1.68 million hosts. It found bypasses in 94.72% of distinct policies, and concluded that 99.34% of hosts with CSP were using policies that offered no benefit against XSS.
  • HSTS is set to switch itself off. Under RFC 6797, Strict-Transport-Security: max-age=0 tells the browser to stop treating the site as HTTPS-only. The header is there. Its effect is to remove protection.
  • The header is deprecated, or worse. OWASP now recommends either not setting X-XSS-Protection at all or setting it to 0, because in some cases it can create XSS vulnerabilities in sites that were otherwise safe. A check that rewards X-XSS-Protection: 1; mode=block is rewarding the wrong thing.
  • The directive is in the wrong place. You can deliver a CSP in an HTML <meta> tag, but frame-ancestors isn't supported there. A clickjacking defence in a meta tag is simply ignored.

None of this is exotic. It's what happens when headers get copied from one project to the next, staged and never promoted, or configured and never tested.

When two headers disagree, one of them loses

Framing protection is where reading headers one at a time goes most clearly wrong. Two headers decide whether a page can be embedded in a frame: the older X-Frame-Options and the CSP frame-ancestors directive. OWASP describes frame-ancestors as making X-Frame-Options obsolete in browsers that support it. Firefox, for example, has ignored X-Frame-Options whenever an enforced CSP with frame-ancestors is present since version 55.

I didn't want to write this part from memory, so I tested it. Here is what headless Chromium 141 did with a page sending different combinations:

Headers sent

Framed by same origin

Framed by another origin

X-Frame-Options: SAMEORIGIN onlyAllowedBlocked
frame-ancestors * + X-Frame-Options: DENYAllowedAllowed
frame-ancestors none (unquoted) + X-Frame-Options: SAMEORIGINBlockedBlocked
Report-only frame-ancestors * + X-Frame-Options: DENYBlockedBlocked

The second row is the one I'd want every security team to look at. A presence check sees X-Frame-Options: DENY and records a pass. The browser follows the CSP and lets anyone frame the page. The last row is the reverse: a report-only policy overrides nothing, so X-Frame-Options still applies.

The third row taught me something too, and it's a good reminder not to overstate a finding. CSP keywords like 'none', 'self' and 'unsafe-inline' must be in single quotes. Without the quotes, the browser reads none as a hostname, not a keyword. My first instinct was that this would leave the page open. It doesn't.

In my test, framing was still blocked everywhere, because an attacker on the public internet can't serve a page from a host literally called "none". So the configuration is wrong, and it quietly overrides the SAMEORIGIN the author also set, but it fails closed, not open. If I had reported that as a critical exposure, I would have been wrong. It's a correctness issue that should be fixed, and that's how it should be described.

For me, the takeaway isn't that any single header is broken. It's that the combination, as the browser interprets it, is what protects the user. You only find that out by checking behaviour.

A redirect is not HSTS

Here's a related pattern I ran into recently. Port 80 was open on a web host, and the obvious finding was "clear-text HTTP". When I checked, port 80 did exactly one thing: it returned a redirect to HTTPS. That isn't a page served in clear text, and flagging it as one is just noise.

But the redirect isn't the whole story either, and in that case HSTS was missing. The first request still goes out over plain HTTP before it's redirected, and that's the request someone on the network can intercept. RFC 6797 calls this the bootstrap problem. HSTS fixes it after the first successful HTTPS visit, for as long as its max-age lasts. The HSTS preload list, which is built into the major browsers, closes the gap for the first visit too, once a domain has been added to it. The requirements are published at hstspreload.org. They include a valid certificate, an HTTP-to-HTTPS redirect on the same host, HTTPS on every subdomain, and an HSTS header on the base domain with a max-age of at least one year (31536000 seconds), includeSubDomains and the preload directive.

So "port 80 open" is the wrong finding. "Port 80 redirects, but there's no HSTS" is the right one.

Not every missing header matters as much

The other thing that bothers me about counting is that it treats every page as the same page.

OWASP's own guidance says CSP is relevant on pages that load and interpret scripts and code.

A missing CSP on a public login page that handles credentials is a real gap. The same missing header on a static page with no forms, no session and no scripts changes very little.

If every page counts the same, a big estate of low-consequence static pages can dominate a score, while the handful of authenticated applications that carry the actual risk barely move it. I've seen teams learn to ignore the number because of this, and when that happens, the findings that matter get lost with the ones that don't.

Three better questions

Tools that grade quality rather than presence already exist, so this isn't a new idea. The scoring method Mozilla published for its HTTP Observatory, for example, takes 20 points off for a CSP that allows 'unsafe-inline' in script-src, against 25 for having no CSP at all. Google's CSP Evaluator checks policies for known bypasses.

Whatever tool you use, these are the three questions I'd ask instead of "is it there?":

If you're on the receiving end of security ratings

A lot of people meet header findings second-hand, in a rating of their suppliers or a report about themselves. Before acting on one, I'd ask the provider a simple question: does this finding reflect presence or effect, and does it take the type of page into account?

A remediation request built on a presence check is easy for the other side to dispute. Every disputed request makes the next one harder to land, and in third-party risk, credibility is most of what you have.

What I'd do on Monday

  1. Look at what's actually served. curl -s -D - -o /dev/null https://example.com/login shows the headers on a real GET request. curl -I sends a HEAD request, and some servers answer that differently. Check more than the home page, because headers often vary by path, by error page and by redirect.
  2. Look for overlaps and conflicts. If you send both X-Frame-Options and frame-ancestors, make sure they agree, and remember that in current browsers the enforced CSP wins.
  3. Quote your CSP keywords. 'none', 'self', 'unsafe-inline' and 'strict-dynamic' all need single quotes.
  4. Promote report-only policies. Report-only is a step towards enforcement, not the destination.
  5. Pair every HTTP-to-HTTPS redirect with HSTS, and look at preload once all your subdomains are ready for HTTPS.
  6. Retire X-XSS-Protection. Remove it or set it to 0, and rely on a real CSP instead.
  7. Fix it at the edge. Header gaps are usually systemic. One policy at the reverse proxy or load balancer often fixes many applications in a single change.
  8. Start where the consequences are. Internet-facing pages that handle authentication, payments or personal data come first.

Judging findings by effect leads to a harder question, and one I think the industry mostly gets wrong: what should an assessment say about an asset it couldn't examine, because it was blocked or timed out? That's Part 2.

Frequently Asked Questions

Does X-Frame-Options still matter if a page sets CSP frame-ancestors?

In current browsers an enforced frame-ancestors directive takes priority and X-Frame-Options is ignored. Keeping both is harmless for older clients as long as they agree. When they conflict, the CSP value decides whether other sites can frame the page.

What HSTS max-age should a site use?

Long enough to cover the time between visits. The HSTS preload list requires at least one year (31536000 seconds) together with includeSubDomains and the preload directive. A value of 0 does the opposite and tells browsers to stop enforcing HTTPS for the site.

Does Content-Security-Policy-Report-Only protect against cross-site scripting?

No. Report-only mode sends violation reports and lets the content load anyway, so it blocks nothing. It is useful for testing a policy before enforcing it, but a page that only sends the report-only header has no enforced CSP protection.

Can a Content-Security-Policy be set in an HTML meta tag?

Yes, for most directives. The frame-ancestors directive is not supported in a meta tag and browsers ignore it there, so clickjacking protection has to come from an HTTP response header, either CSP frame-ancestors or X-Frame-Options.

How should a supplier respond to a security rating that flags missing headers?

Ask whether the finding measures presence or effect, and which pages it covers. A missing CSP on a static press page is a weaker finding than a permissive policy on a login page. Evidence of what the browser enforces gives both sides something concrete to agree on.

Share on Linkedin
Follow us on LinkedIn to get the latest insights.
ThingsRecon logo
get a personalized demo
What’s connected to you right now?
ThingsRecon logo
Thank you! You are now susbribed to The Recon Log
Oops! Something went wrong while submitting the form.
ALL THINGS
CYBER
A ThingsRecon podcast
from the edges of
the internet.
Share on LinkedinShare on XShare on Facebook