Docs Security
Content Security Policy
Checks that your homepage sends a Content Security Policy that really limits where scripts can run from, not just a header that blocks nothing.
What it checks
We read the Content-Security-Policy header on the homepage, or a <meta http-equiv="Content-Security-Policy"> tag if there is no header.
The check looks at script-src, or at default-src when script-src is not set. A policy counts as weak when neither is set, when the list allows any host (*, http: or https:), or when it allows 'unsafe-inline' without a nonce, a hash or 'strict-dynamic'.
- PassA policy is set and its script sources are limited.
- WarningA policy is set but is weak in one of the ways above, for example it only sets frame-ancestors. Also a warning: only a Content-Security-Policy-Report-Only header is sent, which reports problems but blocks nothing.
- FailNo Content Security Policy at all.
Why it matters
A CSP limits the damage when someone gets a script into your page, for example through a form field, a plugin bug or a compromised third-party tag. The browser refuses to run scripts from sources the policy does not list.
A policy that allows any host or any inline script still lets those injected scripts run, which is why the check looks past the header being present.
How to fix it
List the hosts your pages really load scripts from: your own site, analytics, chat widgets, payment forms. Move inline scripts into files, or mark the ones you keep with a nonce or hash.
Roll it out in report-only mode first. Read the reports for a few days, add any host you missed, then switch to the enforcing header. Third-party tags change their hosts from time to time, so check the reports after you add a new tool.
Platform notes
Themes and plugins often print inline scripts, so a strict policy needs careful testing. Set the header in server config or with a plugin that manages security headers, and start in report-only mode.
You usually cannot set response headers on these platforms. The check also reads a meta tag, which some of them let you add through custom head code, but the platform's own scripts must still be allowed, so test it carefully.
A Transform Rule that modifies response headers can add the header to every page without touching your server.
Use add_header on Nginx or Header set on Apache.
Next.js can set the header in next.config.js, or in middleware when you need a fresh nonce on every request. Vercel and Netlify can also set it in vercel.json or a _headers file.
Your report shows what this check found on your site. Pro shows the exact fix for your site. See pricing.
Want to test just this? Use the free CSP checker.
Questions
Will a Content Security Policy break my site?
It can, if it leaves out a host your pages need. That is what report-only mode is for: it shows what would be blocked without blocking anything.
Free, about 30 seconds, with every other check included.