Your Content Security Policy allows unsafe-inline or unsafe-eval, exposing your site to XSS attacks and negating CSP protection.
By Seoxpert Editorial · Published
A weak Content Security Policy (CSP) with 'unsafe-inline' or 'unsafe-eval' directives leaves your site vulnerable to XSS attacks, risking user data and trust. Search engines may flag or penalize insecure sites, impacting SEO and user confidence.
Leaving this unresolved allows attackers to execute malicious scripts, compromising site security and user safety.
An automated crawler inspects the Content-Security-Policy HTTP header for the presence of 'unsafe-inline', 'unsafe-eval', or wildcard script sources.
Problematic CSP header
Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval' *;Secure CSP header using nonce
Content-Security-Policy: script-src 'self' 'nonce-abc123' https://trusted.cdn.com;'unsafe-inline' allows any inline script to run, making it easy for attackers to inject malicious code via XSS.
Use script nonces or hashes to allow only specific inline scripts, removing the need for 'unsafe-inline'.
'unsafe-eval' allows execution of code from strings, which can be exploited by attackers to run arbitrary scripts.
Yes, to remove 'unsafe-inline', you should refactor inline scripts to use nonces, hashes, or move them to external files.
Run a scan to see if Weak Content Security Policy (unsafe-inline/unsafe-eval) affects your pages.
Scan my website →