-
Notifications
You must be signed in to change notification settings - Fork 324
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
Clarify cors requests need cors response tainting #1170
Clarify cors requests need cors response tainting #1170
Conversation
This change clarifies a (non-normative) statement that "cors" request mode is what makes a request into a cors request. In fact, for requests with "cors" request mode, "cors" response tainting is also necessary in order for the request to be considered a cors request. So this change refines the relevant statement to make that clear. Otherwise, without this change, considering the case of a same-origin GET request whose mode is "cors", the spec is claiming that same-origin GET request is a cors request. But because the spec defines a "cors request" as “an HTTP request that includes an `Origin` header”, a same-origin GET request cannot in fact be a cors request — because it doesn’t include an `Origin` header. (And that’s because for GET requests, the spec requires an `Origin` header to be appended only if the request’s response tainting is "cors"; but for same-origin requests, the request’s response tainting will be "basic".)
fetch.bs
Outdated
@@ -1390,7 +1390,8 @@ to not have to set <a for=/>request</a>'s <a for=request>referrer</a>. | |||
<a>network error</a> if the request is not made to a same-origin URL. | |||
|
|||
<dt>"<code>cors</code>" | |||
<dd>Makes the request a <a>CORS request</a>. Fetch will return a <a>network error</a> if the | |||
<dd>For requests whose <a for=request>response tainting</a> is also "<code>cors</code>", makes the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"gets set to" seems more accurate since response tainting is not set by those creating the request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"gets set to" seems more accurate since response tainting is not set by those creating the request.
Made it so
fetch.bs
Outdated
@@ -1390,7 +1390,8 @@ to not have to set <a for=/>request</a>'s <a for=request>referrer</a>. | |||
<a>network error</a> if the request is not made to a same-origin URL. | |||
|
|||
<dt>"<code>cors</code>" | |||
<dd>Makes the request a <a>CORS request</a>. Fetch will return a <a>network error</a> if the | |||
<dd>For requests whose <a for=request>response tainting</a> gets set to "<code>cors</code>", makes | |||
the request a <a>CORS request</a> — in which case, fetch will return a <a>network error</a> if the | |||
requested resource does not understand the <a>CORS protocol</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, noticed this afterwards, but maybe you want to improve this as well since the resource might well understand it, but not wish to share.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went with: “or if the requested resource is one that intentionally does not participate in the CORS protocol”
This change clarifies a (non-normative) statement that "cors" request mode is what makes a request into a cors request. In fact, for requests with "cors" request mode, "cors" response tainting is also necessary in order for the request to be considered a cors request. So this change refines the relevant statement to make that clear.
Otherwise, without this change, considering the case of a same-origin GET request whose mode is "cors", the spec is claiming that same-origin GET request is a cors request.
But because the spec defines a "cors request" as “an HTTP request that includes an
Origin
header”, a same-origin GET request cannot in fact be a cors request — because it doesn’t include anOrigin
header. (And that’s because for GET requests, the spec requires anOrigin
header to be appended only if the request’s response tainting is "cors"; but for same-origin requests, the request’s response tainting will be "basic".)Preview | Diff