Skip to main content
Meowdit

Weak Content-Security-Policy Directives Explained

Content-Security-Policy (CSP) is a response header that tells browsers which script and resource sources a page is allowed to load or run. When a policy includes unsafe-inline, unsafe-eval or broad wildcards, injected scripts can still execute and bypass the protection against cross-site scripting (XSS). Running a content security policy checker reveals whether your active directives leave those gaps open.

What it is

You have a Content-Security-Policy, but parts of it (like unsafe-inline or wildcards) switch off much of its protection.

Why it matters

A weak CSP gives a false sense of safety: injected scripts can still run, which is exactly what CSP is meant to prevent.

Meowdit rates this high risk.

How to tell if your site has it

  • Open your browser developer tools, switch to the Network tab, click the main document request and inspect the Content-Security-Policy response header.
  • Look closely at script-src and default-src: markers such as unsafe-inline, unsafe-eval or bare wildcards signal a weakened policy.
  • Also inspect the page HTML for meta http-equiv policy tags, since some frameworks emit CSP in markup rather than HTTP headers.
  • Other scanners often report related findings as 'Content Security Policy (CSP) header not set' or 'CSP allows unsafe directives'.

Fix direction

Review where your server, CDN or framework emits the CSP header, narrow broad wildcard sources down to the specific origins your site actually uses, and replace inline-script allowances with a stricter authorization mechanism. Testing changes in report-only mode first helps catch breakage before enforcement, and a scan report outlines the tailored steps for your site.

A scan gives you the steps specific to your site, plus a fix prompt you can paste into an AI tool. See what a report looks like: View the public example report

FAQ

Why do unsafe-inline and wildcards weaken a CSP?
Allowing unsafe-inline lets any script embedded directly in the HTML run, so an attacker who injects markup can still execute code. Wildcards trust any external host, letting injected tags load scripts from attacker-controlled domains. Each weakens a different layer of defense depending on how the page is built.
How do external scripts, nonces and hashes compare when tightening CSP?
Moving inline code into external script files keeps the policy simple for mostly static sites. Nonces issue a fresh per-response token suited to server-rendered pages, while hashes pin fixed inline snippets that rarely change. Each option carries different caching and maintenance trade-offs depending on your stack.
Can I test a stricter CSP without breaking live visitors?
Yes. Browsers support a report-only header that logs policy violations to the console or a reporting endpoint without blocking resources. Observing those reports first lets you spot legitimate third-party scripts or styles before turning on enforcement.

References

Related checks

Related guides

All checks · View the public example report

This page was written and checked by AI and has not been reviewed by a person, so please verify before applying; see About Meowdit. Last updated: 2026-11-22