superb-code/module-content-security

Content Security

1.0.6 2025-03-31 17:40 UTC

This package is auto-updated.

Last update: 2025-05-01 00:17:57 UTC


README

Latest Stable Version Total Downloads

Install via composer (recommend)

Run the following command in Magento 2 root folder:

composer require superb-code/module-content-security
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy

Environment variables usage (app/etc/env.php)

  1. superb/content_security/escape_config - escape config, see example below
  2. superb/content_security/escape_debug_log_enabled - enable/disable debug log. Helps to identify used blocks
'superb' => [
    'content_security' => [
        'escape_debug_log_enabled' => true,
        'escape_config' => [
            'checkout_index_index' => [//full action name
                'enabled' => true,
                'allowed_tags' => [
                    'div',
                    'p',
                    'a',
                    'ul',
                    'li',
                    'h1',
                    'h2',
                    'h3',
                    'h4',
                    'h5',
                    'h6'
                ],
                'allowed_attributes' => [
                    'id',
                    'class',
                    'style',
                    'src',
                    'href'
                ]
            ],
            'footer_bottom_links' => [//static block identifier
                'enabled' => true,
                'allowed_tags' => [
                    'div',
                    'p',
                    'a',
                    'ul',
                    'li',
                    'h1',
                    'h2',
                    'h3',
                    'h4',
                    'h5',
                    'h6'
                ],
                'allowed_attributes' => [
                    'id',
                    'class',
                    'style',
                    'src',
                    'href'
                ]
            ]
        ]
    ]
]