PHPackages                             stacknuts/magento-csp-debug - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. stacknuts/magento-csp-debug

ActiveMagento2-module[Debugging &amp; Profiling](/categories/debugging)

stacknuts/magento-csp-debug
===========================

Magento 2 module that adds a configurable CSP debug panel to the frontend layout.

v1.1.0(1mo ago)11↓66.7%1MITPHPPHP ~8.1.0||~8.2.0||~8.3.0||~8.4.0

Since Jul 17Pushed 1w agoCompare

[ Source](https://github.com/StackNuts/magento-csp-debug)[ Packagist](https://packagist.org/packages/stacknuts/magento-csp-debug)[ Docs](https://github.com/StackNuts/magento-csp-debug)[ RSS](/packages/stacknuts-magento-csp-debug/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

 [![StackNuts CSP Debug](./.github/banner.png)](./.github/banner.png)

StackNuts CSP Debug
===================

[](#stacknuts-csp-debug)

[![Latest Version](https://camo.githubusercontent.com/b0263a619e7db6a4f179275770852a2a90e8a54a340c8af74c4c050c648f1f2c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737461636b6e7574732f6d6167656e746f2d6373702d64656275672e737667)](https://packagist.org/packages/stacknuts/magento-csp-debug) [![License](https://camo.githubusercontent.com/ce1eb52aa969e07427aa141ee48e96e4b1249fdc8e9ab22e11e587ee8d82c6b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f737461636b6e7574732f6d6167656e746f2d6373702d64656275672e737667)](https://github.com/StackNuts/magento-csp-debug/blob/main/LICENSE) [![PHP Version](https://camo.githubusercontent.com/23520a391679ca402dcce68b02b25abdb0f25c173a329649bc6b1913f9ce007b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f737461636b6e7574732f6d6167656e746f2d6373702d64656275672e737667)](https://packagist.org/packages/stacknuts/magento-csp-debug)

See your storefront's actual Content Security Policy right on the page — no devtools required.

Why
---

[](#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
-----------

[](#screenshots)

A small padlock icon sits fixed in the corner of the storefront whenever the panel is active:

[![Padlock icon in the bottom-right corner of the storefront](.github/screenshots/padlock-icon.png)](.github/screenshots/padlock-icon.png)

Clicking it opens the panel:

[![CSP Debug modal showing active directives](.github/screenshots/debug-modal.png)](.github/screenshots/debug-modal.png)

On a [Hyvä](https://hyva.io) store, the same panel renders natively in Tailwind CSS and Alpine.js instead — no jQuery/RequireJS modal:

[![CSP Debug modal rendered with Hyvä's Tailwind CSS and Alpine.js](.github/screenshots/debug-modal-hyva.png)](.github/screenshots/debug-modal-hyva.png)

Installation
------------

[](#installation)

```
composer require stacknuts/magento-csp-debug
bin/magento module:enable StackNuts_CspDebug
bin/magento setup:upgrade
```

The module ships a LESS partial, so redeploy static content for your theme afterwards:

```
bin/magento setup:static-content:deploy -f en_US
# or, in a grunt-enabled dev environment:
grunt exec:luma && grunt less:luma
```

### Hyvä compatibility

[](#hyvä-compatibility)

If a [Hyvä](https://hyva.io) theme is active, the module automatically swaps in a Hyvä-native version of the panel — same data, rebuilt with Tailwind CSS and a native `` + 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
-----------

[](#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
------------

[](#requirements)

- PHP 8.1 – 8.4
- Magento 2 with `Magento_Csp` (bundled with core since 2.3.5)
- Optional: [`hyva-themes/magento2-theme-module`](https://docs.hyva.io) ^1.5

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md). Issues:

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance95

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

46d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8597859?v=4)[Philip Rowe](/maintainers/PhilRowe)[@PhilRowe](https://github.com/PhilRowe)

---

Top Contributors

[![PhilRowe](https://avatars.githubusercontent.com/u/8597859?v=4)](https://github.com/PhilRowe "PhilRowe (6 commits)")

---

Tags

cspdebuggingmagento-certified-developermagento2magento2-modulemagento2-module-freedebugsecuritycspcontent-security-policymagento2hyva

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stacknuts-magento-csp-debug/health.svg)

```
[![Health](https://phpackages.com/badges/stacknuts-magento-csp-debug/health.svg)](https://phpackages.com/packages/stacknuts-magento-csp-debug)
```

###  Alternatives

[mollie/magento2

Mollie Payment Module for Magento 2

1162.0M19](/packages/mollie-magento2)[fastly/magento2

Fastly CDN Module for Magento 2.4.x

1564.5M2](/packages/fastly-magento2)[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8054.9M55](/packages/smile-elasticsuite)[run-as-root/magento2-prometheus-exporter

Magento2 Prometheus Exporter

68365.7k](/packages/run-as-root-magento2-prometheus-exporter)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1019.5k30](/packages/loki-magento2-components)[mage-os/module-admin-activity-log

The Admin Activity extension makes it easy to track all admin activity with comprehensive audit logging.

2920.6k1](/packages/mage-os-module-admin-activity-log)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
