CSP checker
Paste a Content Security Policy to see where it is weak and what to change. It runs in your browser, so your policy is not sent anywhere.
What it checks
- Scripts
- 'unsafe-inline', 'unsafe-eval', wildcards, data: URLs, plain HTTP, and shared hosts such as public CDNs where anyone can publish a file.
- Nonces and hashes
- Whether the policy uses them, and 'strict-dynamic' without either, which stops every script.
- Missing directives
- base-uri, form-action and frame-ancestors, which default-src does not cover.
- Mistakes
- Misspelt directives, repeated directives, keywords without quotes, and 'none' next to other values.
- Obsolete directives
- block-all-mixed-content, plugin-types, referrer and others browsers no longer use.
- Reporting
- Whether you would hear about violations, in browsers with and without the Reporting API.
The grade is our opinion of the policy text. It cannot tell whether the policy would break your site. To find that out, run it as report-only and look at what browsers report.
A strong starting point
If your server can put a fresh random nonce in every response, this policy is stronger than a list of hosts. Google's guide to strict CSP explains how it works.
Content-Security-Policy: script-src 'nonce-RANDOM' 'strict-dynamic' https: 'unsafe-inline'; object-src 'none'; base-uri 'none'; frame-ancestors 'self'; form-action 'self'
Browsers that understand 'strict-dynamic' ignore https: and 'unsafe-inline' here. They are for older ones.