Defaults.Exposed

Most Content-Security-Policy headers are not content security policies

Your Content-Security-Policy header is going out, the audit ticket closed on it, and whether it protects anything comes down to one question: does the policy contain a default-src or a script-src directive? If it doesn’t, no script on your pages is constrained by it. The browser reads the header, finds nothing that limits where code may load from, and runs whatever the page asks it to run, the same as it would with no header at all.

A header being present and a policy being enforced are two readings of the same line, and they come apart more often than you’d expect. Most of the CSP headers the census saw pass the first reading and fail the second, and one command tells you which side yours is on.

This page is the builder’s side of the census counts. If you need the adoption figure for a report, which number to cite at the foot of the page sets out which of the two to cite and the denominator each one needs.

The one-line test

Pull the header from your own site and read what comes back:

curl -sI https://<your-domain> | grep -i content-security-policy

Look for two words in the value. If default-src or script-src appears, the policy constrains script and you’re past the first hurdle. If neither appears, the policy sets no boundary on where code may come from, whatever else it contains.

Three values you’ll commonly meet, and how each scores on that test:

Content-Security-Policy: upgrade-insecure-requests

This rewrites http subresource URLs to https and constrains no script.

Content-Security-Policy: frame-ancestors 'self'

This stops other sites framing yours and constrains no script.

Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'

This limits script to your own origin and passes.

The scan on this page reads the same header line the census read, and its row tells you what the policy does instead of whether it exists.

What upgrade-insecure-requests does, and what it leaves alone

A policy that reads upgrade-insecure-requests and nothing else is common enough that the census counts it as its own category. When a page served over https references an image, script or stylesheet by an http:// URL, the browser upgrades that fetch to https:// before sending it. The mixed-content warning disappears and the resource loads over TLS (Transport Layer Security). The same upgrade applies to form submissions and to links within your own site. If you moved a site to https and had a long tail of hard-coded http links in old templates, this directive is what brought the padlock back.

Changing the scheme of a URL is all the directive does. It has no opinion on which hosts may serve scripts, whether inline <script> blocks run, whether eval is permitted, or whether a third party can inject a tag through a compromised dependency. A page with upgrade-insecure-requests alone will load and execute a script from any origin an attacker manages to reference, over https, with the browser’s full cooperation.

It doesn’t reach links that take the user to another site either, so a link out to an http:// destination stays http. And it isn’t a substitute for HSTS: the CSP directive only exists once the page has been fetched, whereas HSTS (HTTP Strict Transport Security) tells the browser to use https before the first request leaves. The two solve neighbouring problems, and neither one restricts content.

What the census counted

The census records the response headers of each domain that answers on the web and keeps the contents of the Content-Security-Policy value, so the census can count the gap between declared and enforced instead of estimating it. Three lines from this edition show the picture, and each line below names the denominator the census uses for it.

Of the 222,553,676 domains that sent a Server, Content-Security-Policy or X-Powered-By header, 24,085,548 (10.82% of http_headers_present) sent any Content-Security-Policy header at all. Publishing a CSP of any kind remains a minority choice.

Of those 24,085,548 domains, 6,705,071 (27.84% of csp_present) sent a policy consisting of upgrade-insecure-requests and nothing else, the value that fails the one-line test above.

And 6,862,181 domains (28.49% of csp_present, 3.08% of http_headers_present) had a default-src or a script-src. That is the share of the web’s CSP headers that constrain script at all. It doesn’t say how well they do it. A script-src that allows 'unsafe-inline' and a wildcard host has a directive in the right place and very little behind it, so 28.49% is the generous reading, and the other CSP headers don’t get even that far.

Keep the two denominators apart when you repeat these numbers. The 10.82% is a share of domains that sent headers; the 27.84% and the 28.49% are shares of the smaller group that sent a CSP, and a figure built by quoting one against the other’s denominator is one the census never counted.

What the policies contain

The same pass reads every directive in every policy, so the census can say what the 24,085,548 policies are made of. Each row below is a count of policies carrying that pattern, with its share of csp_present, the 24,085,548 domains that sent any Content-Security-Policy header. The rows overlap, because one policy can carry several directives, so they don’t add to the base.

Pattern in the policyDomainsShare of csp_present
Any Content-Security-Policy header (csp_present)24,085,548100% of the base; 10.82% of http_headers_present
upgrade-insecure-requests and nothing else6,705,07127.84%
Constrains script (default-src or script-src)6,862,18128.49% (3.08% of http_headers_present)
Has default-src6,630,56727.53%
Has script-src5,916,11424.56%
Has frame-ancestors12,671,01052.61%
Carries 'unsafe-inline'5,623,12023.35%
Carries 'unsafe-eval'3,564,64414.80%
Has reporting (report-uri or report-to)188,3530.78%

Three things stand out. frame-ancestors is the most common directive by a distance, on more than half of all policies, so the header is more often a framing control than a script control. 'unsafe-inline' appears on 5,623,120 policies, not far short of the 6,862,181 that carry default-src or script-src at all; the two counts come from the same pass, the overlap between them is not on the sheet, and the unsafe-inline piece walks through what that keyword switches off. And reporting is on 0.78% of policies, which is the directive that makes a policy safe to tighten.

Why the ticket closed anyway

A checklist that tests for presence has one row for this header. It reads “Content-Security-Policy: present” or “missing”, and it turns green when any value goes out. The ticket raised on the red row closes when the row changes colour, and nothing in that loop parses directives. A header of upgrade-insecure-requests satisfies it as fully as a policy that took three weeks to tune.

