Closed marctbb closed 2 weeks ago
Hi @marctbb. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.
@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hello @marctbb,
Thanks for the report and collaboration!
We have tried to reproduce the issue in the latest development i.e. 2.4-develop, and Magento has already removed the duplicated CSPs from the header from different modules/extensions. To reproduce the issue we have followed the below steps:
csp_whitelist.xml
in both the modules.csp_whitelist.xml
bin/magento s:up
It seems the issue is with the Apache's header limit, and not with the Magento core.
Let us know if we missed anything.
Thanks
You could also give https://github.com/basecom/magento2-csp-split-header/ a try, to see if that module improves the situation
Dear @marctbb,
We've observed that there haven't been any updates on this issue for quite some time. Therefore, we're assuming it's been resolved and will be closing it. Feel free to open a new ticket or reopen this one if you require further assistance.
Regards
Preconditions and environment
Steps to reproduce
I'am currently managing a Magento 2.4.7 instance on an Apache server, and we have encountered issues related to Content Security Policies (CSP) after updates and the installation of third-party plugins. The problem manifests as CSP errors in the console, which we have addressed by adding specific directives to our custom whitelist located in app/code. Additionally, these third-party plugins have added their own CSP rules in their respective whitelists.
Over time, we’ve cleaned our custom whitelist to remove directives already included by the third-party plugins. However, we’ve now reached a point where we cannot reduce the whitelist further, as the remaining entries in our custom CSP whitelist are unique across the codebase. Removing them would result in console CSP errors.
The core issue is that Apache imposes a limit on the number of CSP directives. When this limit is exceeded, we encounter 500 server errors, rendering both the frontend and backend of Magento unusable.
It is possible to remove csp in the whitelists of third party plugins and thus reduce the number of csp and therefore the frontend and backend are shown. But this means that there is a possibility of errors appearing in the console and having the problem in future updates.
It should be noted that it is only reproducible if the Magento is on a server, it does not work on localhost.
Expected result
The expected result is that magento will detect the csp's that are added to the head and if it finds that they are duplicated in several whitelists it will only add or use one of those. With this you would be able to see both the forntend and the backend without any problem.
Actual result
The current result is as I said, we get error 500 in both the frontend and the backend and it is not possible to work. Is there a way for magento to handle csp correctly?
Additional information
I found this, maybe it helps to understand the issue: https://konkretor.com/2022/07/07/apache-ah01070-error-parsing-script-headers/
Release note
No response
Triage and priority