How to use CSP Generator and Pasted-Policy Checker
- Choose Draft a policy and a same-origin baseline, or choose Check a policy I paste and enter the existing policy value.
- For a draft, allow only the extra styles, scripts, fonts or frames your site needs. Review every permission added to the source lists.
- Optionally choose a Report-Only header. To obtain a script hash, paste the exact inline script body without script tags.
- Run Build or check the policy. Read the directive table and findings; the checker examines text structure, not the resources your pages load.
- Test the draft on a private test host in report-only mode before enforcement. Configure reporting separately, exercise the relevant pages and adapt the sources to their actual requests.
Example: CSP Generator and Pasted-Policy Checker
Draft the same-origin baseline with all extra permissions off.
Options
- Draft a Report-Only header
- Observes violations without enforcing this draft. Configure your own reporting destination separately.
- Exact inline script text to hash (optional)
- Script body only, without script tags. Up to 8,000 characters. Spaces and line endings affect the hash.
- What do you want to do
- Choose Draft a policy, Check a policy I paste.
- Baseline
- Used when drafting. Both baselines start from default-src 'self' and allow no outside host.
- Allow inline styles
- Adds 'unsafe-inline' to style-src in the draft. Enable it only when you intend to permit inline styling.
- Allow inline scripts
- Widens script-src and gives up much of what the policy is for.
- Allow eval and similar string-built code
- Adds 'unsafe-eval' to script-src. This loosens the draft policy for code built from strings; leave it off unless your application requires it.
- Allow Google Fonts
- Adds the Google Fonts stylesheet and font-file origins to the relevant directives. It does not inspect which font resources your site actually loads.
- Allow YouTube embeds
- Adds the supported YouTube frame origins to frame-src. Check the embed URLs your own page uses.
- Add upgrade-insecure-requests
- Adds the upgrade-insecure-requests directive to the draft. Review the effect on HTTP resource URLs before enforcing the policy.
- Policy to check
- Used in check mode. Paste the policy exactly as it appears in the header or meta tag.
Supported inputs and limits
- Policies and optional inline script text are limited to 8,000 characters each.
- The checker reads a fixed directive list and supported source syntax without fetching a URL or inspecting response headers.
- Unknown names need review against the specification and browser support.
- Drafts are not tested against your site.
- Report-Only requires a response header and a separately configured reporting destination; it cannot be delivered through a meta tag.
More details
Meta output omits frame-ancestors, reporting directives and sandbox.
An exact UTF-8 script hash is displayed separately for you to add to script-src.
No nonce is generated.
Where your input is processed
This tool does not upload your inputs. See the limits for anything saved on your device.
Start with the requests your pages actually need
Both baselines begin with default-src self and no outside host. The extra controls widen particular directives for the supported use cases. They do not discover which resources your pages load. In report-only mode, inspect the console and configured reports while testing the relevant pages and actions. A quiet test covers those exercised flows only; new resources can require another review.
Keep exact script hashes and response nonces distinct
The optional script field hashes the supplied body as UTF-8. A different space or line ending changes the hash. Copy its quoted sha256 token into the appropriate script-src list yourself; the draft does not insert it. A nonce is a different mechanism and needs fresh, unpredictable server-side generation for each response. This page does not generate or reuse one.
Questions about CSP Generator and Pasted-Policy Checker
Does a clean check mean my site is secure?
No. It means the checker found no supported structural issue in the pasted text. It does not test your pages, confirm browser enforcement or assess the application for vulnerabilities.
Why is report-uri only a note?
It is deprecated in CSP Level 3 in favour of report-to, but many browsers still collect reports from it. Keeping both while support catches up is a common choice, so the checker advises instead of demanding a change.
Can it check the policy my site already sends?
Not directly, because nothing here makes a request. Open the response headers in your browser's network panel or in your server configuration, copy the Content-Security-Policy value, and paste that text into the policy box.
Why is a directive I copied called unknown?
The checker holds the directive names from CSP Level 3. A vendor-specific name, a newer draft name, or a misspelling is reported as unknown so you can check it against the specification rather than trusting a typo.
Will the drafted policy break my site?
It can. The same-origin baselines block outside hosts unless you add the relevant permissions, and inline scripts or styles may also need changes. Exercise the site with a report-only header on a test host, then review the findings before enforcement.