Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(795)

Issue 1017583002: Set Origin header to "null" for cross origin redirects. (Closed)

Created:
5 years, 9 months ago by jww
Modified:
5 years, 8 months ago
Reviewers:
davidben, Ryan Sleevi
CC:
cbentzel+watch_chromium.org, chromium-reviews, mmenke, Paweł Hajdan Jr.
Base URL:
https://chromium.googlesource.com/chromium/src@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Set Origin header to "null" for cross origin redirects. In order to avoid invaliding CSRF protections on the server, it is necessary to set the Origin header to "null" on cross origin redirect. This avoids problems where a malicious server redirects a POST request to a sender to cause a confused deputy problem where the server believes the request originated with the Origin header origin. This adds a check to url_request.cc where if the redirect is cross origin and an Origin header is present, this sets the Origin header to "null." If there is not Origin header, it leaves it as-is. R=rsleevi@chromium.org BUG=465517 Committed: https://crrev.com/5fe460ffa7a39f010134cf7c5ca5311f274103e3 Cr-Commit-Position: refs/heads/master@{#322685}

Patch Set 1 #

Patch Set 2 : Added Origin header logic to web_url_loader_impl.cc #

Patch Set 3 : Rebase on ToT #

Total comments: 10

Patch Set 4 : Addressed nits #

Total comments: 15

Patch Set 5 : Rebase on ToT #

Patch Set 6 : Address more of David's comments #

Total comments: 6

Patch Set 7 : Address nits from David #

Unified diffs Side-by-side diffs Delta from patch set Stats (+112 lines, --2 lines) Patch
A + net/data/url_request_unittest/redirect301-to-https View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A net/data/url_request_unittest/redirect301-to-https.mock-http-headers View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
A + net/data/url_request_unittest/redirect302-to-https View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A net/data/url_request_unittest/redirect302-to-https.mock-http-headers View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
A + net/data/url_request_unittest/redirect303-to-https View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A net/data/url_request_unittest/redirect303-to-https.mock-http-headers View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
A + net/data/url_request_unittest/redirect307-to-https View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A net/data/url_request_unittest/redirect307-to-https.mock-http-headers View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
A + net/data/url_request_unittest/redirect308-to-https View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A net/data/url_request_unittest/redirect308-to-https.mock-http-headers View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M net/url_request/url_request.cc View 1 2 3 4 5 6 3 chunks +27 lines, -0 lines 0 comments Download
M net/url_request/url_request_unittest.cc View 1 2 3 4 2 chunks +80 lines, -3 lines 0 comments Download

Messages

