-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Putting csp_whitelist.xml in theme does not work and creates intermittent issue #38933
Comments
Hi @Jakhotiya. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
Hi @engcom-Hotel. Thank you for working on this issue.
|
Hello @Jakhotiya, Thanks for the report and collaboration! We have tried to reproduce the issue in the latest development branch i.e. 2.4-develop and the issue has been reproducible for us. Please refer to the below screenshots for reference: In case after clearing cache access the admin panel and then access the frontend In case after clearing cache directly access the frontend Hence confirming the issue. Thanks |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-13069 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue. |
@magento I am working on this |
…reates intermittent issue - Implemented caching of CSP whitelist per website area.
…reates intermittent issue - Updated copyright notice.
Preconditions and environment
Steps to reproduce
Expected result
Domains listed in your custom csp_whitelist.xml under theme should have reflected on frontend
Actual result
If admin is hit first after cache flush, domains under your csp_whitelist.xml under theme are not seen on frontend.
Additional information
This bug happens because contents of csp_whitelist.xml in theme are stored in global cache.
Lets see how this works right now.
CSP cache is maintained area wise. For example, you will find 3 files in your cache
Now the bug happens because of
app/code/Magento/Csp/Model/Collector/CspWhitelistXml/FileResolver.php
if ($scope === 'global')
leads to csp_whitelist config in theme being put in global cache.After cache flush if admin request lands on server, $theme variable is set to Magento/backend .
In this case, your file in frontend theme wont be read. Global cache is then populated according to Magento/backend
The behavior completely depends on which area request lands first, frontend or admin. This leads to poor developer experience too.
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: