NetSecTools

All tools / Web & Network / CSP Analyzer & Builder

CSP Analyzer & Builder

Audit any Content-Security-Policy header for XSS, clickjacking and wildcard risks, or build a strict policy ready for Cloudflare and Nginx.

Try:
Both parsing and building run 100% locally in your browser. Policies you paste or generate are never transmitted or stored.

About this tool

A Content-Security-Policy (CSP) header is one of the strongest browser defences against cross-site scripting (XSS), data injection and clickjacking. However, small mistakes such as leaving 'unsafe-inline', 'unsafe-eval' or wildcard * in script-src silently weaken the whole policy.

This tool runs completely in your browser with two modes: Analyze CSP audits an existing policy directive by directive, and Build CSP lets you toggle directives or apply presets to generate copy-ready headers for raw HTTP, Cloudflare Pages (_headers) and Nginx.

Security tips

  • Avoid 'unsafe-inline' and 'unsafe-eval' in script-src; use nonces, SHA-256 hashes or external 'self' scripts instead.
  • Always include object-src 'none', base-uri 'self' (or 'none') and frame-ancestors 'none' (or 'self').
  • Roll out strict changes with Content-Security-Policy-Report-Only first so you can catch unexpected breaks before enforcing.

Frequently asked questions

Why is 'unsafe-inline' flagged as High Risk in script-src?

If script-src allows 'unsafe-inline' without a nonce, hash or 'strict-dynamic', any attacker who injects an inline <script> tag or event handler can execute arbitrary JavaScript.

What does object-src 'none' protect against?

It blocks legacy browser plugins such as <object>, <embed> and <applet>, which have historically been abused to bypass script restrictions.

Why does duplicate directive order matter?

Per the CSP specification, browsers apply only the first occurrence of a duplicated directive and silently ignore any subsequent duplicates.

Related guides

Related tools