Search by

yireo / magento2-csp-inspector

yireo

Magento module to help with inspecting CSP headers

Package info

github.com/yireo/Yireo_CspInspector

Type:magento2-module

pkg:composer/yireo/magento2-csp-inspector

Fund package maintenance!

yireo

www.paypal.me/yireo

Statistics

Installs: 107

Dependents: 0

Suggesters: 0

Stars: 4

Open Issues: 0

1.0.8 2026-11-25 18:54 UTC

This package is auto-updated.

Last update: 2026-11-28 21:46:50 UTC


README

Magento version PHP version License Latest Version

Simple CLI tool to inspect the current CSP headers of a specified Magento URL and report back the values - because it is too cumbersome to search for values in the browser.

Please note that this tool does NOT report issues with those CSP headers, it only inspects the currently generated HTTP headers. Use other tools like SanSec Watch or the M.Academy CSP Generator to fix your CSP headers.

Installation

composer require --dev yireo/magento2-csp-inspector
bin/magento module:enable Yireo_CspInspector

Usage

Report all policies and the mode of the homepage:

bin/magento csp:inspect

Report all policies and the mode of the cart-page:

bin/magento csp:inspect checkout/cart

Report all policy values for the policy script-src on the homepage:

bin/magento csp:inspect:policy script-src 

Options

Both commands support the following options:

  • --insecure (-k): Skip TLS certificate verification, for instance for a local environment with a self-signed certificate. Certificates are verified by default.
  • --follow-redirects: Follow HTTP redirects (up to 5) and inspect the final URL. By default, redirects are not followed: Instead, the redirect status and location are reported.

When a response contains both an enforced Content-Security-Policy header and a Content-Security-Policy-Report-Only header, both sets of policies are reported.

Current status

Static Tests Unit Tests Integration Tests Playwright DI Compilation