Total messages: 26 (4 generated)
jww
Ryan, can you take a look at this for me? Thanks!
5 years, 9 months ago (2015-03-17 01:23:59 UTC) #2
Ryan Sleevi
I won't be able to review this for a few days. That said, I'm probably ...
5 years, 9 months ago (2015-03-17 01:26:51 UTC) #3
Ryan Sleevi
Adding David because he's thought about the layering In particular, should this be instead dispatched ...
5 years, 9 months ago (2015-03-17 01:29:26 UTC) #5
jww
On 2015/03/17 01:29:26, Ryan Sleevi wrote: > Adding David because he's thought about the layering ...
5 years, 9 months ago (2015-03-17 02:06:39 UTC) #6
davidben
CC: mmenke (Could I have access to the bug?) Hrm. This is kind of awkward ...
5 years, 9 months ago (2015-03-17 16:41:45 UTC) #7
jww
On 2015/03/17 16:41:45, David Benjamin wrote: > CC: mmenke > > (Could I have access ...
5 years, 9 months ago (2015-03-17 16:58:42 UTC) #8
jww
David, I added the header logic to web_url_loader_impl.cc as you suggested. Let me know how ...
5 years, 9 months ago (2015-03-17 18:46:51 UTC) #9
Ryan Sleevi
https://codereview.chromium.org/1017583002/diff/40001/net/url_request/url_request.cc File net/url_request/url_request.cc (right): https://codereview.chromium.org/1017583002/diff/40001/net/url_request/url_request.cc#newcode949 net/url_request/url_request.cc:949: // https://tools.ietf.org/id/draft-abarth-origin-03.html#rfc.section.5). This Cite the RFC :P http://tools.ietf.org/html/rfc6454 https://codereview.chromium.org/1017583002/diff/40001/net/url_request/url_request.cc#newcode951 ...
5 years, 9 months ago (2015-03-19 03:46:35 UTC) #10
jww
https://codereview.chromium.org/1017583002/diff/40001/net/url_request/url_request.cc File net/url_request/url_request.cc (right): https://codereview.chromium.org/1017583002/diff/40001/net/url_request/url_request.cc#newcode949 net/url_request/url_request.cc:949: // https://tools.ietf.org/id/draft-abarth-origin-03.html#rfc.section.5). This On 2015/03/19 03:46:34, Ryan Sleevi wrote: ...
5 years, 9 months ago (2015-03-19 17:53:10 UTC) #11
davidben
Sorry about the delay. Oh what a rabbithole you've uncovered. :-/ https://codereview.chromium.org/1017583002/diff/40001/net/url_request/url_request.cc File net/url_request/url_request.cc (right): ...
5 years, 9 months ago (2015-03-24 23:47:39 UTC) #12
Ryan Sleevi
On 2015/03/24 23:47:39, David Benjamin wrote: > I believe null is correct. Looks like we ...
5 years, 9 months ago (2015-03-24 23:52:56 UTC) #13
Ryan Sleevi
On 2015/03/24 23:52:56, Ryan Sleevi wrote: > Thanks for actually digging in on this David! ...
5 years, 9 months ago (2015-03-24 23:55:12 UTC) #14
davidben
On 2015/03/24 23:55:12, Ryan Sleevi wrote: > On 2015/03/24 23:52:56, Ryan Sleevi wrote: > > ...
5 years, 9 months ago (2015-03-25 00:20:11 UTC) #15
jww
First of all, my apologies, but I accidentally addressed David's comments simultaneously with a rebase. ...
5 years, 9 months ago (2015-03-27 22:16:15 UTC) #16
davidben
On 2015/03/27 22:16:15, jww wrote: > First of all, my apologies, but I accidentally addressed ...
5 years, 9 months ago (2015-03-27 22:46:52 UTC) #17
jww
On 2015/03/27 at 22:46:52, davidben wrote: > On 2015/03/27 22:16:15, jww wrote: > > First ...
5 years, 9 months ago (2015-03-27 22:59:38 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1017583002/120001
5 years, 9 months ago (2015-03-27 22:59:54 UTC) #21
commit-bot: I haz the power
Committed patchset #7 (id:120001)
5 years, 9 months ago (2015-03-28 00:23:00 UTC) #22
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/5fe460ffa7a39f010134cf7c5ca5311f274103e3 Cr-Commit-Position: refs/heads/master@{#322685}
5 years, 9 months ago (2015-03-28 00:23:33 UTC) #23
Peter Kasting
Note that this broke http/tests/security/contentSecurityPolicy/connect-src-beacon-redirect-to-blocked.html . I'm going to attempt to mark that test as ...
5 years, 9 months ago (2015-03-28 02:47:48 UTC) #24
jww
On 2015/03/28 at 02:47:48, pkasting wrote: > Note that this broke http/tests/security/contentSecurityPolicy/connect-src-beacon-redirect-to-blocked.html . > > ...
5 years, 9 months ago (2015-03-28 16:30:06 UTC) #25
jww
5 years, 8 months ago (2015-03-30 18:50:37 UTC) #26
Message was sent while issue was closed.
Apparently I forgot to send out my responses to David's comments :-/ For
posterity's sake, here they are.

https://codereview.chromium.org/1017583002/diff/100001/content/child/web_url_...
File content/child/web_url_loader_impl.cc (right):

https://codereview.chromium.org/1017583002/diff/100001/content/child/web_url_...
content/child/web_url_loader_impl.cc:43: #include
"third_party/WebKit/public/platform/WebString.h"
On 2015/03/27 at 22:46:51, David Benjamin wrote:
> Nit: I think these can go away now.

Indeed! Thanks!

https://codereview.chromium.org/1017583002/diff/100001/net/url_request/url_re...
File net/url_request/url_request.cc (right):

https://codereview.chromium.org/1017583002/diff/100001/net/url_request/url_re...
net/url_request/url_request.cc:954: // set the Origin header to an "opaque
identifier," in this case "null." This
On 2015/03/27 at 22:46:51, David Benjamin wrote:
> Nit: 'Origin header' -> 'request's origin'
>      'in this case "null."' -> 'which serializes to "null."'.
> 
> (I also feel like 'which serializes to "null".' is somewhat less weird since
we're quoting an identifier, but I realize English disagrees with me in general
here...)

Done.

https://codereview.chromium.org/1017583002/diff/100001/net/url_request/url_re...
net/url_request/url_request.cc:962: url::Origin().string());
On 2015/03/27 at 22:46:52, David Benjamin wrote:
> Could you add a TODO to this block and the Origin header bit up in
StripPostSpecificHeaders referencing https://crbug.com/471397?

Done.

Powered by Google App Engine
This is Rietveld 408576698