CSP evaluator
Paste a Content Security Policy and see what weakens it: unsafe-inline, wildcards, a missing object-src or base-uri, and deprecated directives. In your browser.
Paste the value of the header, with or without the header name.
Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the CSP evaluator
- Copy the Content-Security-Policy value from your response headers.
- Paste it, with or without the header name.
- Read the findings, worst first. Each says why it matters and what to change.
- Fix the policy and paste it again until only the notes you accept remain.
About this tool
A Content Security Policy only helps if it actually restricts scripts. Many policies in production do not: they allow inline script, or every HTTPS host, or forget the directives that have no fallback. This evaluator reads a policy the way a browser does under CSP Level 3 and lists what an attacker could still use.
The precedence rules matter and are easy to get wrong. When a nonce or a hash is present, browsers ignore 'unsafe-inline', so it is a harmless fallback there and not a finding. With 'strict-dynamic', host and scheme sources are ignored too. Without a nonce or a hash, 'unsafe-inline' in script-src means injected script runs. The tool also checks default-src when script-src is absent, because that is what the browser falls back to.
Three directives never fall back to default-src: base-uri, form-action and frame-ancestors. A policy with default-src 'none' and nothing else still lets a page be framed. The checks here are a set of rules and do not replace a review: a policy can pass them and still list a host that serves attacker-controlled scripts.
Sources
Questions
In script-src it is, unless the same directive also has a nonce or a hash. Browsers that support CSP Level 2 or later ignore 'unsafe-inline' when a nonce or hash is present, so it only acts as a fallback for very old browsers. In style-src it is a smaller risk and often hard to avoid.
object-src controls plugin content loaded with object and embed tags, which can run code outside the script rules; set it to 'none'. base-uri controls the base tag, which changes where relative URLs point. It does not inherit from default-src, and without it an injected base tag can redirect a trusted script to another server.
A scheme source allows every host on that scheme. Anyone can serve a script over HTTPS, so script-src https: lets an injected script tag load code from the attacker’s own server. The exception is a policy with a nonce and 'strict-dynamic', where browsers ignore scheme sources.
CSP Level 3 deprecates report-uri in favour of report-to with a Reporting-Endpoints header. Browser support for report-to is still uneven, so sending both is the practical answer. A browser that understands report-to ignores report-uri.