-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrity-metadata should not be a preload key #1418
Conversation
I'm not sure I understand the tests. Maybe @domfarolino can help explain how to read them. For instance, "Same-origin script with non-matching digest does not re-use preload with matching digest." suggests to me that integrity metadata is looked at when looking at preloads to consume. Or am I missing something? |
That test has a good digest for preload and a bad one for consume, and it shows that the preload is ignored. There is a test missing to show that if both preload and consumer have matching integrity but with a different SHA the preload should be consumed. It's an edge case that IIRC Chromium currently doesn't implement due to it being esoteric and the cost of not implementing it is low (a missed preload). I can add a test for it and open a bug if that's necessary. |
Why would the preload be ignored though? How does that follow from the specification text? |
Actually you're right. The test shows that there would be two requests, while in the spec text there would be one request and the image would fail. I think a spec text that would correspond with the tests (and current implementation) is to keep fetch as is, but to make integrity meta data an "optional" part of the preload key, meaning that if it's not present then the lookup ignores integrity metadata. This is also reflected by "Cross-origin script, not CORS request, with hash mismatch" - there is only one (failing) request that also fails the consumer even though the consumer doesn't specify a hash. |
Added web-platform-tests/wpt#33326 There were 3 cases that were not handled in the original SRI test:
I'm ignoring WebKit results here as it doesn't check for resource integrity when consuming resources (which can lead to consuming resources with a mismatch!) So:
As I said before, the latter is quite an edge case - perhaps this difference can be a |
Amended whatwg/html#7738 to match current implementations, accounting for the edge-case mismatch |
As the parameters of https://html.spec.whatwg.org/multipage/links.html#consume-a-preloaded-resource are not modified by whatwg/html#7738, I suspect this change to the caller-side of #consume-a-preloaded-resource is not needed? (The discussion above is still valid/useful for whatwg/html#7738) |
Yes, that's accurate. I am leaving this open for the discussion |
Closing as there is no action item for the fetch spec, though some of the discussion is useful for reference. |
In conjunction with whatwg/html#7738
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff