Evaluating HTTP security header policy strength: present isn't the same as strong
AdminKit's HTTP security headers check reports whether a header is present, but presence alone isn't strength: judging a policy means reading its actual value against known-weak or known-strong patterns, since a Content-Security-Policy, an HSTS max-age, or a Referrer-Policy can each be technically present while providing close to none of the protection it's meant for.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- A header check tells you what was sent. Strength depends on the value, and the value needs reading.
- CSP: a policy that allows
*,'unsafe-inline'or'unsafe-eval'for scripts barely limits XSS. OWASP’s current advice is a “strict” policy based on nonces or hashes. - HSTS: any positive
max-ageis valid, but one year (31536000 seconds) withincludeSubDomainsis the documented bar for a durable policy. - Referrer-Policy: an explicit
unsafe-urlis weaker than sending no header at all, because browsers default tostrict-origin-when-cross-origin. X-Frame-Options: ALLOW-FROMis obsolete, and modern browsers ignore the whole header when they see it. Use CSPframe-ancestorsinstead.
Why is presence not the same as strength?
AdminKit’s HTTP security headers check, like any headers check, reports two things for each recommended header: whether it’s present, and the exact value sent. How to read an HTTP security headers result covers what each header does; this guide is about the second part — reading that value against a known-weak or known-strong pattern, since a present header with a permissive value can protect a site barely more than no header at all. The OWASP Secure Headers Project maintains exactly this kind of reference: not just which headers to send, but which values within them actually do the intended work.
AdminKit’s check raises findings only for missing headers. It does not grade values, so every judgement in this guide is one you make by reading the value column yourself.
How do you judge a Content-Security-Policy?
A Content-Security-Policy header being present tells you nothing about its strength on its own — only its directives do. Two patterns the OWASP Content Security Policy Cheat Sheet and MDN warn against:
default-src *or an unscopedscript-src *— allows scripts (and other resources) from any origin at all, which defeats CSP’s core purpose of restricting where executable content can come from.unsafe-inlineorunsafe-evalinscript-src— permits inline<script>blocks oreval()-style dynamic code execution, which is precisely the mechanism most injected-script (XSS) attacks rely on; a policy allowing it provides little protection against the attack class CSP exists to mitigate.
A strong policy instead scopes script-src to an explicit, short allowlist of trusted origins, or better, uses a per-response cryptographic nonce or hash so the browser only executes script tags the server explicitly marked, regardless of anything injected elsewhere in the page. Scoping origins doesn’t verify a trusted origin’s own file hasn’t been altered, such as a compromised CDN serving a tampered script — Subresource Integrity (SRI) closes that separate gap by checking the fetched bytes against a hash the page declares.
OWASP now prefers the nonce approach outright. Its cheat sheet says the original allowlist method has given way to a “Strict” CSP, which it calls “much easier to deploy and more secure as it is less likely to be bypassed”. Its example strict policy:
Content-Security-Policy: script-src 'nonce-{RANDOM}' 'strict-dynamic'; object-src 'none'; base-uri 'none'
{RANDOM} is a placeholder. MDN’s script-src page stresses that the nonce must come from a cryptographically secure generator and be unique for each HTTP request; a fixed nonce is no better than 'unsafe-inline'. With 'strict-dynamic', trust given to a nonced script passes to the scripts it loads, and allowlist entries and 'unsafe-inline' in the same directive are ignored.
| Script policy you see | Strength | Why |
|---|---|---|
No script-src and no default-src | None for scripts | Nothing to fall back to; scripts are unrestricted |
script-src * or default-src * | Very weak | Any origin may serve script |
script-src 'self' 'unsafe-inline' | Weak | Injected inline script runs |
script-src 'self' 'unsafe-eval' | Weak to moderate | eval() and string-to-code calls are allowed |
script-src 'self' https://cdn.example.com | Moderate | Allowlist; OWASP notes allowlists are easier to bypass |
script-src 'nonce-…' 'strict-dynamic' | Strong | Only scripts the server marked can run |
Tightening a live policy can break pages, so test it first. MDN describes Content-Security-Policy-Report-Only as a way to monitor violations “without enforcing the security policies”. The report-only header sends a report for each violation to the endpoint named by report-to, so you can fix the pages before switching to the enforcing header:
Reporting-Endpoints: csp-endpoint="https://example.com/csp-reports"
Content-Security-Policy-Report-Only: script-src 'nonce-{RANDOM}' 'strict-dynamic'; object-src 'none'; base-uri 'none'; report-to csp-endpoint
How long should an HSTS max-age be?
RFC 6797 accepts any positive max-age as a technically valid header, which means “present” covers both a robust year-long policy and a token one lasting a few hours that offers almost no durable protection. hstspreload.org’s submission requirements give a concrete, documented bar for what counts as strong: a max-age of at least 31536000 seconds (one year) and the includeSubDomains directive, which is also exactly the threshold our guide to HSTS and HSTS preload walks through in full, including why preload itself isn’t the right next step for every site even once the header is strong.
max-age value | Duration | Reading |
|---|---|---|
0 | None | Deletes the stored policy (RFC 6797); HSTS is switched off |
300 | 5 minutes | First rollout stage on hstspreload.org; testing only |
604800 | 1 week | Second rollout stage |
2592000 | 1 month | Third rollout stage |
31536000 | 1 year | Minimum for preload; a durable policy |
63072000 | 2 years | The value in OWASP’s cheat sheet example |
Check includeSubDomains too. Without it, subdomains get no policy from the parent. RFC 6797 §14.4 explains the cost: HSTS then cannot protect Secure-flagged “domain cookies” set for the whole domain, because an attacker can lure the browser to an unprotected subdomain they control and collect the cookie there. The OWASP HTTP Headers Cheat Sheet example includes it: max-age=63072000; includeSubDomains; preload.
X-Frame-Options vs frame-ancestors: which is stronger?
Both headers control which origins may embed a page in a frame, the mechanism behind clickjacking. X-Frame-Options only offers DENY or SAMEORIGIN — an all-or-nothing choice. frame-ancestors, a Content-Security-Policy directive, supersedes it in supporting browsers and allows an explicit list of permitted framing origins, giving finer control without losing the all-or-nothing options either. A policy sending only X-Frame-Options is valid and functional, but weaker than one that also sends frame-ancestors, since it can’t express anything more granular than same-origin-or-nobody.
One value is worse than it looks. MDN calls ALLOW-FROM obsolete and says modern browsers that see it “will ignore the header completely”. A site sending X-Frame-Options: ALLOW-FROM https://partner.example.com without frame-ancestors has no clickjacking protection in those browsers, even though a presence check counts the header as sent.
| Value you see | Strength |
|---|---|
frame-ancestors 'none' (with or without X-Frame-Options: DENY) | Strong: no one may frame the page |
frame-ancestors 'self' https://partner.example.com | Strong and specific |
X-Frame-Options: DENY or SAMEORIGIN only | Valid, less flexible |
X-Frame-Options: ALLOW-FROM … only | None in modern browsers |
default-src 'none' with no frame-ancestors | None for framing; frame-ancestors does not fall back to default-src |
Referrer-Policy: why is unsafe-url a regression, not a neutral default?
Modern browsers already default to strict-origin-when-cross-origin when no Referrer-Policy header is sent at all. That matters for judging strength: a site that explicitly sets unsafe-url — which sends a page’s full URL, including any sensitive path or query-string contents, to every cross-origin destination it requests from, even a plain-HTTP one — has made its referrer handling weaker than sending no header, not merely failed to improve on a bad default. Any explicit value stricter than that default, such as strict-origin or no-referrer, is doing genuine, verifiable work.
MDN’s Referrer-Policy reference lists the values. Ranked from most to least protective, by what a cross-origin request receives:
| Value | Sent cross-origin (HTTPS to HTTPS) | Sent to HTTP from HTTPS |
|---|---|---|
no-referrer | Nothing | Nothing |
same-origin | Nothing | Nothing |
strict-origin | Origin only | Nothing |
strict-origin-when-cross-origin (browser default) | Origin only | Nothing |
origin / origin-when-cross-origin | Origin only | Origin only |
no-referrer-when-downgrade | Full URL | Nothing |
unsafe-url | Full URL | Full URL |
no-referrer-when-downgrade deserves a second look when you see it: MDN notes it used to be the browser default, so older configurations sometimes set it explicitly. Today it is weaker than the default.
Permissions-Policy: how do you judge what it restricts?
Unlike CSP, there’s no single well-known “unsafe” Permissions-Policy value to flag — the strength question is which browser features (camera, microphone, geolocation, and others) a policy explicitly restricts, and to which origins. A page that doesn’t use these features but also sends no Permissions-Policy leaves every feature at the browser’s own default allowance within that page’s context, including for any third-party content it embeds; explicitly denying features a page doesn’t need shrinks what any embedded script or iframe could ever request, regardless of what it later tries.
The allowlist syntax on MDN’s Permissions-Policy page gives a reading order: () disables a feature everywhere, self allows it only for the same origin, a quoted origin list allows named origins, and * allows it for the page and every frame, whatever the origin. A directive set to * for a feature the page never uses is the closest thing this header has to a weak value.
How do you turn the result into a strength audit?
A site can report every recommended header as present and still be in meaningfully worse shape than one missing a header or two, if the “present” values are the permissive patterns above. Read each value against the OWASP Secure Headers Project’s reference table rather than counting checkmarks, and prioritize Content-Security-Policy and Strict-Transport-Security first — scoping a wide-open CSP or lengthening a short max-age typically closes a bigger real gap than adding a header that was missing outright.
Next step: check your own headers’ actual values
Run AdminKit’s HTTP security headers check against your own URL, then read each present header’s value against the patterns above rather than stopping at the present/missing column. If the site’s transport encryption is also worth confirming alongside its headers, checking TLS certificate chain completeness covers the companion check these headers assume is already in place. This guide is part of AdminKit’s security basics cluster, which covers the rest of the checks worth running against a site’s exposed surface.
This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.
Frequently asked questions
What makes a Content-Security-Policy weak even though it's present?
A CSP that's permissive in practice does almost nothing against the attacks it's meant to stop, regardless of being technically present. OWASP's Content Security Policy Cheat Sheet and MDN both warn against specific weak patterns: a policy whose script-src (or the default-src it falls back to) is set to * or includes unsafe-inline or unsafe-eval allows essentially any script to run, including an attacker's injected one, which is exactly what CSP exists to prevent. A strong CSP instead scopes script-src to specific trusted origins, or uses a per-response nonce or hash so only explicitly marked script tags execute at all.
What HSTS max-age actually counts as strong?
RFC 6797 doesn't itself mandate a minimum max-age — any positive value is a technically valid header — but a short one, like a few hours or days, barely protects a returning visitor and offers nothing for anyone who doesn't visit again within that window. hstspreload.org, which documents the stricter bar sites aim for if they want browsers to enforce HTTPS even earlier, requires at least 31536000 seconds (one year) plus the includeSubDomains directive before a domain can even be considered for preloading — that threshold is a reasonable line between a token HSTS header and one doing real, durable work.
Is X-Frame-Options: SAMEORIGIN as strong as using frame-ancestors?
It covers the same basic clickjacking protection, but frame-ancestors (a Content-Security-Policy directive) is the stronger, more current control: it supports an explicit list of allowed framing origins, not just a same-origin-or-nothing choice, and browsers that support frame-ancestors ignore X-Frame-Options when both are present. A policy relying on X-Frame-Options alone, with no frame-ancestors directive at all, is the weaker of the two valid configurations, not an invalid one — it's a gap compared to best practice, not a failure.
Why is Referrer-Policy: unsafe-url considered a weak value, if any value at all counts as 'present'?
Because unsafe-url is a deliberate opt-out of the protection the header exists to provide: it sends a page's full URL, including anything sensitive in its path or query string, to every cross-origin request a page makes — even a plain-HTTP destination. Modern browsers already default to the considerably stricter strict-origin-when-cross-origin when no Referrer-Policy header is sent at all, so a site that explicitly sets unsafe-url has made its referrer handling weaker than doing nothing, which is a meaningfully different, worse finding than simply having no header.
How do you judge Permissions-Policy strength, since it doesn't have an obvious 'weak value' like CSP's unsafe-inline?
The question is which browser features (camera, microphone, geolocation, and others) the policy restricts, and to which origins. A Permissions-Policy that explicitly denies features the page doesn't use is doing real work by shrinking what any embedded third-party iframe could ever request; a page with no Permissions-Policy at all leaves every feature at the browser's own default allowance for that context, which is typically broader than a page actually needs.
Can a site pass every header as 'present' and still have weak security headers overall?
Yes, and this is the central point of judging strength rather than counting presence: a site can send CSP, HSTS, X-Frame-Options, Referrer-Policy and Permissions-Policy with every one of them set to a permissive, close-to-meaningless value, and a presence-only check would show a clean sheet. Reading each value against the OWASP Secure Headers Project's reference table, rather than treating a checklist of five checkmarks as the goal, is what actually separates real protection from a header sent only to satisfy a scanner.
Sources
- OWASP Secure Headers Project
- RFC 6797 — HTTP Strict Transport Security (HSTS)
- hstspreload.org — submission requirements
- OWASP — Content Security Policy Cheat Sheet (strict CSP)
- OWASP — HTTP Headers Cheat Sheet
- MDN — CSP script-src directive (unsafe-inline, unsafe-eval, nonces, hashes, strict-dynamic)
- MDN — Content-Security-Policy-Report-Only
- MDN — Referrer-Policy directives and default
- MDN — X-Frame-Options
- MDN — Permissions-Policy
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
Talk to an expert
Huy Nguyen (David), Founder & CEO, Netbase JSC
Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.