CSPValidator is a practical Content Security Policy (CSP) analysis tool focused on real-world security impact.
It detects exploitable CSP directives, maps them to real payloads, generates a hardened CSP, and provides a clear security score — without noise or false positives.
- 🔍 Detects CSP misconfigurations
- 💥 Shows exploitable directives with payloads
- 🧱 Generates OWASP-aligned hardened CSP
- 📊 CSP security score (0–100)
- 💾 Save hardened CSP only (clean output)
pipx install git+https://github.com/dipakpanchal05/cspvalidator
cspvalidator -hcspvalidator -u https://example.comcspvalidator -f domains.txtcspvalidator -s "default-src *; script-src 'unsafe-inline'"cspvalidator -s csp.txtcspvalidator -u https://example.com -vulncspvalidator -u https://example.com -scorecspvalidator -u https://example.com -hardencspvalidator -u https://example.com -score -vuln
cspvalidator -u https://example.com -vuln -hardenShows:
- Target
- Score
- Vulnerable directives + payloads
- Hardened CSP
- Suggestions
cspvalidator -u https://example.com -o hardened_csp.txt- Saves only hardened CSP
- Works on Windows & Linux
- Supports relative and absolute paths
- 100 → Strong CSP
- 0 → Broken CSP
Score penalties include
default-src *script-src 'unsafe-inline'- Wildcards
- Missing
object-src,base-uri,frame-ancestors
- Removes insecure values (
*,'unsafe-inline') - Preserves domains but warns
- Enforces:
- Nonce +
strict-dynamic - Trusted Types
- Object isolation
- Mixed-content protection
- Nonce +
Nothing is added unless missing.
Nothing is suggested unless changed.
Suggestions are generated only when actual changes occur:
Example:
1. Removed insecure directives: default-src *, script-src 'unsafe-inline'
2. Added missing directives: object-src, base-uri, frame-ancestors
3. Preserved risky domain https://maps.googleapis.com (consider removal)
- OWASP CSP Cheat Sheet. here
- DOM XSS mitigation.
- JSONP risk awareness.
- Modern browser enforcement.
Made by </th3.d1p4k>
Security-first. Real exploits only.
