webzod
account

Replace 'unsafe-inline' scripts with nonces or hashes on Shopify

headers.csp.script_unsafe_inline · effort: a project

Why it matters

With 'unsafe-inline' any script an attacker manages to inject into the page runs, which cancels most of what a CSP protects. Nonces or hashes let only the inline scripts you wrote run.

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

Not possible on Shopify. Shopify's own header has no fetch directives, so this policy comes from a meta http-equiv Content-Security-Policy tag in layout/theme.liquid or from an app, which you can edit. But Shopify and apps print inline scripts and Liquid cannot make per-response nonces, so removing 'unsafe-inline' would break the store.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.