-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[4.0] Script/Style hash validation broken #28557
Copy link
Copy link
Closed
Labels
Description
Steps to reproduce the issue
@SharkyKZ found the reason here: #26505 (comment)
Since #25357 rendered scripts/styles have formatting added to them. But the hash is generated from scripts/styles without formatting. So the hashes don't match scripts/styles that appear on the page.
Assuming SRI works on pages with MIME type other than text/html, this was actually broken since the beginning because we wrap code in CDATA on such pages:
$buffer .= $tab . $tab . '/*<![CDATA[*/' . $lnEnd;
Expected result
CSP Script hashes work
Actual result
They don't
Reactions are currently unavailable