Search by

sisl-source / magento2-csp-whitelist

SISL-source

Control CSP via the admin area

Package info

github.com/SISL-source/magento2-csp-whitelist

Type:magento2-module

pkg:composer/sisl-source/magento2-csp-whitelist

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-09-15 12:51 UTC

This package is auto-updated.

Last update: 2026-09-18 17:26:21 UTC


README

Manage your Content Security Policy whitelist from the Magento admin panel instead of editing and deploying csp_whitelist.xml by hand. Add allowed hosts per policy (script-src, style-src, font-src, …) in Stores → Configuration → Cti → CSP Whitelist, save, flush cache — done.

This is a maintained fork of ctidigital/magento2-csp-whitelist, verified to install and run on Magento 2.4.9 / PHP 8.4.

Why this fork exists

Magento 2.4 ships Content Security Policy in report-only mode and expects you to whitelist every third-party host (analytics, payment iframes, chat widgets, CDNs) in an XML file that lives in your theme/module and needs a deploy to change. This module moves that whitelist into the admin panel, so marketing and ops can add a blocked host without a developer and a release.

The upstream module had no release since 2021 and its composer.json declared no require section at all — Composer would install it on any Magento/PHP version without warning, so a shop could pull it onto an incompatible release and only find out in production. This fork declares proper constraints and is tested end-to-end on Magento 2.4.9.

What changed vs upstream

  • Added require: php 8.1–8.5 and magento/framework >=103.0.4 <104 (Magento 2.4.6–2.4.9), so Composer refuses incompatible installs instead of failing silently later.
  • Verified on Magento 2.4.9 / PHP 8.4: setup:upgrade, module:enable and storefront rendering with the plugin active, no errors.

Install

composer require sisl-source/magento2-csp-whitelist
bin/magento module:enable CtiDigital_CspWhitelist
bin/magento setup:upgrade

Usage

When the browser console shows something like:

Refused to load https://www.google-analytics.com/analytics.js because it does not appear
in the script-src directive of the Content Security Policy.
  1. Note the host (www.google-analytics.com) and the violated policy (script-src).
  2. Go to Stores → Configuration → Cti → CSP Whitelist, enable the module.
  3. Add a row: pick the policy, enter the host. Save, flush cache.

License

MIT — see LICENSE.

Maintained by SISL — Magento 2 / Adobe Commerce studio. One of a set of revived, free, open-source Magento modules kept working on the latest Magento releases.

Maintained by SISL

Maintained fork by SISLMagento 2 development and modules. More self-hosted plugins: SISL Marketplace.