Boneyard Tools

Content-Security-Policy Analyzer

Paste a Content-Security-Policy header to see it broken into directives and audited for common weaknesses such as unsafe-inline, unsafe-eval and wildcards. Each finding shows a severity and a concrete fix. Everything runs in your browser.

How to analyze a CSP header

  1. Paste the value of your Content-Security-Policy header into the box.
  2. Read the parsed directives and the list of findings sorted by severity.
  3. Apply the recommended fixes, then re-paste the updated policy to confirm.

Examples

A weak policy

default-src 'self'; script-src 'self' 'unsafe-inline'
HIGH: 'unsafe-inline' in script-src; missing object-src, base-uri and frame-ancestors

Frequently asked questions

Is my CSP sent to a server?

No. The policy is parsed and audited entirely in your browser using plain string analysis. Nothing is uploaded, logged or stored, so it is safe to paste a header from a production site.

What does 'unsafe-inline' mean and why is it risky?

'unsafe-inline' tells the browser to allow inline <script> blocks and inline event handlers (and inline styles for style-src). That is exactly what most cross-site scripting (XSS) payloads rely on, so it largely defeats the protection CSP is meant to provide. Use a nonce or hash allowlist instead.

Why do object-src and base-uri matter?

object-src controls legacy plugin content such as <object> and <embed>; setting it to 'none' removes an old but real attack surface. base-uri controls where a <base> tag may point, and without it an injected <base> can silently rewrite where every relative URL on the page resolves, redirecting script and form loads to an attacker.

What is the difference between a nonce and a hash in script-src?

A nonce is a random per-response token you put on both the header and each trusted <script>; a hash is the base64 SHA digest of a specific inline script's contents. Either one lets the browser run only the inline scripts you explicitly approve, which is the recommended replacement for 'unsafe-inline'.

Does a clean report mean my site is secure?

No. The analyzer checks for common, well-known CSP weaknesses, but a real policy depends on your app's exact sources and behavior. Treat the findings as a strong starting point, then test the policy in report-only mode before enforcing it.

Learn more

Related tools