Severity: MediumOwner: DevTime to fix: 30-90 min
Consent banner blocked by CSP
Update Content Security Policy so the CMP script, styles, or iframe resources can load without opening broader security gaps.
Covers: cmp_blocked_by_csp, consent_banner_csp_error
Why this matters
A strict CSP is good security hygiene, but if it blocks the CMP itself, the site can silently lose its entire consent layer in production.
How to verify manually
- Open DevTools console and look for CSP violations related to CMP assets.
- Check whether the banner script, CSS, iframe, or API endpoints are blocked.
- Compare local and production CSP behavior if the issue only appears in production.
Typical root causes
- CMP domains were not added to script-src, frame-src, or connect-src.
- Nonce or hash-based CSP rules do not include CMP inline bootstrap code.
- A deployment changed CSP headers without revalidating CMP dependencies.
GTM fix
- Avoid relying on GTM to work around a broken CSP if the CMP assets themselves are blocked.
- Review whether GTM-injected CMP fallbacks violate the same CSP rules.
- Re-test after CSP updates in production headers.
WordPress fix
- Check security plugins, host-level headers, and CDN rules that inject CSP.
- Whitelist the CMP domains actually used by your banner setup.
- Retest with browser cache disabled after header changes.
Generic fix
- Whitelist only the minimal CMP origins needed for scripts, frames, and API calls.
- Prefer targeted CSP updates instead of loosening the whole policy.
- Version-control your CSP rules and retest the banner whenever they change.
How to confirm the fix worked
- Confirm CSP errors for CMP assets disappear.
- Confirm the banner renders and accepts user input normally.
- Run a fresh scan and verify the banner issue clears.
Next step
Re-scan after deployment to confirm that the runtime behavior changed, not just the banner copy.