diff --git a/vendor/magento/module-csp/Model/SubresourceIntegrity/SriEnabledActions.php b/vendor/magento/module-csp/Model/SubresourceIntegrity/SriEnabledActions.php new file mode 100644 index 00000000000..5282d72e01b --- /dev/null +++ b/vendor/magento/module-csp/Model/SubresourceIntegrity/SriEnabledActions.php @@ -0,0 +1,42 @@ +paymentActions = $paymentActions; + } + + /** + * Check if action is for payment page on storefront or admin + * + * @param string $actionName + * @return bool + */ + public function isPaymentPageAction(string $actionName): bool + { + return in_array( + $actionName, + $this->paymentActions + ); + } +} diff --git a/vendor/magento/module-csp/Plugin/AddDefaultPropertiesToGroupPlugin.php b/vendor/magento/module-csp/Plugin/AddDefaultPropertiesToGroupPlugin.php index 159e2180427..1985845e6ba 100644 --- a/vendor/magento/module-csp/Plugin/AddDefaultPropertiesToGroupPlugin.php +++ b/vendor/magento/module-csp/Plugin/AddDefaultPropertiesToGroupPlugin.php @@ -1,18 +1,22 @@ state = $state; $this->integrityRepositoryPool = $integrityRepositoryPool; + $this->request = $request ?? ObjectManager::getInstance()->get(Http::class); + $this->action = $action ?? ObjectManager::getInstance()->get(SriEnabledActions::class); } /** @@ -49,13 +69,14 @@ class AddDefaultPropertiesToGroupPlugin * @param array $properties * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @throws LocalizedException */ public function beforeGetFilteredProperties( GroupedCollection $subject, AssetInterface $asset, array $properties = [] ): array { - if ($asset instanceof LocalInterface) { + if ($this->canExecute($asset)) { $integrityRepository = $this->integrityRepositoryPool->get( Package::BASE_AREA ); @@ -78,4 +99,18 @@ class AddDefaultPropertiesToGroupPlugin return [$asset, $properties]; } + + /** + * Check if beforeGetFilteredProperties plugin should execute + * + * @param AssetInterface $asset + * @return bool + */ + private function canExecute(AssetInterface $asset): bool + { + return $asset instanceof LocalInterface && + $this->action->isPaymentPageAction( + $this->request->getFullActionName() + ); + } } diff --git a/vendor/magento/module-csp/etc/di.xml b/vendor/magento/module-csp/etc/di.xml index 13c1f225a00..88ed028241b 100644 --- a/vendor/magento/module-csp/etc/di.xml +++ b/vendor/magento/module-csp/etc/di.xml @@ -1,9 +1,9 @@ @@ -134,4 +134,15 @@ Magento\Framework\Filesystem\Driver\File + + + + sales_order_create_index + sales_order_create_loadBlock + checkout_index_index + checkout_onepage_success + multishipping_checkout_billing + + + diff --git a/vendor/magento/module-csp/view/frontend/layout/multishipping_checkout.xml b/vendor/magento/module-csp/view/frontend/layout/multishipping_checkout.xml new file mode 100644 index 00000000000..2c80a435115 --- /dev/null +++ b/vendor/magento/module-csp/view/frontend/layout/multishipping_checkout.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + +