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

Issue 277903002: Sanitize referrers for programmatic downloads. (Closed)

Created:
6 years, 7 months ago by cbentzel
Modified:
4 years, 11 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Sanitize referrers for programmatic downloads. These can come from context menu saves, download extensions, and other locations. BUG=369201, 357473

Patch Set 1 #

Patch Set 2 : Comments and remove logs #

Total comments: 1

Patch Set 3 : Added unittests #

Patch Set 4 : CONTENT_EXPORT #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+127 lines, -2 lines) Patch
M content/browser/loader/resource_dispatcher_host_impl.h View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M content/browser/loader/resource_dispatcher_host_impl.cc View 1 2 3 chunks +32 lines, -2 lines 1 comment Download
M content/browser/loader/resource_dispatcher_host_unittest.cc View 1 2 1 chunk +92 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (1 generated)
cbentzel
Any suggestions for how to do automated tests for this? I believe we have some ...
6 years, 7 months ago (2014-05-09 12:17:07 UTC) #1
cbentzel
On 2014/05/09 12:17:07, cbentzel wrote: > Any suggestions for how to do automated tests for ...
6 years, 7 months ago (2014-05-09 14:16:56 UTC) #2
asanka
On 2014/05/09 12:17:07, cbentzel wrote: > Any suggestions for how to do automated tests for ...
6 years, 7 months ago (2014-05-09 15:18:37 UTC) #3
asanka
On 2014/05/09 14:16:56, cbentzel wrote: > On 2014/05/09 12:17:07, cbentzel wrote: > > Any suggestions ...
6 years, 7 months ago (2014-05-09 15:21:53 UTC) #4
cbentzel
On 2014/05/09 15:18:37, asanka wrote: > On 2014/05/09 12:17:07, cbentzel wrote: > > Any suggestions ...
6 years, 7 months ago (2014-05-09 15:33:11 UTC) #5
asanka
On 2014/05/09 15:33:11, cbentzel wrote: > On 2014/05/09 15:18:37, asanka wrote: > > On 2014/05/09 ...
6 years, 7 months ago (2014-05-09 15:51:09 UTC) #6
davidben
+jochen since it looks like he added content::Referrer in https://crbug.com/105028. We should possibly sort out ...
6 years, 7 months ago (2014-05-09 21:43:35 UTC) #7
jochen (gone - plz use gerrit)
https://codereview.chromium.org/277903002/diff/60001/content/browser/loader/resource_dispatcher_host_impl.cc File content/browser/loader/resource_dispatcher_host_impl.cc (right): https://codereview.chromium.org/277903002/diff/60001/content/browser/loader/resource_dispatcher_host_impl.cc#newcode2046 content/browser/loader/resource_dispatcher_host_impl.cc:2046: Referrer SanitizeReferrerForRequest(const GURL& request, maybe that should be on ...
6 years, 7 months ago (2014-05-14 08:32:19 UTC) #8
jochen (gone - plz use gerrit)
alternatively, we could think about exposing the method on SecurityPolicy::generateReferrerHeader and use that all over ...
6 years, 7 months ago (2014-05-14 09:00:48 UTC) #9
davidben
On 2014/05/14 09:00:48, jochen wrote: > alternatively, we could think about exposing the method on ...
6 years, 7 months ago (2014-05-14 15:37:40 UTC) #10
jochen (gone - plz use gerrit)
On 2014/05/14 15:37:40, David Benjamin wrote: > On 2014/05/14 09:00:48, jochen wrote: > > alternatively, ...
6 years, 7 months ago (2014-05-15 10:47:13 UTC) #11
cbentzel
On 2014/05/15 10:47:13, jochen wrote: > On 2014/05/14 15:37:40, David Benjamin wrote: > > On ...
6 years, 7 months ago (2014-05-15 13:21:08 UTC) #12
cbentzel
However, there still may be other browser initiated places for referrers which don't go through ...
6 years, 7 months ago (2014-05-15 13:23:37 UTC) #13
jochen (gone - plz use gerrit)
After thinking a bit more about this: we have two use cases for the referrer ...
6 years, 7 months ago (2014-05-19 13:33:59 UTC) #14
davidben
On 2014/05/19 13:33:59, jochen wrote: > After thinking a bit more about this: > > ...
6 years, 7 months ago (2014-05-19 17:16:20 UTC) #15
cbentzel
6 years, 7 months ago (2014-05-19 23:07:09 UTC) #16
On 2014/05/19 17:16:20, David Benjamin wrote:
> On 2014/05/19 13:33:59, jochen wrote:
> > After thinking a bit more about this:
> > 
> > we have two use cases for the referrer struct - one is recording the
> information
> > that has been sent and one for creating a request.
> > 
> > In the "has been sent" case, the referrer should match its policy. Note that
> > it's kinda difficult to "match the policy" without knowing the URL that was
> > requested, but hey, details...
> > 
> > I would claim that the remaining bugs in chrome are in the latter case - we
> > create a new request and either take an existing referrer or create a new
one
> > without applying the policy.
> > 
> > So having a static method e.g. on content::Referrer that says create
referrer
> > for request and takes a URL and a referrer might be the way to go, wdyt?
> 
> That sounds reasonable to me. Then we can go through and find all the places
> that create {content,WebCore}::Referrer directly and rewire them to use the
> constructor. When I looked at it last week, I think every place that creates
> them also has access to the target URL, so we should be good. And after that,
we
> can clean things up and fix the places within the renderer where we
double-apply
> the policy right now. (It's idempotent, but good to be consistent about only
> doing it at the entry-point to the referrer struct.)

Sounds reasonable to me too.

On my flight today I plumbed the context menu IPC to take a Referrer (instead of
just a policy) as well as Blink/Chromium side changes to handle this correctly
so these cases would be OK.

But I like the idea of the static method and we may need this in other cases.

Powered by Google App Engine
This is Rietveld 408576698