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-Onlytells 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-srcallows'unsafe-inline', broad wildcards or a whole scheme likehttps: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=0tells 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-Protectionat all or setting it to0, because in some cases it can create XSS vulnerabilities in sites that were otherwise safe. A check that rewardsX-XSS-Protection: 1; mode=blockis rewarding the wrong thing. - The directive is in the wrong place. You can deliver a CSP in an HTML
<meta>tag, butframe-ancestorsisn'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 only | Allowed | Blocked |
frame-ancestors * + X-Frame-Options: DENY | Allowed | Allowed |
frame-ancestors none (unquoted) + X-Frame-Options: SAMEORIGIN | Blocked | Blocked |
Report-only frame-ancestors * + X-Frame-Options: DENY | Blocked | Blocked |
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
- Look at what's actually served.
curl -s -D - -o /dev/null https://example.com/loginshows the headers on a real GET request.curl -Isends 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. - Look for overlaps and conflicts. If you send both
X-Frame-Optionsandframe-ancestors, make sure they agree, and remember that in current browsers the enforced CSP wins. - Quote your CSP keywords.
'none','self','unsafe-inline'and'strict-dynamic'all need single quotes. - Promote report-only policies. Report-only is a step towards enforcement, not the destination.
- Pair every HTTP-to-HTTPS redirect with HSTS, and look at preload once all your subdomains are ready for HTTPS.
- Retire
X-XSS-Protection. Remove it or set it to0, and rely on a real CSP instead. - 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.
- 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.





