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

Clarify cors requests need cors response tainting #1170

Merged

Conversation

sideshowbarker
Copy link
Contributor

@sideshowbarker sideshowbarker commented Feb 16, 2021

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".)


Preview | Diff

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
Copy link
Member

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.

Copy link
Contributor Author

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>.
Copy link
Member

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.

Copy link
Contributor Author

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”

@annevk annevk merged commit 72be227 into main Feb 17, 2021
@annevk annevk deleted the sideshowbarker/cors-request-requires-response-tainting-equals-cors branch February 17, 2021 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants