Check explainer · v1

Content Security Policy: the header that limits what a page loads

Automated

Last reviewed

A CSP is the page telling the browser which origins may supply scripts, styles and frames. Without one, any injected line runs with the page’s full trust.

How this check works

The check looks for a content-security-policy response header, then a http-equiv meta fallback. A page with neither fails; either channel passes, with the source named in the result. The policy’s contents are not graded — presence is the baseline this rule owns.

What does a failure look like?

Templates that never set the header; a CMS that only ships CSP on checkout pages; a CDN that strips unknown headers — pages that look fine until an injected script demonstrates the absence.

How to fix it, step by step

  1. Ship a baseline policy at the edge or in application middleware, so every response carries it.
  2. When inline scripts exist, move to nonces or hashes rather than adding unsafe-inline.
  3. Re-run the audit and confirm the representative page reports the header.

What does a pass or fail look like?

Good

content-security-policy: default-src 'self'; script-src 'self' 'nonce-…'

Fail

Every page ships without a CSP — injected script gets the same trust as the page’s own code.

Frequently asked questions

Does CSP affect rankings?

Not directly. It is a hardening layer graded as hygiene: a page without it is not broken, but one injected script can rewrite what crawlers and users see. The rule makes the absence visible before that happens.

Is a meta CSP as good as the header?

Close enough to pass this baseline: the meta http-equiv form applies most directives, though the header is the stronger channel. The check accepts either and names the source it found.

Why not grade the policy’s contents?

Because policy design depends on the stack — nonces, third-party embeds, report endpoints. Presence is objective and gradeable; judging a specific policy would produce false failures on legitimate setups.

This rule is one of the checks the audit runs. Run the full site audit

Free preview; no account needed.

Visdenda check explainers · one page per published ruleContent Security Policy · v1