Skip to content

Commit 6f67822

Browse files
committed
ACP2E-3854: Bundled/Merged JS not part of SRI Hashes
1 parent 7cbfa57 commit 6f67822

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

app/code/Magento/Csp/Plugin/GenerateBundleAssetIntegrity.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,16 @@ public function __construct(
6565
}
6666

6767
/**
68+
* Generate SRI hashes for JS files in the bundle directory.
69+
*
6870
* @param Bundle $subject
6971
* @param string|null $result
7072
* @param string $area
7173
* @param string $theme
7274
* @param string $locale
7375
* @return void
7476
* @throws FileSystemException
77+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
7578
*/
7679
public function afterDeploy(Bundle $subject, ?string $result, string $area, string $theme, string $locale)
7780
{

app/code/Magento/Csp/Plugin/GenerateMergedAssetIntegrity.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Csp\Model\SubresourceIntegrityFactory;
1414
use Magento\Framework\App\Area;
1515
use Magento\Framework\App\Filesystem\DirectoryList;
16+
use Magento\Framework\Exception\FileSystemException;
1617
use Magento\Framework\Filesystem;
1718
use Magento\Framework\View\Asset\LocalInterface;
1819
use Magento\Framework\View\Asset\MergeStrategy\FileExists;
@@ -47,9 +48,9 @@ class GenerateMergedAssetIntegrity
4748
*/
4849
public function __construct(
4950
SubresourceIntegrityRepositoryPool $sourceIntegrityRepositoryPool,
50-
HashGenerator $hashGenerator,
51-
SubresourceIntegrityFactory $integrityFactory,
52-
Filesystem $filesystem
51+
HashGenerator $hashGenerator,
52+
SubresourceIntegrityFactory $integrityFactory,
53+
Filesystem $filesystem
5354
) {
5455
$this->sourceIntegrityRepository = $sourceIntegrityRepositoryPool->get(Area::AREA_FRONTEND);
5556
$this->hashGenerator = $hashGenerator;
@@ -58,12 +59,15 @@ public function __construct(
5859
}
5960

6061
/**
62+
* Generate SRI hash for merged JS files.
63+
*
6164
* @param FileExists $subject
6265
* @param string|null $result
6366
* @param array $assetsToMerge
6467
* @param LocalInterface $resultAsset
6568
* @return string|null
66-
* @throws \Magento\Framework\Exception\FileSystemException
69+
* @throws FileSystemException
70+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6771
*/
6872
public function afterMerge(FileExists $subject, ?string $result, array $assetsToMerge, LocalInterface $resultAsset)
6973
{

0 commit comments

Comments
 (0)