webzod
account

Restrict where scripts can load from on WordPress

headers.csp.script_src_missing · effort: a project

Why it matters

The policy sets neither script-src nor default-src, so it does nothing against injected scripts, the main thing a CSP is for. Add a script-src that lists only your own origin and the services you use, or that uses nonces.

Staged change. Do this in stages and check each one before the next, so a mistake does not break your site or your mail.

The fix

  1. Stage 1: in your security-headers plugin or at the server or CDN, add script-src 'self' plus the script hosts your theme and plugins use, in report-only mode.
  2. Stage 2: enforce it. WordPress prints inline scripts, so a first enforced version may need 'unsafe-inline' in script-src until nonces are in place.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.