A Content Security Policy is one of the strongest defences against cross-site scripting and data injection, but a single weak source can quietly undo it. This checker parses your CSP header, flags the patterns attackers exploit, and scores the overall strength so you can harden it directive by directive.
How it works
The tool splits the header on semicolons into directives and inspects the
effective sources, falling back to default-src where a specific directive is
absent. It then applies a weighted penalty for each risky pattern it finds:
- High severity:
'unsafe-inline','unsafe-eval', a wildcard*, ordata:inscript-src— each substantially weakens XSS protection. - Medium severity: missing
default-src,object-srcnot set to'none', missingframe-ancestors, or anhttp:source allowing mixed content. - Low severity: no nonce, hash, or
strict-dynamic;'unsafe-inline'styles; or a missingbase-uri.
The score starts at 100 and each penalty is subtracted, giving a final strength figure and a band of Weak, Moderate, or Strong.
Example
The policy script-src 'self' 'unsafe-inline' parses cleanly but loses 30 points
for 'unsafe-inline', because inline scripts can execute and defeat the policy.
Replacing it with a per-request nonce and adding frame-ancestors 'none' and
base-uri 'self' recovers most of the score.
Tips and notes
Aim to remove 'unsafe-inline' and 'unsafe-eval' entirely, prefer nonces or
hashes with strict-dynamic, and always set object-src 'none',
frame-ancestors, and base-uri. The checker only reads the string you paste, so
it cannot confirm that your nonces are genuinely unique per response — verify that
in your application.