Skip to content
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

Describe CORB confirmation sniffing #87

Open
anforowicz opened this issue Oct 22, 2018 · 1 comment
Open

Describe CORB confirmation sniffing #87

anforowicz opened this issue Oct 22, 2018 · 1 comment

Comments

@anforowicz
Copy link

Cross-Origin Read Blocking (CORB) confirmation sniffing needs to be described in a spec somewhere (see whatwg/fetch#681 (comment)). CORB sniffs response body with the goal of confirming that the body matches the Content-Type and cannot possibly parse as another, cross-origin-embeddable body type.

Example 1: If response headers include "Content-Type: text/html" and the response body starts with "<html" then the response cannot possibly represent a resource that can be embedded cross-origin (and therefore can be safely blocked by CORB).

Example 2: If response headers include "Content-Type: text/html" and the response body starts with "<!-- // --> <script type='text/javascript'>" then the response might be interpreted both as text/html and/or application/javascript (and therefore should not be blocked by CORB). Such "polyglot" responses are allowed by covering HTML-style comments in Javascript syntax spec. This example shows that sniffing "<!--" (as suggested by "section 7.1. Identifying a resource with an unknown MIME type") is not sufficient to decide that the response really is a text/html.

@annevk
Copy link
Member

annevk commented Nov 12, 2018

Apologies for the late response here. I'm generally not super happy with the current state of sniffing algorithms in this document, which is why I hoped we'd define CORB sniffing directly in Fetch in a newer algorithm style. As such I'm not entirely sure how to proceed. I want to find a way to test the existing algorithms better so we can figure out to what extent they are implemented and correct.

I'm also no longer convinced only CORB should be sufficient to enable high resolution timers. Requiring CORS seems better, but it's still worthwhile to block as many of these "no-cors" loads as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants