Content Security Policy (CSP) Header Strength Checker

Evaluate a CSP header string for security level and common misconfigurations

Ad placeholder (leaderboard)

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 *, or data: in script-src — each substantially weakens XSS protection.
  • Medium severity: missing default-src, object-src not set to 'none', missing frame-ancestors, or an http: source allowing mixed content.
  • Low severity: no nonce, hash, or strict-dynamic; 'unsafe-inline' styles; or a missing base-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.

Ad placeholder (rectangle)