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

Issue 1153763002: Hardening the 'url::Origin' implementation. (Closed)

Created:
5 years, 7 months ago by Mike West
Modified:
3 years, 5 months ago
CC:
cbentzel+watch_chromium.org, chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, jam, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, nasko+codewatch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Hardening the 'url::Origin' implementation. The current 'url::Origin' implementation is little more than a wrapper for simple string comparison. This patch improves the implementation to bring it into line with the requirements of RFC6454 and the WHATWG's URL specification. BUG=490074

Patch Set 1 #

Total comments: 30

Patch Set 2 : Feedback. #

Total comments: 27

Patch Set 3 : More. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+377 lines, -35 lines) Patch
M content/browser/frame_host/frame_tree_node.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/frame_host/frame_tree_node.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/websocket_host.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M content/child/websocket_bridge.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M content/public/common/common_param_traits.cc View 1 1 chunk +11 lines, -7 lines 0 comments Download
M content/renderer/render_frame_proxy.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M net/url_request/url_request.cc View 1 chunk +1 line, -1 line 0 comments Download
M net/websockets/websocket_stream.cc View 1 chunk +1 line, -1 line 0 comments Download
M url/origin.h View 1 2 1 chunk +121 lines, -6 lines 0 comments Download
M url/origin.cc View 1 2 1 chunk +90 lines, -5 lines 0 comments Download
M url/origin_unittest.cc View 1 2 2 chunks +138 lines, -5 lines 0 comments Download
M url/url_constants.h View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M url/url_constants.cc View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 17 (4 generated)
Mike West
Splitting this out from https://codereview.chromium.org/1151843002, as I agree with most of Ryan's comments re://net on ...
5 years, 7 months ago (2015-05-22 16:29:14 UTC) #2
Ryan Sleevi
I'd like to soft-push-back on this until it's a little clearer the *why* That is, ...
5 years, 7 months ago (2015-05-22 18:37:57 UTC) #3
Ryan Sleevi
Thanks for keeping me involved in this CL, even though it mostly touches //url I'm ...
5 years, 7 months ago (2015-05-22 20:43:36 UTC) #4
Mike West
https://codereview.chromium.org/1153763002/diff/1/content/public/common/common_param_traits.cc File content/public/common/common_param_traits.cc (right): https://codereview.chromium.org/1153763002/diff/1/content/public/common/common_param_traits.cc#newcode57 content/public/common/common_param_traits.cc:57: WriteParam(m, p.port()); On 2015/05/22 at 20:43:35, Ryan Sleevi wrote: ...
5 years, 6 months ago (2015-05-28 07:24:29 UTC) #6
Ryan Sleevi
https://codereview.chromium.org/1153763002/diff/1/url/origin.cc File url/origin.cc (right): https://codereview.chromium.org/1153763002/diff/1/url/origin.cc#newcode83 url/origin.cc:83: return SchemeIs(kHttpsScheme) || SchemeIs(kWssScheme); On 2015/05/28 07:24:29, Mike West ...
5 years, 6 months ago (2015-05-28 07:32:53 UTC) #7
Ryan Sleevi
https://codereview.chromium.org/1153763002/diff/1/content/public/common/common_param_traits.cc File content/public/common/common_param_traits.cc (right): https://codereview.chromium.org/1153763002/diff/1/content/public/common/common_param_traits.cc#newcode57 content/public/common/common_param_traits.cc:57: WriteParam(m, p.port()); On 2015/05/28 07:24:29, Mike West wrote: > ...
5 years, 6 months ago (2015-05-28 07:33:21 UTC) #8
Ryan Sleevi
https://codereview.chromium.org/1153763002/diff/40001/url/origin.cc File url/origin.cc (right): https://codereview.chromium.org/1153763002/diff/40001/url/origin.cc#newcode27 url/origin.cc:27: // valid URL, which is unexpected). Otherwise, pass the ...
5 years, 6 months ago (2015-05-28 07:46:30 UTC) #9
Mike West
On 2015/05/28 at 07:33:21, rsleevi wrote: > https://codereview.chromium.org/1153763002/diff/1/content/public/common/common_param_traits.cc > File content/public/common/common_param_traits.cc (right): > > https://codereview.chromium.org/1153763002/diff/1/content/public/common/common_param_traits.cc#newcode57 ...
5 years, 6 months ago (2015-05-28 13:49:09 UTC) #12
Tom Sepez
These kinds of patches are usually trouble, because we need to ensure compatibility between getting ...
5 years, 6 months ago (2015-05-28 16:07:53 UTC) #13
Tom Sepez
See https://code.google.com/p/chromium/issues/detail?id=166486 for the mess I nearly stepped into when contemplating the same thing about ...
5 years, 6 months ago (2015-05-28 16:15:33 UTC) #14
Mike West
On 2015/05/28 at 16:15:33, tsepez wrote: > See https://code.google.com/p/chromium/issues/detail?id=166486 for the mess I nearly stepped ...
5 years, 6 months ago (2015-05-28 17:51:48 UTC) #15
Tom Sepez
> Are there cases I'm missing where parsing an invalid URL on one side of ...
5 years, 6 months ago (2015-05-29 15:37:18 UTC) #16
Ryan Sleevi
5 years, 6 months ago (2015-05-29 16:29:38 UTC) #17
On 2015/05/29 15:37:18, Tom Sepez wrote:
> > Are there cases I'm missing where parsing an invalid URL on one side of the
> IPC
> > would turn into a valid URL on the other? I suspect there are, since you're
> > warning me about it (but I hope they'd be dealt with via the extra bit). :)
> 
> Usually we get burned by things like embedded NULs, which later muck with the
> comparisons.
> Do we ever send these from a renderer to the browser? 

Yes, we send them from the renderer in the case of WebSockets, and they're fully
trusted. You LG'd that usage, which surprised me ;)

> As I think about it more,
> in a site isolation
> world, we can't really trust anything the renderer says about origins, so if
the
> flow is always the
> other way, I think we're covered.

Agreed. That's why I raised concerns with Mike that we may need to distinguish
"invalid parsed" from "unique" origins, so that the latter can be detected and
rejected programmatically. Moreso its a sign of programmer error, since an
attacker could serialize "unique" origins, but since unique strictly represents
a privilege drop, it's not too bad.

But we are in a state where we are actively using and trusting the renderers for
this.

Powered by Google App Engine
This is Rietveld 408576698