Download the PHP package stacknuts/magento-csp-debug without Composer
On this page you can find all versions of the php package stacknuts/magento-csp-debug. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stacknuts/magento-csp-debug
More information about stacknuts/magento-csp-debug
Files in stacknuts/magento-csp-debug
Package magento-csp-debug
Short Description Magento 2 module that adds a configurable CSP debug panel to the frontend layout.
License MIT
Homepage https://github.com/StackNuts/magento-csp-debug
Informations about the package magento-csp-debug
StackNuts CSP Debug
See your storefront's actual Content Security Policy right on the page — no devtools required.
Why
Magento assembles its CSP from several places at once — core defaults, admin config, and
rules added by third-party modules via config.xml or csp_whitelist.xml. Today, the only
way to see what actually ends up in the header is to load the page and dig through the
network tab by hand, every time you add a script, an iframe, or a third-party integration.
This module surfaces that same information directly on the page: a small icon that opens a panel listing every active directive exactly as Magento assembled it. You can tell in seconds whether the CSP will block something you just added, instead of finding out from a console error later.
Screenshots
A small padlock icon sits fixed in the corner of the storefront whenever the panel is active:
Clicking it opens the panel:
On a Hyvä store, the same panel renders natively in Tailwind CSS and Alpine.js instead — no jQuery/RequireJS modal:
Installation
The module ships a LESS partial, so redeploy static content for your theme afterwards:
Hyvä compatibility
If a Hyvä theme is active, the module automatically swaps in a Hyvä-native
version of the panel — same data, rebuilt with Tailwind CSS and a native <dialog> +
Alpine.js modal, no extra configuration needed. This is wired through Hyvä's own hyva_
layout-handle convention, so it has zero effect on Luma installs and needs no separate
compatibility module.
Enabling it
Stores → Configuration → Security → Content Security Policy (CSP) → Debug → Enable CSP debug panel
The panel needs both of these to be true before it renders: the toggle above is on, and the
request already has developer-level access — developer mode, or an IP allow-listed under
dev/restrict/allow_ips. Leave it enabled in production and it simply stays invisible to
everyone else.
Requirements
- PHP 8.1 – 8.4
- Magento 2 with
Magento_Csp(bundled with core since 2.3.5) - Optional:
hyva-themes/magento2-theme-module^1.5
Contributing
See https://github.com/StackNuts/magento-csp-debug/issues
License
MIT — see LICENSE.
All versions of magento-csp-debug with dependencies
magento/framework Version >=103.0 <104
magento/module-csp Version >=100.4 <101
magento/module-developer Version >=100.4 <101
magento/module-store Version >=100.0 <102