Web Extensions need a way to update the integrity attribute associated with web requests
Categories
(WebExtensions :: Request Handling, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: francois, Unassigned)
References
Details
(Whiteboard: [design-decision-approved]triaged)
Comment 1•8 years ago
|
||
Updated•8 years ago
|
Updated•8 years ago
|
Updated•8 years ago
|
Comment 2•8 years ago
|
||
Updated•8 years ago
|
Comment 3•8 years ago
|
||
Updated•7 years ago
|
Updated•6 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 5•3 years ago
|
||
So I raised Bug: 1720891 before remembering this one.
Overview:
Firefox doesn't permit an extension to redirect to a local resource hosted within the extension if the resource has an SRI integrity attribute. This is required to provide user choice such as removing tracker banners or invalid warnings to the user without breaking the site.
This has come up in some of our site breakage where a website was doing the following:
let script = document.createElement('script');
script.onload = function() {
initWebsite()
};
script.onerror = function() {
alert("You shall not pass");
};
script.integrity = 'sha256-xjwKUY/NgkPjZZBOtOxRYtK20GaqTwUCf7WYCJ1z69w=';
script.crossOrigin = 'anonymous';
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/fuckadblock/3.2.1/fuckadblock.min.js';
document.head.appendChild(script);
STR:
- Install https://addons.mozilla.org/en-GB/firefox/addon/duckduckgo-for-firefox/
- Go to: http://privacy-test-pages.glitch.me/privacy-protections/surrogates/
Actual results:
The test fails and the console contains the following error:
Failed to find a valid digest in the 'integrity' attribute for resource 'https://google-analytics.com/analytics.js' with computed SHA-256 integrity 'W7MQTBlQ7AcSERmsI4GYNsKy6kKOSY92wU+99GKTjSw='. The resource has been blocked.
Expected results:
"google-analytics.com/analytics.js broken integrity" to pass and no SRI warning in the console.
Note: The test purposefully uses an invalid SRI so it always fails when the extension isn't loaded.
(In reply to Daniel Veditz [:dveditz] from comment #3)
So far I've only been talking about the replace/redirect case. In the future
sites might use the "require integrity for" CSP feature that would require
integrity on new elements inserted by an extension.
This got removed since Dan's comment, I don't think there is any desire to have require-sri-for
anytime soon.
My proposal here is that a carve out to be added to the SRI code specifically when the extension redirects to a local moz-extension:// resource.
Updated•2 years ago
|
Description
•