Warning

The CSP allows eval

The short version

Remove 'unsafe-eval' and the code that needs it.

What it means

Your Content-Security-Policy includes 'unsafe-eval', which lets scripts turn text into code with eval(), new Function() or string arguments to setTimeout.

Why it matters

If an attacker can get text into a value your scripts later evaluate, 'unsafe-eval' lets it run as code. It is mostly needed by old libraries and some template engines that compile in the browser. Removing it is often the last step before a CSP gives real protection against injected code.

How to fix it

  1. Remove 'unsafe-eval' from the policy in report-only mode first and watch the console for errors.
  2. Replace eval() and new Function() with normal code or JSON.parse() for data.
  3. Pass functions, not strings, to setTimeout and setInterval.
  4. Update libraries; most current versions of template engines precompile templates at build time.
  5. If one library still needs it, consider loading that feature in a separate page or sandboxed frame.

Check it worked

Run the HTTP and security headers check again. The finding should be gone once 'unsafe-eval' is no longer in the policy.