8. If _destination_ is “image” (or “audio”, “video” or “track” or “font”) and _mimeType_ (ignoring parameters) is [HTML MIME type](https://mimesniff.spec.whatwg.org/#html-mime-type) or [XML MIME type](https://mimesniff.spec.whatwg.org/#xml-mime-type) (except `image/svg+xml`) or [JSON MIME type](TBD), then return blocked.
RE: complicated sniffing in CORBI guess that exactly how much of CORB should be covered by web standards is still an open question. For example - no observable consequences would be caused by blocking of sniff-confirmed non-images in responses going to image destinations. This probably means that whether sniffing is implemented (and whether sniffed respones are blocked or not) can be seen as an implementation choice or detail of any particular browser. Therefore maybe details of CORB sniffing don’t need to be covered by the normative part of web standards. (sniffing _does_ help to protect more resources, but maybe it is sufficient to cover it in the CORB explainer or in a non-normative part of the specs).OTOH, standardizing CORB-like handling of nosniff responses would go a long way (*) toward ensuring that implementing CORB doesn’t lead to behavioral differences between browsers. In my opinion, CORB-protecting nosniff images and multimedia seems like a natural extension of the https://fetch.spec.whatwg.org/#should-response-to-request-be-blon cked-due-to-nosniff section in the Fetch spec - I think adding the following extra item/step is a viable option on the table:8. If _destination_ is “image” (or “audio”, “video” or “track” or “font”) and _mimeType_ (ignoring parameters) is [HTML MIME type](https://mimesniff.spec.whatwg.org/#html-mime-type) or [XML MIME type](https://mimesniff.spec.whatwg.org/#xml-mime-type) (except `image/svg+xml`) or [JSON MIME type](TBD), then return blocked.What would you think about such an edit in the Fetch spec? This seems like an alternative version of Firefox’s earlier attempt to block *all* non-image MIME types in presence of the nonsniff header (alternative that is limited to HTML, XML and JSON MIME types + expanded to cover other destinations like audio and video). The proposed stricter enforcement of Content-Type header seems desirable even if CORB doesn’t immediately help Firefox defend against Spectre (I don’t feel qualified to comment on Firefox security architecture and whether or not CORB can help with Spectre, but I do think that CORB can act as an extra protection against XSSI attacks).RE: opt-in on the sender sideMaybe I am misunderstanding what you mean by “opt-in on the sender side”, but presence of the nosniff header can be seen as a signal to opt into CORB protection. Does that make sense?
A few questions to see if I understand, since this doesn't seem sufficient at first glance.I'm not sure how that would help against requests made by image tags, script tags, or other non-fetch requests that don't use CORS. Would all subresource requests have to use CORS in your proposal?
Stripping credentials also doesn't seem sufficient for protecting private content in all cases, like cases of ambient authority (e.g., access to intranet resources). Are you picturing something like RFC 1918 for that?
(The extra round trip for credentialed requests also seems unfortunate, as you note.)
8. If _destination_ is “image” (or “audio”, “video” or “track” or “font”) and _mimeType_ (ignoring parameters) is [HTML MIME type](https://mimesniff.spec.whatwg.org/#html-mime-type) or [XML MIME type](https://mimesniff.spec.whatwg.org/#xml-mime-type) (except `image/svg+xml`) or [JSON MIME type](TBD), then return blocked.
On Thu, Mar 15, 2018 at 12:02 AM, Łukasz <luk...@chromium.org> wrote:
> I think it is fine to disagree on the value of CORB as long as we can agree
> on the desirability of the spec changes for covering aspects of CORB that
> have web-observable effect on the existing websites. I heard that many
> people are excited about restricting those MIME types further - this is
> exactly the kind of spec changes that CORB needs.
Yes, we definitely like to be more strict on Content-Type in general
if possible. Chrome proving that is definitely welcome.
> So - what do you think about the proposal (*) about blocking nosniff
> responses for image destinations if the Content-Type of the response HTML,
> XML or JSON?
I forgot what issues Firefox hit with this last time, but if Chrome is
willing to take the hit I'm pretty sure we'd put that check back in as
well. (I copied Christoph who implemented nosniff functionality in
Firefox.)
> Are there high-level concerns that need to addressed before proceeding (e.g.
> do we need more web compatibility data? or maybe we should discuss how/if
> the changes are beneficial even without CORB?).
I think there's rough implementer support for putting more
restrictions on responses in general. The other things a standard
change needs are tests,
a PR against the standard detailing the changes,
and browser bugs against the browsers that haven't
implemented the change yet and don't have a bug on file already.
> Or do we just need to iron out the low-level details (e.g. where to define
> what JSON MIME type means? or if we need to account for the fact that today
> CORB blocking doesn't result in network errors? do we need to worry about
> 206 and/or text/plain?)
We definitely care about all of these, including test coverage for
them, as they lead to observably different behavior on the web.
> PS. This is the first time I am trying to have a discussion about changing
> the web standards, so please let me know if I should be doing something
> differently. For example - maybe instead of exchanging emails I should be
> adding comments to https://github.com/whatwg/fetch/issues/681 or maybe I
> should just wrap the changes I am proposing into a code review or a pull
> request? I am always open to feedback :-)
Given the sensitive nature of Spectre a private email thread seems
fine. Normally we'd discuss everything in the public issue itself.
> (*)
> https://groups.google.com/a/chromium.org/d/msg/site-isolation-dev/pp5C8XKz7AI/qWmSyFkkBgAJ:
> An extra step/item can be added to
> https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff?
> :
>
> 8. If _destination_ is “image” (or “audio”, “video” or “track” or “font”)
> and _mimeType_ (ignoring parameters) is [HTML MIME
> type](https://mimesniff.spec.whatwg.org/#html-mime-type) or [XML MIME
> type](https://mimesniff.spec.whatwg.org/#xml-mime-type) (except
> `image/svg+xml`) or [JSON MIME type](TBD), then return blocked.
FWIW, when I looked at the Chrome source code it seemed to me that you
had a different XML MIME type definition than the one you link to
here. In particular it considered text/xml+something an XML MIME type
as well for the purposes of CORB (despite Chrome not parsing such MIME
types as XML). That kind of nuance will be important to get right and
test for.
Hope this helps,
--
https://annevankesteren.nl/