Search by

yireo / magento2-disable-csp

yireo

Disable CSP

Package info

github.com/yireo/Yireo_DisableCsp

Type:magento2-module

pkg:composer/yireo/magento2-disable-csp

Fund package maintenance!

yireo

www.paypal.me/yireo

Statistics

Installs: 189 778

Dependents: 0

Suggesters: 0

Stars: 22

Open Issues: 0

1.0.5 2026-11-26 01:08 UTC

This package is auto-updated.

Last update: 2026-11-28 22:51:53 UTC


README

Magento version PHP version License Latest Version

For shops that don't need CSP to be enabled, this module offers a quick solution. Just install and enable the module and you're done.

Technically, it replaces the default implementation of Magento\Csp\Api\CspRendererInterface with a dummy. Next, it disables the Subresource Integrity (SRI) features of the Magento_Csp module: The DI plugins that generate, store and apply integrity hashes (including the Magento 2.4.9 plugins that add integrity attributes to merged scripts and position the SRI hashes in the head), the integrity post-processor of bin/magento setup:static-content:deploy, plus the sri.js script and the window.sriHashes block on the checkout, the multishipping checkout and the admin order creation page.

Security considerations

Before using this module, be aware of what you are giving up:

  • No Content-Security-Policy (or Content-Security-Policy-Report-Only) header is sent anymore, in all areas, including the Magento Admin Panel. Violations are no longer reported either.
  • No integrity attributes are added to scripts on payment pages anymore.
  • PCI DSS 4.0 requirements 6.4.3 and 11.6.1 require you to manage and monitor scripts on payment pages. With this module enabled, you need an alternative way to meet these requirements.

If you only want to get rid of blocked resources without losing insight, consider using the report-only mode of Magento instead:

bin/magento config:set csp/mode/storefront/report_only 1
bin/magento config:set csp/mode/admin/report_only 1

Any previously generated pub/static/*/sri-hashes.json files are no longer used by Magento with this module enabled and can be safely removed.

Usage

composer require yireo/magento2-disable-csp
bin/magento module:enable Yireo_DisableCsp

Remark

The magento/module-csp package is still necessary and should not be removed via composer replace.

Alternatives

Current status

Static Tests Unit Tests Integration Tests Playwright DI Compilation