Skip to content

Let Origin header honor referrer policy for non CORS request#908

Merged
annevk merged 7 commits intowhatwg:masterfrom
JuniorHsu:origin-honors-referrer-policy
Jun 27, 2019
Merged

Let Origin header honor referrer policy for non CORS request#908
annevk merged 7 commits intowhatwg:masterfrom
JuniorHsu:origin-honors-referrer-policy

Conversation

@JuniorHsu
Copy link
Copy Markdown
Contributor

@JuniorHsu JuniorHsu commented May 29, 2019

Let Origin header honor referrer policy for non CORS request

Tests: web-platform-tests/wpt#14260


Preview | Diff

@annevk
Copy link
Copy Markdown
Member

annevk commented May 29, 2019

I think we should only take this into account when setting the Origin header, otherwise it will also affect various CORS algorithms and that does not seem like the right thing to do.

Also, for some cross-origin navigation requests the Origin header was always null per the tests, right? That also needs to be reflected somehow.

@JuniorHsu
Copy link
Copy Markdown
Contributor Author

JuniorHsu commented May 30, 2019

I think we should only take this into account when setting the Origin header, otherwise it will also affect various CORS algorithms and that does not seem like the right thing to do.

Okay, it's fair.

Also, for some cross-origin navigation requests the Origin header was always null per the tests, right? That also needs to be reflected somehow.

For form POST navigation,
(a) the redirect case is covered with tainted origin flag
(b) other cases are all the same with non-CORS fetch

Was I missing something?

@yutakahirano
Copy link
Copy Markdown
Member

Sorry for naive questions:

  • What is the rationale?
  • Why is this only for non CORS requests?

@JuniorHsu
Copy link
Copy Markdown
Contributor Author

* What is the rationale?

Please see https://un5h208565ak8emkwgjjkgb49yug.julianrbryant.com/show_bug.cgi?id=1504085#c7
At the beginning, we don't want to leak Origin: for HTTPS->HTTP cases.
And we find out Referrer-Policy is a good target to honor.

* Why is this only for non CORS requests?

Please see web-platform-tests/wpt#15937 (comment)
Tag @annevk who might have some ideas.

@annevk
Copy link
Copy Markdown
Member

annevk commented Jun 6, 2019

CORS is something both sides opt into so it seems reasonable that in that case we leak the origin. We previously decided that the Referrer Policy would not influence CORS for that reason. However, Origin is also used outside of CORS and we have not effectively dealt with it there.

@yutakahirano
Copy link
Copy Markdown
Member

Thank you.

Copy link
Copy Markdown
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, this mostly looks good to me now except for some minor things. Test coverage is good and I think other browsers are on board as well. I can take care of filing bugs on them once we land this.

For the branching on referrer policy adding "Otherwise" and "Do nothing." as its steps might also be good, to be explicit about that scenario.

And we should add a Note explaining why we adhere to Referrer Policy only sometimes. I can also take that on before I merge this unless you want to give it a go.

@JuniorHsu
Copy link
Copy Markdown
Contributor Author

I'm with you for the view of websocket. I addressed this with my new patch.

Thanks for the update, this mostly looks good to me now except for some minor things. Test coverage is good and I think other browsers are on board as well. I can take care of filing bugs on them once we land this.

Thanks for taking care of filing bug. FWIW, we also need a bug for navigation from about:blank

For the branching on referrer policy adding "Otherwise" and "Do nothing." as its steps might also be good, to be explicit about that scenario.

This issue is gone since I change the structure

And we should add a Note explaining why we adhere to Referrer Policy only sometimes. I can also take that on before I merge this unless you want to give it a go.

Thanks for taking care of the note.

Copy link
Copy Markdown
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a few issues unfortunately. I also added a note, please let me know if that looks good to you.

Copy link
Copy Markdown
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is all good now. Anyone have any final thoughts? @JuniorHsu are you happy with the nits I pushed?

@JuniorHsu
Copy link
Copy Markdown
Contributor Author

