-
Notifications
You must be signed in to change notification settings - Fork 35
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
Checking the integrity of resources pulled in from within CSS stylesheets #40
Comments
It will be checked automatically by the browser (Chrome and Firefox only at the moment) and the load will fail if the hash doesn't match. |
Which hash is it supposed to be checked against? I haven't hashed the font resource in my test sample, yet chrome does load it without any warning. I'm pretty sure in my sample only the css gets hashed, and the resources referenced from the css are never actually checked anywhere. I've put the sample generated output on: http://baloo.github.io/subresource-integrity-test/ |
Oh sorry, I see what you mean: sub-subresources. It's not supported in the current specification (or in the implementations). You can only hash the first level of resources. |
Is this use-case considered?
I believe it to be okay with css spec itself. |
Clarification: The way specifications work is a bit tricky, since each may have their own way to describe how to do HTTP requests. SRI refers to the fetch standard, which is supposed to become the canonical way of making requests. Fetch in itself supports an integrity option so you can say "fetch and return iff the result matches this hash" (roughly speaking). I do not know how CSS handles requests, when you use |
The CSS specifications indeed need to be (re)written to be on top of Fetch. Otherwise service workers and such won't work either. I believe @tabatkins has fixed |
(There used to be some canonical issue on this, but since everything has moved in WebAppSec I'm not really sure where to find it.) |
I found w3c/webappsec#306 |
@tabatkins pointed me to https://drafts.csswg.org/css-values/#url-modifiers as a reasonable integration point for configuring resource fetching inside CSS, which would make it possible to add integrity metadata, etc. He suggests that " y'all just need to write up the proposal somewhat officially". This will be a little difficult to do in spec language, as CSS doesn't always cleanly integrate with Fetch, or clearly define when/how resources are requested. But it should be possible to sketch out enough of a proposal and define your SRI2 requirements clearly enough to give them something to work with. |
Will take a look at formalising this tonight, looks like fleshing out a stronger integration of https://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#uri and/or https://www.w3.org/TR/css-values/#urlsto using fetch and how 's get used will be the core of the work. |
I'm not sure to understand the spec correctly but I've been unable to find a way to validate integrity of sub-subresources, like images or font referenced from css.
I've put a sample code here:
https://github.com/baloo/subresource-integrity-test/blob/master/test.py
I'm probably missing something.
The text was updated successfully, but these errors were encountered: