-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions and environment
- Magento version 2.4.8-p3
- CSP module enabled
Steps to reproduce
- Set store to production mode
- Enable bundling and minify options for JS
- Deploy the content
- Add item to cart and browse to checkout
- Check to see if static.min.js and mixins.min.js were loaded onto the page
Expected result
The JS files are added to the section and loaded on the page
Actual result
Both of these files are missing from the page
Additional information
It looks like the changes to Magento/Csp/Model/Deploy/Package/Processor/PostProcessor/Integrity.php in the recent patch to write all the integrity hashes to the file during deployment plus the new GenerateBundleAssetIntegrity.php are causing this. Mostly due to how it adds the files, it does not see the correct .min.js filename while writing the file and instead puts it as normal .js files.
Previously, the sri-hashes.json file would only contain the requirejs-config.min.js file hashes in it and nothing else. This led to the bundle files getting placed in the same group as everything else so the Config block that adds all the JS files in worked without issue since it could find the bundle file to add them after.
Now, with the hashes, it correctly looks up the bundle file hashes because the plugin does a file search after deployment to get their correct names with .min.js in it and add their hashes causing them to be put in separate asset groups. It then fails to lookup the hashes for static.min.js and mixins.min.js because they are stored as static.js and mixins.js in the integrity map so it ends up trying to insert them into the existing js asset group but, since the bundle files aren't in there, fails to add them since it can't find the key to put them after.
The only way to make it work currently is either disable the minifying or bundling of the JS files.
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status