Content Security Policy checker and generator

A broken Content Security Policy gives teams false confidence while still allowing inline script execution. The CLI checks concrete directives across every crawled page and writes baseline directives for Nginx, Caddy, and Apache.

CSP weaknesses detected automatically

When a response has no Content-Security-Policy header, the scanner emits HDR-CSP-MISSING. When a policy exists, the parser inspects individual directives and raises HDR-CSP-WEAK for specific bypass conditions:

Audit CSP across multiple routes

web-vuln-scanner https://example.com --max-pages 20 --fix-config nginx --hide-passes

Example strict starter directive generated by --fix-config nginx when CSP is missing:

add_header Content-Security-Policy "default-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'" always;

Frequently asked questions

Why flag unsafe-inline when CSP already restricts script domains?

If script-src allows 'unsafe-inline', an attacker who injects an inline script block bypasses the domain whitelist completely.

Can I test staging with CSP report-only before enforcing?

Deploy Content-Security-Policy-Report-Only in staging first, verify browser reports are clean, then switch the header to enforcement mode and re-scan with --baseline.

Related guides

OWASP security headers checker

Inspect all seven core HTTP security headers in one scan.

Nginx, Caddy, and Apache fixes

Export complete header blocks tailored to detected findings.

JavaScript and SRI integrity audit

Pair CSP with Subresource Integrity on external CDN scripts.