Works on this device. File exports run online.
CSP Builder & Validator
Paste a Content-Security-Policy to see what it protects and where it is weak, or type a site’s address to check the policy it sends. Then build a better one: a strict policy with nonces, or an allowlist, with hashes for your inline scripts. Everything is checked in your browser.
Check a policy
The value, the whole header line, or the <meta http-equiv="Content-Security-Policy"> tag. Several policies may be separated by commas.
Policies of the live site
Build a policy
How to check a policy
- Paste the policy (the header value, the whole header line, or the <meta> tag) and choose how it is sent.
- Read the problems, warnings and notes, most serious first.
- Or type a web address under Check a live site to read the policies it sends.
What is checked
- Script injection (XSS): 'unsafe-inline' without a nonce or hash, 'unsafe-eval', *, https:, http:, data: and blob: in script-src, 'strict-dynamic' without a nonce or hash, a missing script-src and default-src.
- Known bypasses: script hosts that serve JSONP endpoints or old AngularJS copies (a short list), which can let an attacker run script even with an allowlist.
- Other protection: object-src 'none', base-uri, frame-ancestors (clickjacking), form-action, reporting with report-to or report-uri, upgrade-insecure-requests, Trusted Types.
- Syntax: unknown and removed directives, keywords without quotes (self instead of 'self'), malformed nonces and hashes, 'none' mixed with sources, directives listed twice, and directives that a <meta> tag cannot carry.
Building a strict policy
A strict policy gives every inline and loaded script a nonce (a new random value for each response) and adds 'strict-dynamic' so that scripts those scripts load are trusted too; object-src 'none' and base-uri 'none' close the remaining gaps. For inline scripts that never change, a hash works without a nonce. The builder never writes 'unsafe-inline' or 'unsafe-eval': they turn off the protection a policy is for.
Test a new policy as Content-Security-Policy-Report-Only first, read the reports, then switch to blocking.
Limits
The checks follow CSP Level 3 and the kind of checks Google’s CSP Evaluator makes, rewritten for Toolvito. A policy without findings can still allow scripts from hosts you trust but do not control, and it does not fix the injection bugs themselves.