@annevk Yes, I'm happy :) Thanks for those tremendous help!

annevk added a commit to web-platform-tests/wpt that referenced this pull request Jun 27, 2019
Ensure we have more coverage for how to set the Origin header outside of
CORS. And also how its value is impacted by Referrer Policy.

Fetch change: whatwg/fetch#908.

Co-authored-by: Junior Hsu <cuveehsu@gmail.com>
Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
@annevk annevk added impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation topic: http labels Jun 27, 2019
@annevk annevk merged commit cc80ec5 into whatwg:master Jun 27, 2019
@annevk
Copy link
Copy Markdown
Member

annevk commented Jun 27, 2019

And thank you for pushing this through @JuniorHsu!

annevk added a commit to web-platform-tests/wpt that referenced this pull request Jun 27, 2019
Ensure we have more coverage for how to set the Origin header outside of
CORS. And also how its value is impacted by Referrer Policy.

Fetch change: whatwg/fetch#908.

Co-authored-by: Junior Hsu <cuveehsu@gmail.com>
Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jul 24, 2019
…ith the Referrer Policy, a=testonly

Automatic update from web-platform-tests
Fetch: Origin outside of CORS

Ensure we have more coverage for how to set the Origin header outside of
CORS. And also how its value is impacted by Referrer Policy.

Fetch change: whatwg/fetch#908.

Co-authored-by: Junior Hsu <cuveehsu@gmail.com>
Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
--

wpt-commits: ef44bff0adaa07f2e420a0cbc1bc493cd5786656
wpt-pr: 14260
xeonchen pushed a commit to xeonchen/gecko that referenced this pull request Jul 25, 2019
…ith the Referrer Policy, a=testonly

Automatic update from web-platform-tests
Fetch: Origin outside of CORS

Ensure we have more coverage for how to set the Origin header outside of
CORS. And also how its value is impacted by Referrer Policy.

Fetch change: whatwg/fetch#908.

Co-authored-by: Junior Hsu <cuveehsu@gmail.com>
Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
--

wpt-commits: ef44bff0adaa07f2e420a0cbc1bc493cd5786656
wpt-pr: 14260
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 4, 2019
…ith the Referrer Policy, a=testonly

Automatic update from web-platform-tests
Fetch: Origin outside of CORS

Ensure we have more coverage for how to set the Origin header outside of
CORS. And also how its value is impacted by Referrer Policy.

Fetch change: whatwg/fetch#908.

Co-authored-by: Junior Hsu <cuveehsugmail.com>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: ef44bff0adaa07f2e420a0cbc1bc493cd5786656
wpt-pr: 14260

UltraBlame original commit: add3ec0537b40f72caa6316e0f0cccf5d1da0198
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 4, 2019
…ith the Referrer Policy, a=testonly

Automatic update from web-platform-tests
Fetch: Origin outside of CORS

Ensure we have more coverage for how to set the Origin header outside of
CORS. And also how its value is impacted by Referrer Policy.

Fetch change: whatwg/fetch#908.

Co-authored-by: Junior Hsu <cuveehsugmail.com>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: ef44bff0adaa07f2e420a0cbc1bc493cd5786656
wpt-pr: 14260

UltraBlame original commit: add3ec0537b40f72caa6316e0f0cccf5d1da0198
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 4, 2019
…ith the Referrer Policy, a=testonly

Automatic update from web-platform-tests
Fetch: Origin outside of CORS

Ensure we have more coverage for how to set the Origin header outside of
CORS. And also how its value is impacted by Referrer Policy.

Fetch change: whatwg/fetch#908.

Co-authored-by: Junior Hsu <cuveehsugmail.com>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: ef44bff0adaa07f2e420a0cbc1bc493cd5786656
wpt-pr: 14260

UltraBlame original commit: add3ec0537b40f72caa6316e0f0cccf5d1da0198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation topic: http

Development

Successfully merging this pull request may close these issues.

3 participants