Aegisify company logo

We're Here to Help

Resources & Help Center

Search our knowledge base, view documentation, or get support. Everything you need in one place.

Should I allow inline JavaScript in my Aegisify Shield CSP?

Allow inline scripts is a checkbox under Script sources in the Aegisify Shield CSP Builder (Pro). When ticked, Shield adds 'unsafe-inline' to the script-src directive. It is off by default.

What “inline” means

Inline scripts are written directly in the page HTML, such as <script>...</script> blocks or onclick="..." attributes, rather than loaded from a separate file.

Why it weakens protection

Most cross-site scripting attacks inject inline script. If inline scripts are allowed, the browser cannot tell your legitimate inline code apart from an attacker’s, so CSP loses much of its value against XSS.

When you might need it

Some WordPress themes, page builders, analytics snippets, and plugins output inline scripts. If enforcing script-src breaks them, allowing inline scripts may be a temporary compatibility step.

A better long-term approach

  • Ask the plugin or theme vendor whether they support CSP nonces or hashes.
  • Move custom inline code into external .js files.
  • Remove plugins that require inline scripts but are not essential.

Shield warns you

When inline scripts are allowed while script sources are enforced, Shield shows a configuration warning so it is not forgotten.

Related: CSP script sources, Allow inline CSS.

2026-12-01T03:49:30+00:00January 13th, 2026||

Find this article interesting, please share.