This issue is occurring because you disabled or removed the Magento_Csp
module. Magento_Checkout
, Magento_Paypal
, and Magento_AdminAnalytics
in Magento 2.4.7 and the latest security patches requires the Magento_Csp
module.
https://experienceleague.adobe.com/en/docs/commerce-operations/release/notes/magento-open-source/2-4-7
Changes to Content Security Policy (CSP)— Configuration updates and enhancements to Adobe Commerce Content
Security Policies (CSPs) to comply with PCI 4.0 requirements.
If you unconcerned about CSP and PCI 4.0, you can reinstall/reenable the Magento_Csp
module and disable the CSP for inline scripts.
The <your_module_path>/etc/config.xml
should look like this:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<csp>
<policies>
<admin_sales_order_create_index>
<scripts>
<inline>1</inline>
</scripts>
</admin_sales_order_create_index>
<storefront_checkout_index_index>
<scripts>
<inline>1</inline>
</scripts>
</storefront_checkout_index_index>
</policies>
</csp>
</default>
</config>
Alternatively, you can install the CSP shim module by Pieter Hoste (hostep), a well-know Magento contributor. This module replaces the default Magento CSP module and effectively disables its functionality. https://github.com/baldwin-agency/magento2-module-csp-shim
However, for those concerned about CSP and PCI 4.0, try resolving the inline script issue using the instructions to "Whitelist an inline script or style" in the official documentation at https://developer.adobe.com/commerce/php/development/security/content-security-policies/#whitelist-an-inline-script-or-style