How It Works Under the Hood
The auditor parses semicolon-separated CSP directives, flags high-risk tokens (`'unsafe-eval'`, `'unsafe-inline'` in scripts, wildcard `*`, or broad `http:` schemes), checks whether critical defenses (`default-src`, `script-src`, `object-src`, `frame-ancestors`, `base-uri`) are present, and compiles clean `_headers` + Nginx configurations.
Step-by-Step Instructions
Paste your existing `Content-Security-Policy` header string into Section 1 to audit warnings and grade (`Strong`, `Moderate`, `Weak`).
Review any missing hardening directives listed below the policy box.
Customize directive sources, `X-Frame-Options` (`DENY` vs `SAMEORIGIN`), and HSTS preload in Section 2.
Copy the generated Cloudflare Pages/Netlify `_headers` block or Nginx `add_header` rules.
Key Features & Performance
- Flags dangerous `'unsafe-eval'`, script `'unsafe-inline'`, and wildcard `*` CSP exposures instantly
- Detects missing foundational defenses (`object-src 'none'`, `base-uri 'self'`, `frame-ancestors`)
- Generates both Cloudflare Pages/Netlify `public/_headers` syntax and Nginx `add_header ... always;` snippets
- Includes `X-Content-Type-Options: nosniff`, `Referrer-Policy`, `Permissions-Policy`, and optional HSTS Preload
- 100% browser-local: safe for internal staging URLs and private API domain lists
Methodology, Formulas & Technical Standards
Scoring classifies high-severity execution bypasses (`'unsafe-eval'`, script `'unsafe-inline'`, `3+` missing critical directives) as `Weak`, warning-level exposures or minor gaps as `Moderate`, and locked-down self/allowlist policies as `Strong`.
Common Real-World Use Cases
- Eliminating SecurityHeaders.com / Mozilla Observatory grade deductions before launching a new SaaS site
- Creating a `public/_headers` file for Cloudflare Pages / Astro static sites
- Locking down iframe embedding via `frame-ancestors 'none'` and `X-Frame-Options: DENY`
- Tightening `connect-src` endpoints to permit only first-party and authorized API hosts
Worked Examples & Edge Cases
Flagging Script Unsafe-Inline
default-src 'self'; script-src 'self' 'unsafe-inline'
Grade: Weak | Missing: object-src, frame-ancestors, base-uri
Explains why `unsafe-inline` inside `script-src` permits injected inline scripts.
Cloudflare Pages _headers Output
allowFrames: DENY, enableHsts: true
/* Content-Security-Policy: ... X-Frame-Options: DENY Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Drop directly into `public/_headers` before `astro build`.
Limitations, Scope & Accuracy Notes
- • HSTS `preload` (`max-age=31536000; includeSubDomains; preload`) enforces HTTPS across all subdomains — test carefully before enabling on domains with plain HTTP subdomains.
- • Legacy static sites or third-party analytics embeds may require nonces or explicit domain entries inside `script-src` rather than strict `'self'`.
Local Browser Processing & Privacy
Traditional web converters upload your documents, snippets, or media files to remote servers. CSP Auditor & HTTP Security Headers Builder runs inside your browser tab:
Your input text and files are processed locally without uploading payloads to a processing server.
Microdeck does not log or store the files or inputs you paste into tool workspaces (normal static hosting/CDN requests still load page assets).
Working outputs stay in your browser tab and are released when you reset the tool or close the tab.
Frequently Asked Questions
Why does `'unsafe-inline'` inside `style-src` warn differently from `script-src`?
Inline `<script>` execution poses critical arbitrary XSS code-execution risk, whereas `style-src` inline styles often accompany Tailwind/UI libraries and represent a moderate/context-dependent risk.
Why are `object-src 'none'` and `base-uri 'self'` checked?
Even with strict `script-src`, omitting `base-uri` lets attackers rewrite relative script URLs via `<base>` injection, and omitting `object-src` risks legacy plugin execution.
Where do I place the Cloudflare `_headers` output?
Save it as `public/_headers` in Astro/Vite/Next static output so it lands at `dist/_headers` for Cloudflare Pages or Assets.
Does this probe my live domain over HTTP?
No. Auditing happens strictly on the policy string you paste inside your browser.
Explore Related Micro-Tools
SSL Certificate & CSR Decoder (PEM / DER)
Inspect X.509 .pem/.crt chains, SANs, expiry countdowns, CSRs & convert PEM ↔ DER
SHA Checksum & Webhook HMAC Verifier
Compute local file/text SHA-1/256/384/512 digests, verify SHA256SUMS manifests, and test HMAC-SHA256 webhook signatures
HAR Trace Inspector & Secret Redactor
Analyze slow HTTP .har waterfalls and scrub Cookies, Bearer tokens & API keys before sharing bug reports