Headless Crawling
Automatically crawl your site with a deny-all report-only CSP, capturing every violation. Playwright-powered with configurable depth, page limits, and authentication support.
Generate production-ready CSP headers automatically
Content Security Policy headers are one of the strongest browser-side defences against XSS and data injection attacks, but writing them by hand is tedious and error-prone. CSP Analyser automates the process:
Content-Security-Policy-Report-Only headerThe tool runs entirely on your local machine. No data is sent to any external service.
| Use case | Command |
|---|---|
| Generate a CSP for a live website | csp-analyser crawl |
| Audit an existing CSP deployment | csp-analyser audit |
| Generate a CSP for static HTML (no browser) | csp-analyser hash-static |
| Browse a SPA manually and capture violations | csp-analyser interactive |
| Score a policy against best practices | csp-analyser score |
| Compare policies across crawl sessions | csp-analyser diff |
Export your generated policy in any of these formats:
header | meta | nginx | apache | cloudflare | cloudflare-pages | azure-frontdoor | helmet | json
See Export Formats for examples and deployment instructions.
CSP Analyser ships as both a standalone CLI and an MCP server for AI coding agents:
Need to analyse a site behind login? CSP Analyser supports:
See the Authentication guide for details.