CSP evaluator and generator: test a Content-Security-Policy
Paste a Content-Security-Policy, or fetch a site’s, to see each directive’s risks: unsafe-inline, unsafe-eval, wildcard sources, and a missing object-src, base-uri or frame-ancestors. Then build a starter policy that passes.
How it works
-
Paste or fetch a policy
Paste a policy, a header line or a <meta> tag, or enter a site to read its headers and <meta> policy from Monity’s server.
-
Read the risks
Each policy is checked directive by directive, with what to change and what it already does well.
-
Build a starter policy
Choose a strict nonce-based policy or an allowlist of your hosts, and copy the header, the <meta> tag and the reporting header.
Monity’s free CSP evaluator reads a Content-Security-Policy the way a browser does: each directive, the
default-src fallback for the ones that are missing, and every policy when a page sends more than one.
It tells you which parts still let injected script run, and the generator writes a starter policy that passes.
The risks it looks for
| Finding | Why it matters | The fix |
|---|---|---|
'unsafe-inline' in script-src | Injected inline scripts and event handlers run | A nonce or hash on each script; then browsers ignore it |
'unsafe-eval' | eval() and similar turn strings into code | Remove the code that needs it |
*, https: or data: as a script source | Script from almost anywhere is allowed | Name the hosts, or go strict |
| Hosts that serve JSONP or old AngularJS | An attacker can run code through an allowed host | 'strict-dynamic' with a nonce |
No object-src | Plugin content can carry script | object-src 'none' |
No base-uri | An injected <base> tag moves every relative script URL | base-uri 'none' or 'self' |
No frame-ancestors | Other sites can frame yours (clickjacking) | frame-ancestors 'self' |
The rules come from CSP Level 3 and
OWASP’s Content Security
Policy cheat sheet, which notes that frame-ancestors has replaced the X-Frame-Options header.
Two real policies, read on 24 Nov 2026
- github.com sends one enforced policy of 4,398 characters with 15 directives. The evaluator finds no risk in it: inline scripts need a nonce or hash, and insecure requests are upgraded.
- www.google.com sends a
Content-Security-Policy-Report-Onlypolicy: a nonce and'strict-dynamic', with'unsafe-inline',https:andhttp:for older browsers, which newer ones ignore when'strict-dynamic'is present (CSP Level 3, 8.2). It also allows'unsafe-eval'. Report-only means it blocks nothing; it only reports.
A long policy is read whole. Tools that cut response headers short can miss its last directives and report them as missing.
Strict or allowlist: which starter policy
- Strict (nonce-based), OWASP’s recommended policy:
script-src 'nonce-{RANDOM}' 'strict-dynamic'; object-src 'none'; base-uri 'none'. Your server writes a new random nonce into the header and every script tag on each response. Scripts those load are trusted too, so no host list goes stale. - Allowlist, OWASP’s basic policy (
default-src 'self') widened by the hosts your pages really load from, withobject-src 'none',base-uriandform-actionlimited to your site. Use it when you can’t add a fresh nonce to every script tag.
Roll it out without breaking the site
- Send the policy as
Content-Security-Policy-Report-Only. It blocks nothing. - Collect the reports:
report-towith aReporting-Endpointsheader, plusreport-urifor browsers that don’t supportreport-toyet (CSP Level 3 deprecatesreport-uribut suggests sending both). - Fix what the reports show, or add the hosts you trust.
- Switch to
Content-Security-Policy. A<meta>tag works too, but can’t carryframe-ancestors,report-uriorsandbox.
What this tool doesn’t do
It judges the policy, not your pages: it doesn’t load the scripts a page runs or test whether the policy would break them. A site is fetched from Monity’s server with a browser’s user agent, so a site that answers bots differently may send another policy. To see every script a page really runs, use the website script scanner, and for the other security headers, the security headers checker, which uses the same CSP review.
Watch the scripts, not just the policy
A policy says what may run; it doesn’t tell you when a new script appears on your checkout. Monity’s script and connection watch, a monitoring skill on a page monitor, keeps an inventory of the scripts a page runs and where it sends data, and alerts you when they change. It helps with PCI DSS 6.4.3 and 11.6.1 (script monitoring for PCI DSS; website security monitoring).

FAQ
Common questions
What does a CSP evaluator check?
Whether the policy still lets an attacker run script: 'unsafe-inline' or 'unsafe-eval' in script-src, wildcard or scheme sources such as * or https:, hosts known to serve JSONP or old AngularJS, and missing object-src, base-uri and frame-ancestors. A directive that isn’t set falls back to default-src, and the evaluator follows that.
Is a strict CSP better than an allowlist?
OWASP’s cheat sheet calls a strict policy, built on nonces or hashes, “current leading practice”: easier to deploy and less likely to be bypassed than a list of allowed hosts, where any host that serves user-controlled script undoes the policy.
Does unsafe-inline still matter if I use a nonce?
Not in current browsers: when script-src has a nonce or a hash, 'unsafe-inline' no longer allows inline script (CSP Level 3, 6.7.3.2). Some policies keep it on purpose, so very old browsers still run the site’s scripts.
Can I put a CSP in a meta tag?
Yes, with limits. CSP Level 3 says a <meta> policy can’t carry frame-ancestors, report-uri or sandbox, and there is no Report-Only version of it. It also doesn’t cover anything the page loads before the tag. Send the policy as a header when you can.
How do I roll out a CSP without breaking my site?
Send it first as Content-Security-Policy-Report-Only, which blocks nothing and reports what it would block. Fix or allow what it reports, then switch to the enforcing header. Collect reports with report-to and a Reporting-Endpoints header, plus report-uri for older browsers.
Can Monity tell me when scripts on my pages change?
Yes. Monity’s script and connection watch, a monitoring skill on a page monitor, keeps an inventory of the scripts a page runs and where it sends data, and alerts you when they change. It helps with PCI DSS 6.4.3 and 11.6.1; it is evidence, not a certification.
What is a Content Security Policy?
A list of rules, usually sent in the Content-Security-Policy response header, that tells the browser which scripts, styles, frames and other resources a page may load or run (W3C Content Security Policy Level 3). Limiting script-src, object-src, base-uri and frame-ancestors reduces the damage of cross-site scripting and clickjacking.
Know when a page’s scripts change.
Watch scripts and connections.
Monity keeps an inventory of a page’s scripts and where they send data, and alerts you when it changes.
- Free 7-day trial
- No credit card
- 3 monitors free, forever