Skip to content

Commit f9bc91c

Browse files
Merge pull request #161 from magento-gl/AC-15867_ACSD-68617_CLOUD_PATCH
Fix AC-15867 & ACSD-68617 issue
2 parents 0bc7d90 + 9cfe6e9 commit f9bc91c

File tree

3 files changed

+588
-0
lines changed

3 files changed

+588
-0
lines changed

patches.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@
310310
},
311311
"Patch for CVE-2025-54236 - WebAPI-improvement": {
312312
">=2.4.4 <2.4.4-p16 || >=2.4.5 <2.4.5-p15 || >=2.4.6 <2.4.6-p13 || >=2.4.7 <2.4.7-p8 || >=2.4.8 <2.4.8-p3": "MCLOUD-14016__Patch_for_CVE-2025-54236_webapi_improvement__2.4.x.patch"
313+
},
314+
"Patch for writable permission issue in the newrelic": {
315+
"2.4.8-p3 || 2.4.7-p8 || 2.4.6-p13 || 2.4.5-p15 || 2.4.4-p16": "ACSD-68617__Fix-writable_permission_issue_in_the_newrelic__2.4.x.patch"
316+
},
317+
"Patch for Checkout Broken: static.min.js & mixins.min.js not loaded": {
318+
"2.4.8-p3 || 2.4.7-p8 || 2.4.6-p13 || 2.4.5-p15 || 2.4.4-p16": "AC-15867__Fix_Checkout_broken_static_min_js_and_mixins_min_js_loading_issue__2.4.x.patch"
313319
}
314320
},
315321
"magento/module-paypal": {
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
diff --git a/vendor/magento/module-csp/Model/Deploy/Package/Processor/PostProcessor/Integrity.php b/vendor/magento/module-csp/Model/Deploy/Package/Processor/PostProcessor/Integrity.php
2+
index ba77e172355d5..fd498faaf183e 100644
3+
--- a/vendor/magento/module-csp/Model/Deploy/Package/Processor/PostProcessor/Integrity.php
4+
+++ b/vendor/magento/module-csp/Model/Deploy/Package/Processor/PostProcessor/Integrity.php
5+
@@ -16,6 +16,7 @@
6+
use Magento\Deploy\Package\Processor\ProcessorInterface;
7+
use Magento\Csp\Model\SubresourceIntegrity\HashGenerator;
8+
use Magento\Framework\App\ObjectManager;
9+
+use Magento\Framework\View\Asset\Minification;
10+
use Psr\Log\LoggerInterface;
11+
12+
/**
13+
@@ -53,6 +54,11 @@ class Integrity implements ProcessorInterface
14+
*/
15+
private LoggerInterface $logger;
16+
17+
+ /**
18+
+ * @var Minification
19+
+ */
20+
+ private Minification $minification;
21+
+
22+
/**
23+
* @param Filesystem $filesystem
24+
* @param HashGenerator $hashGenerator
25+
@@ -60,6 +66,7 @@ class Integrity implements ProcessorInterface
26+
* @param SubresourceIntegrityCollector $integrityCollector
27+
* @param LoggerInterface|null $logger
28+
* @param SubresourceIntegrityRepositoryPool|null $repositoryPool
29+
+ * @param Minification|null $minification
30+
*/
31+
public function __construct(
32+
Filesystem $filesystem,
33+
@@ -67,7 +74,8 @@ public function __construct(
34+
SubresourceIntegrityFactory $integrityFactory,
35+
SubresourceIntegrityCollector $integrityCollector,
36+
?LoggerInterface $logger = null,
37+
- ?SubresourceIntegrityRepositoryPool $repositoryPool = null
38+
+ ?SubresourceIntegrityRepositoryPool $repositoryPool = null,
39+
+ ?Minification $minification = null
40+
) {
41+
$this->filesystem = $filesystem;
42+
$this->hashGenerator = $hashGenerator;
43+
@@ -76,6 +84,8 @@ public function __construct(
44+
$this->logger = $logger ?? ObjectManager::getInstance()->get(LoggerInterface::class);
45+
$this->repositoryPool = $repositoryPool ??
46+
ObjectManager::getInstance()->get(SubresourceIntegrityRepositoryPool::class);
47+
+ $this->minification = $minification ??
48+
+ ObjectManager::getInstance()->get(Minification::class);
49+
}
50+
51+
/**
52+
@@ -84,18 +94,22 @@ public function __construct(
53+
public function process(Package $package, array $options): bool
54+
{
55+
$staticDir = $this->filesystem->getDirectoryRead(
56+
- DirectoryList::ROOT
57+
+ DirectoryList::STATIC_VIEW
58+
);
59+
60+
foreach ($package->getFiles() as $file) {
61+
if (strtolower($file->getExtension()) === "js") {
62+
+ $deployedFilePath = $this->minification->addMinifiedSign(
63+
+ $file->getDeployedFilePath()
64+
+ );
65+
+
66+
$integrity = $this->integrityFactory->create(
67+
[
68+
"data" => [
69+
'hash' => $this->hashGenerator->generate(
70+
- $staticDir->readFile($file->getSourcePath())
71+
+ $staticDir->readFile($deployedFilePath)
72+
),
73+
- 'path' => $file->getDeployedFilePath()
74+
+ 'path' => $deployedFilePath
75+
]
76+
]
77+
);
78+
diff --git a/vendor/magento/module-csp/Plugin/GenerateAssetIntegrity.php b/vendor/magento/module-csp/Plugin/GenerateAssetIntegrity.php
79+
index 2b461588fa5ad..5c66290652da2 100644
80+
--- a/vendor/magento/module-csp/Plugin/GenerateAssetIntegrity.php
81+
+++ b/vendor/magento/module-csp/Plugin/GenerateAssetIntegrity.php
82+
@@ -70,22 +70,56 @@ public function afterCreateRequireJsConfigAsset(
83+
File $result
84+
): File {
85+
if (PHP_SAPI == 'cli') {
86+
- if (in_array($result->getContentType(), self::CONTENT_TYPES)) {
87+
- $integrity = $this->integrityFactory->create(
88+
- [
89+
- "data" => [
90+
- 'hash' => $this->hashGenerator->generate(
91+
- $result->getContent()
92+
- ),
93+
- 'path' => $result->getPath()
94+
- ]
95+
- ]
96+
- );
97+
+ $this->generateIntegrity($result);
98+
+ }
99+
100+
- $this->integrityCollector->collect($integrity);
101+
- }
102+
+ return $result;
103+
+ }
104+
+
105+
+ /**
106+
+ * Generates integrity for '.min' files resolver.
107+
+ *
108+
+ * @param FileManager $subject
109+
+ * @param File $result
110+
+ *
111+
+ * @return File
112+
+ *
113+
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
114+
+ */
115+
+ public function afterCreateMinResolverAsset(
116+
+ FileManager $subject,
117+
+ File $result
118+
+ ): File {
119+
+ if (PHP_SAPI == 'cli') {
120+
+ $this->generateIntegrity($result);
121+
}
122+
123+
return $result;
124+
}
125+
+
126+
+ /**
127+
+ * Generates integrity for a given asset.
128+
+ *
129+
+ * @param File $file
130+
+ *
131+
+ * @return void
132+
+ */
133+
+ private function generateIntegrity(
134+
+ File $file
135+
+ ): void {
136+
+ if (in_array($file->getContentType(), self::CONTENT_TYPES)) {
137+
+ $integrity = $this->integrityFactory->create(
138+
+ [
139+
+ "data" => [
140+
+ 'hash' => $this->hashGenerator->generate(
141+
+ $file->getContent()
142+
+ ),
143+
+ 'path' => $file->getPath()
144+
+ ]
145+
+ ]
146+
+ );
147+
+
148+
+ $this->integrityCollector->collect($integrity);
149+
+ }
150+
+ }
151+
}
152+

0 commit comments

Comments
 (0)