webzod
account

Reduce reliance on inline styles

headers.csp.style_unsafe_inline · effort: a project

Why it matters

'unsafe-inline' in style-src lets injected style tags restyle the page, which can hide content or leak data through crafted CSS. It is common and lower risk than inline scripts, so treat it as a later improvement.

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. Move inline style blocks into stylesheets, or give them the same per-response nonce as your scripts or a hash. Style attributes need 'unsafe-hashes' or removal.
  2. Stage 1: try style-src without 'unsafe-inline' in Content-Security-Policy-Report-Only. Stage 2: enforce it once nothing your pages need is reported.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.