CSP Evaluator
Analyse a Content-Security-Policy for gaps and bypasses, in your browser.
Directives
| Directive | Sources |
|---|
About the CSP Evaluator
A Content Security Policy (CSP) tells the browser which sources may load scripts, styles, frames and other content. A strict policy is one of the most effective defences against cross-site scripting, but small mistakes such as unsafe-inline or a broad host allow-list can make it ineffective.
Paste the value of a Content-Security-Policy header. The evaluator lists each directive and flags common weaknesses with concrete fixes. To fetch a live site’s policy, use the security headers checker.
How to use it
- Paste the CSP value (without the header name).
- Review the findings, from most to least serious.
- Apply the fixes and re-check.
Frequently asked questions
What makes a CSP strict?
Scripts allowed only by nonces or hashes (optionally with strict-dynamic), no unsafe-inline or unsafe-eval for scripts, object-src none, base-uri none or self, and frame-ancestors to control embedding.
Why is a host allow-list not enough?
Many large script hosts (CDNs, Google domains) serve content that can be abused, such as JSONP endpoints or old library versions. An attacker who can inject a script tag pointing to them bypasses the policy. Nonces or hashes avoid this.
Should I start with Content-Security-Policy-Report-Only?
Yes, for an existing site: Report-Only shows what would break without blocking anything. Once the reports are clean, switch to the enforcing header.