The other reason is that writing a CSP that constrains script is work. You have to inventory each host your pages load code from, then deal with the inline event handlers and analytics snippets the policy will block. Publishing upgrade-insecure-requests is one line that breaks nothing, and the row turns green. A checklist that can’t tell the two apart favours the one-liner, and the census counts how often sites choose it.

The headers pillar covers what a scanner can and can’t infer from a response. The failure mode described here survives any tool that stops at the header name, and the checklist format encourages stopping there.

Reading a policy for what it enforces

Once you’ve got past the presence test, read the policy the way the browser does. Fetch directives (script-src, style-src, img-src, connect-src, frame-src and the rest) each govern one kind of load, and default-src is the fallback for any fetch directive you leave unset. So default-src 'self' on its own already limits scripts, styles, images, fonts, frames and connections to your origin, and each specific directive you add widens or narrows that for one category.

Then look at what the script directive allows. 'unsafe-inline' permits inline scripts and inline event handlers, which is where most injected code arrives, so its presence in script-src largely cancels the constraint. 'unsafe-eval' allows string-to-code functions. A bare scheme such as https: or a wildcard host allows any script from any https origin. Through any of these a policy can have script-src and still allow nearly everything. The census line only counts whether the directive is there, so you’ll need to read what it allows yourself.

Two directives that aren’t fetch directives still matter. frame-ancestors controls who may embed your pages, and is the CSP replacement for the older X-Frame-Options header. base-uri stops an injected <base> tag redirecting your relative script URLs to a host of the attacker’s choosing. Neither constrains script, and a policy made only of them would fail the test in the first section, but both belong in the finished header.

What to publish instead

Start from default-src 'self', then set script-src explicitly with the origins that serve your JavaScript. Add object-src 'none' to shut off plugin content and base-uri 'self' to close the base-tag bypass. If you have inline scripts you can’t remove yet, give them a per-response nonce. 'unsafe-inline' would switch the constraint back off. Keep frame-ancestors for clickjacking, and keep upgrade-insecure-requests for mixed content, since it was only ever a problem on its own.

A policy that constrains script and reports on itself looks like this:

Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-<per-response-value>'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; upgrade-insecure-requests; report-to csp-endpoint
Reporting-Endpoints: csp-endpoint="https://<your-domain>/csp-reports"

The report-to directive needs the matching Reporting-Endpoints header to know where to send violations. Older browsers only understand report-uri, so during the transition it’s reasonable to send both, pointing at the same endpoint.

A CSP also depends on the page reaching the browser over TLS intact. A downgraded or intercepted response arrives with whatever header the attacker chose to put on it, so sort the transport out before you spend time tuning the policy.

Report-only first, then enforce

Don’t ship the enforcing header cold on a site with real traffic. Publish the same value under Content-Security-Policy-Report-Only, point report-to at an endpoint you can read, and let it run for a couple of weeks. Report-only policies block nothing. They send a violation report for each fetch the enforcing version would have refused, which is how you find the analytics tag loading from a host you’d forgotten and the inline handler in the footer template. Fix or allow each one, and once the reports go quiet, rename the header.

Reporting earns its keep after the switch as well. A CSP with no report-to or report-uri blocks silently, so a deployment that adds a new script host will break a feature and nobody will hear about it until a user complains. With reporting on, that breakage shows up in your reports first, which is what makes the policy safe to change. Keep the endpoint live and keep reading it once the header is enforcing.

Which number to cite

CSP adoption has two numbers on this page, and a report that needs one should take the directive count. The presence count, 24,085,548 domains sending any Content-Security-Policy header, is the cheap figure, a string match on a header name, and “ten percent of sites use CSP” gets read as “ten percent of sites restrict where script can load from”. Header presence doesn’t tell you that. The directive count, 6,862,181 policies carrying a default-src or a script-src, answers the question an adoption figure is asked for, so this site quotes the directive count for adoption and keeps the presence count beside it, each labelled for what it measures.

People copy the number and leave the denominator behind, and that’s how a figure goes wrong once it leaves the page it was measured on. Paste this one whole:

In the November 2026 defaults.exposed census, 6,862,181 domains sent a Content-Security-Policy header carrying a default-src or script-src directive, 3.08% of the 222,553,676 domains that sent a Server, CSP or X-Powered-By header (http_headers_present).

If you need the presence figure as well, keep it separate and label it for what it is:

24,085,548 domains sent a Content-Security-Policy header of any kind, 10.82% of http_headers_present; 28.49% of those policies constrain script.

The two figures sit on two denominators. The directive count is 3.08% of http_headers_present, the 222,553,676 domains that sent a Server, CSP or X-Powered-By header, and 28.49% of csp_present, the 24,085,548 domains that sent a CSP; the presence count is 10.82% of http_headers_present. Don’t write that adoption fell from one to the other, because it didn’t: both measurements are from the same edition and the same responses, and a writer who shows a drop has told the reader the two numbers are the same measure, which they aren’t. Neither figure is comparable with an earlier edition’s either; each census is quoted on its own.

Before you cite a CSP figure from anywhere, including here, ask two things of the source: which measure it used, and which denominator it named, with the edition date attached to both. If the source can’t answer, don’t cite the figure. The same trap sits under most header statistics: HSTS has its own version of the presence-versus-effect gap, since a header can be present with a max-age too short to protect anyone, and the headers pillar covers the other response headers the census reads.

Figures from the defaults.exposed census, data as of 2 November 2026. Census numbers move every month; the current values are on the census data page.