Add support for importmap integrity#28253
Conversation
f7bd01e to
50567d7
Compare
|
EWS run on previous version of this PR (hash 50567d7) Details |
|
Apologies for my noobness, but my git-webkit script didn't seem to do the right thing when uploading this. |
|
EWS run on previous version of this PR (hash 5314069) Details |
50567d7 to
5314069
Compare
5314069 to
3491244
Compare
|
EWS run on previous version of this PR (hash 3491244) Details |
3491244 to
f61a244
Compare
|
EWS run on previous version of this PR (hash f61a244) Details |
f61a244 to
50dc1bb
Compare
|
EWS run on previous version of this PR (hash 50dc1bb) Details |
50dc1bb to
0e261b9
Compare
|
EWS run on previous version of this PR (hash 0e261b9) Details |
0e261b9 to
41d987a
Compare
|
EWS run on previous version of this PR (hash 41d987a) Details |
There was a problem hiding this comment.
This fails because module preload integrity is not supported.
There was a problem hiding this comment.
This fails because of modulepreload integrity is not supported in this PR.
There was a problem hiding this comment.
This fails because of the way I implemented static import integrity (only on the response side)
There was a problem hiding this comment.
This is a manual import, as importing the entire service-workers directory introduced too much unrelated noise
There was a problem hiding this comment.
This enforces integrity checks on the response even in cases where the integrity value is not propagated through the request (static imports).
|
There are still a few open questions (as comments), but I'd love an initial review of the approach. |
...Tests/imported/w3c/web-platform-tests/import-maps/no-referencing-script-integrity-valid.html
Outdated
Show resolved
Hide resolved
LayoutTests/imported/w3c/web-platform-tests/import-maps/no-referencing-script-integrity.html
Outdated
Show resolved
Hide resolved
b9abcca to
c710e8d
Compare
|
EWS run on previous version of this PR (hash c710e8d) Details |
LayoutTests/imported/w3c/web-platform-tests/import-maps/dynamic-integrity.html
Outdated
Show resolved
Hide resolved
LayoutTests/imported/w3c/web-platform-tests/import-maps/dynamic-integrity.html
Outdated
Show resolved
Hide resolved
LayoutTests/imported/w3c/web-platform-tests/import-maps/dynamic-integrity.html
Outdated
Show resolved
Hide resolved
...Tests/imported/w3c/web-platform-tests/import-maps/no-referencing-script-integrity-valid.html
Outdated
Show resolved
Hide resolved
c710e8d to
f11ae62
Compare
|
EWS run on previous version of this PR (hash f11ae62) Details |
f11ae62 to
b224e85
Compare
|
EWS run on previous version of this PR (hash b224e85) Details |
yoavweiss
left a comment
There was a problem hiding this comment.
Thanks for reviewing!
b224e85 to
ac14677
Compare
|
EWS run on current version of this PR (hash ac14677) Details |
marcoscaceres
left a comment
There was a problem hiding this comment.
Non-reviewer r+ on the tests, with that additional one I suggested.
|
@yoavweiss, ping me if/when you need me to add it to the merge queue. |
https://bugs.webkit.org/show_bug.cgi?id=272884 Reviewed by Ryosuke Niwa. Imported ES modules can't currently have integrity checks, which means they can't be used in sites where integrity checks are a necessity, for security and privacy reasons. This implements such support, by adding an "integrity" section to import maps. See whatwg/html#10269 * LayoutTests/TestExpectations: Ignored console logs to avoid flakiness * LayoutTests/imported/w3c/web-platform-tests/import-maps/WEB_FEATURES.yml: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/data-driven/resources/test-helper.js: (createTestIframe): Updated through import. * LayoutTests/imported/w3c/web-platform-tests/import-maps/dynamic-integrity-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/dynamic-integrity.html: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/no-referencing-script-integrity-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/no-referencing-script-integrity-valid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/no-referencing-script-integrity-valid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/no-referencing-script-integrity.html: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/nonimport-integrity-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/nonimport-integrity.html: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/static-integrity-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/static-integrity.html: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/w3c-import.log: Imports. * LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt: Updated. * LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https.html: Updated to cover Request.integrity. * LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-request-resources-iframe.https.html: Updated to cover Request.integrity. * LayoutTests/platform/glib/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt: Updated. * Source/JavaScriptCore/runtime/ImportMap.cpp: (JSC::ImportMap::resolveImportMatch): Typos and spec link. (JSC::parseURLLikeModuleSpecifier): Typos and spec link. (JSC::ImportMap::resolve const): Typos and spec link. (JSC::normalizeSpecifierKey): Typos and spec link. (JSC::sortAndNormalizeSpecifierMap): Typos and spec link. (JSC::ImportMap::registerImportMap): Add parsing for the integrity section. (JSC::ImportMap::getIntegrity const): Getter for integrity based on URL. * Source/JavaScriptCore/runtime/ImportMap.h: * Source/WebCore/bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::importModule): Add integrity to outgoing requests. (WebCore::ScriptModuleLoader::notifyFinished): Enforce integrity from the importmap on responses, even if integrity wasn't present in the request. Needed for static imports triggered by JSCore. * Source/WebCore/dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Add integrity to outgoing requests for top-level modules, if they don't already have an integrity attribute. Canonical link: https://commits.webkit.org/279096@main
ac14677 to
339bcec
Compare
|
Committed 279096@main (339bcec): https://commits.webkit.org/279096@main Reviewed commits have been landed. Closing PR #28253 and removing active labels. |
🛠 ios
🧪 wpe-wk2
339bcec
ac14677