Headers Security
critical Severity
Free Check

Content Security Policy (CSP)

Restricts sources from which scripts, styles, and assets can load to prevent XSS and code injection.

Test Your Website for Content Security Policy (CSP)

Run this check along with 90+ automated tests across your domain.

Why It Matters

Cross-Site Scripting (XSS) allows attackers to steal user session cookies, log keystrokes, and execute unauthorized actions. A strict CSP provides essential defense-in-depth even if an input sanitization flaw exists.

How We Check This

We evaluate Content-Security-Policy headers for missing directives (default-src, script-src, object-src, frame-ancestors) and dangerous wildcards or 'unsafe-inline' tokens.

How to Fix & Implement

Copy-paste configuration blocks tailored for your web server or edge proxy.

nginx snippet
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'nonce-$request_id'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' https:; frame-ancestors 'none'; base-uri 'self';" always;

Frequently Asked Questions

Why is unsafe-inline flagged in CSP?

Because it allows malicious scripts injected into DOM innerHTML or HTML attributes to run without restriction.