CSP Generator
- Runs in your browser
- Graded as you build
Choose your policy
Your Content-Security-Policy
Replace {RANDOM} on every response
Content-Security-Policy: default-src 'self'; script-src 'nonce-{RANDOM}' 'strict-dynamic'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'self'add_header Content-Security-Policy "default-src 'self'; script-src 'nonce-{RANDOM}' 'strict-dynamic'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'self'" always;Header always set Content-Security-Policy "default-src 'self'; script-src 'nonce-{RANDOM}' 'strict-dynamic'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'self'"<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'nonce-{RANDOM}' 'strict-dynamic'; object-src 'none'; base-uri 'none'; form-action 'self'">The meta tag leaves out frame-ancestors, report-uri and report-to, which browsers ignore in a meta tag.
How the CSP evaluator grades it
100/100
Starting points
Introducing Vigilbase OS
The cybersecurity operating system.
Connect the security tools you already pay for. Spin up personalised dashboards in minutes, with every log and event auditable and queryable in one place.
Acme Security OS
events | where severity >= medium | last 24h- Investigate Credential-stuffing burst against /login
- Fix Rate-limit rule deployed at the edge
- Verify Attack traffic down 98% in five minutes
What is a CSP generator?
A CSP generator assembles a Content-Security-Policy header from your answers about where pages load scripts, styles, images and frames from. This one starts from the strict CSP that the CSP Level 3 specification describes (scripts allowed by nonce or hash with 'strict-dynamic', object-src 'none' and base-uri 'none') and grades the result with the same rules as the CSP evaluator.
Deploy a new policy as Content-Security-Policy-Report-Only first, read the reports, fix what they show, then enforce it.
How to deploy a Content-Security-Policy
1. Choose how scripts are trusted
Nonces suit pages generated per request: your application adds a fresh random value to the header and to every script tag. Hashes suit static pages whose inline scripts never change. A host allowlist is the weakest option.
2. Add the hosts your pages need
List the image, font, API and frame hosts your pages use. With 'strict-dynamic', scripts that a trusted script loads need no host entry.
3. Start in Report-Only
Send the policy as Content-Security-Policy-Report-Only with a report endpoint, fix what it reports, then switch to Content-Security-Policy.
4. Send it as a response header
A meta tag cannot carry frame-ancestors, report-uri, report-to or sandbox, and cannot deliver a Report-Only policy. On Cloudflare, a response header transform rule can set a hash- or allowlist-based header for a zone; a nonce has to be generated for each response by your application.
Related checks and next steps
- CSP Evaluator
Paste an existing policy or fetch one from a URL and grade it.
- HTTP Security Headers Checker
Check that the header you deployed is live, with nine other security headers.
- HSTS Checker
Check Strict-Transport-Security and HSTS preload eligibility.
- Cloudflare WAF
How Cloudflare WAF rules work, and how Vigilbase sets them up and tunes them under change control.
Managed Cloudflare
Keep Cloudflare configured, monitored and improving. Vigilbase handles agreed changes and incident response, with Core, Priority and Critical coverage options.
Explore Managed CloudflareManaged SOC
Managed SOC on the security tools you already pay for. The Vigil agent investigates, our analysts handle exceptions, and coverage follows your SLA tier.
Explore Managed SOC