sixbysix/magento2-csp-fixer
最新稳定版本:1.0.2
Composer 安装命令:
composer require sixbysix/magento2-csp-fixer
包简介
Magento 2 CSP Fixer
README 文档
README
https://gitlab.com/sixbysix/magento2-csp-fixer
This extension provides a number of tools to help you implement a Content Security Policy (CSP) on your Magento 2 store.
Currently Magento stores may operate their CSP policies in report-only mode and remain compliant with PCI DSS. However, this is not a long-term solution and from March 2025 all Magento stores will be required to have a fully operational CSP.
Features
- HTML Fixer
- Converts inline event listeners to tag-based event listeners.xs
- Converts inline styles to tag-based styles.
- Converts inline scripts to tag-based scripts.
- Generates nonce attributes for inline scripts and styles.
- CSP directive management
- Manage your CSP directives from the Magento admin panel.
Installation
- Add the extension to your Magento 2 store using Composer:
composer require sixbysix/magento2-csp-fixer - Enable the extension:
bin/magento module:enable SixBySix_CspFixer bin/magento setup:upgrade
Configuration
Control mode (Report-Only or Strict-Mode)
- Navigate to
Stores > Configuration > Security > Content Security Policy (CSP). - Open the
Modesection. - Under each section you can enable/disable "Report-Only" mode.

Enable fixer
- Navigate to
Stores > Configuration > Security > Content Security Policy (CSP). - Open the
CSP Fixersection. - Set
EnabledtoYes. - If you enable the "Debug" option, the fixer will log the changes it makes to the page in MAGE_ROOT/var/log/sixbysix_cspfixer.log.

Manage CSP Policies
- Navigate to
Stores > Configuration > Security > Content Security Policy (CSP). - Open the
CSP Policiessection. - Enable or disable the CSP policy injection using the
Enabledfield. - Under the
Policiesfield, you can add your CSP policies. These will be injected into the CSP whitelist during the page load.

Testing
Commits to this repository will trigger a GitLab CI pipeline that will run the following tests.
Note: all tests are executed on a clean Magento 2.4.* instance
- phpstan
- phpunit
统计信息
- 总下载量: 677
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-28