Skip to main content

How to fix: CSP contains unsupported / legacy directives

The CSP names a directive browsers no longer implement (allow-http, reflected-xss), or its script-src combines 'none' with 'unsafe-inline' or 'unsafe-eval'. Directive names are matched as names, so a host or report endpoint whose path happens to contain one of those words is not reported.

Why it matters

Remove legacy directives like allow-http and reflected-xss

allow-http (Chrome 41-65) and reflected-xss were both removed and are silently ignored, so a policy relying on either has a gap it does not know about. A permissive script-src alongside a restrictive default-src is not reported here: default-src is a fallback that script-src is specified to override, and a genuinely wildcard script-src is covered by csp-wildcard-source.

How to fix it

  1. 1Remove legacy directives like allow-http and reflected-xss

Code examples

Fix incompatible CSP directive combinations

JavaScript
// Common incompatibilities:
// - report-uri + report-to (use only report-to in CSP Level 3)
// - block-all-mixed-content + upgrade-insecure-requests (pick one)
// - 'unsafe-inline' + nonce (nonce overrides unsafe-inline in CSP3)
export default {
  async headers() {
    return [{ source: "/(.*)", headers: [{
      key: "Content-Security-Policy",
      value: "default-src 'self'; script-src 'self'; object-src 'none'; upgrade-insecure-requests;"
    }]}];
  },
};

References

Detected automatically by VulnRadar. The check id is csp-incompatible-directives, stable across every scan so you can filter or diff on it.

See every headers check

Questions

How severe is CSP contains unsupported / legacy directives?
VulnRadar rates this low severity in the headers category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id csp-incompatible-directives, which stays the same between runs so you can filter, diff, or gate CI on it.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for csp contains unsupported / legacy directives

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

CSP contains unsupported / legacy directives fix | VulnRadar