-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Area: FrameworkComponent: CspIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.7Indicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Description
Preconditions
- Magento 2.4.7
- Custom configuration as following in
etc/config.xml
:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<csp>
<policies>
<storefront>
<scripts>
<inline>0</inline>
</scripts>
</storefront>
</policies>
</csp>
</default>
</config>
Steps to reproduce
- Add above content in the
etc/config.xml
of a custom module - Clear the cache
- Load the site homepage in your browser
- Inspect the
Content-Security-Policy-Report-Only
HTTP header of the page
Expected result
- The
unsafe-inline
expression is not present in thescript-src
policy - Hashes of the inline scripts of the page are present in the
script-src
policy
Actual result
- The
unsafe-inline
expression is not present in thescript-src
policy - A generated nonce is present in the
script-src
policy instead of hashes - The nonce is cached by FPC
As it is mentioned in this architecture document, the nonce approach is incompatible with Magento's page cache.
So the fact that nonce takes precedence over hashes in this method \Magento\Csp\Helper\InlineUtil::processTag
is a problem for merchants who want to remove the unsafe-inline
expression of their policies to improve overall security.
Nonce should be generated only for non-cacheable pages.
Examples
See \Magento\Csp\Helper\InlineUtil::processTag
method.
Proposed solution
No response
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
Area: FrameworkComponent: CspIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.7Indicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Type
Projects
Status
Done