New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 678653 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Consider removing custom SafeBrowsingURLRequestContextGetter

Project Member Reported by nparker@chromium.org, Jan 5 2017

Issue description

This is a follow-on from discussion starting at https://codereview.chromium.org/2546533003#msg88, and is mostly for code simplification.

Safe Browsing code needs to guarantee the cookies set on its connections to Google are not intermingled with other user-trackable cookies. If we can do that with the system context, we can remove one of the few (only?) cases of a private cookie jar.

Most connections are to http://safebrowsing.google.com, but there are a few others... we'd need to audit that.
 
On a side note, we've run into a bunch of issues in general with sharing just subcomponents of URLRequestContexts, and we'd really like to get rid of the ability for consumers to do this (Except perhaps the NetLog, HostResolver, and some proxy configuration stuff).

Comment 2 by sh...@chromium.org, Jan 5 2017

Since the safe-browsing data is per-install, not per-profile, the SB cookies can't mix with the profile cookies.

I would be somewhat surprised to see anything interesting in the safe-browsing cookie store, because there's no way to login at that level.  So just the "cookies necessary for .google.com to work at all", probably.  I only have a cookie for host=.google.com and name=NID.

At least at the safe-browsing level, I think it would be reasonable to whitelist cookies.  I'm not suggesting that because I love complexity, just that for something not visible like this, I'd hate to find out it was starting to persist tons of irrelevant stuff.

Hmm ... also, safe-browsing has been around long enough that it's also possible that cookies needed to be stored originally, but now they're only stored because we've always stored them.  Maybe it would work fine without cookies, or with a transient store.
Note that the system URLRequestContext, which is what I was suggesting, is global, not per-profile, and is not persisted to disk, so it shouldn't have per-profile cookies in it (In theory, at least...).

I hadn't realized SafeBrowsing was persisting cookies to disk, but you're right, it currently is.
Cc: awoz@chromium.org
+awoz for the backend need for Cookies.  I think they are used for diagnostics, experiments, and looking for broken clients.

Comment 5 by awoz@chromium.org, Jan 12 2017

Nathan pretty much summed it up. Used to ensure quality of service.

Comment 6 by mmenke@chromium.org, Jan 12 2017

We're working on componentizing the network stack, so it can potentially be moved out of process, and I don't think we want to make it to be possible to do what SafeBrowsing is currently doing - mixing and matching parts of URLRequestContexts has constantly gotten us into trouble.  (We don't want a method like NetworkService::CreateInstanceThatSharesSomeRandomSubcomponentsWithAnotherNetworkSurfaceButUsesASeparateCookieStore(cooke_store_path, other_network_service))

Seems like it should either switch to an entirely independent instance of the network stack (modulo proxy configuration, logging, and not much else, much like they SystemURLRequestContext vs the profile URLRequestContext), or we need to move it onto one of those two URLRequestContexts.  Just from a simplicity / memory consumption standpoint, I'd rather the latter option, if we can reasonably do it.  If we can't, I can live with the former option.
Cc: battre@chromium.org
+battre for privacy concerns of mixing SB cookie store w/ SystemUrlRequestContext.

If we can guarantee we won't send non-SB cookies to SB services, I think the latter could work.

One question while we're here: What happens when login credentials are required from some corp firewall, to access the Internet? Would the System context get access to that? I heard (from sleevi?) SB would fail to talk to Google in these cases, in the current setup.

Comment 8 by mmenke@chromium.org, Jan 12 2017

Yea, SB would fail in that case, since we can't use a user's credentials in that case.  If there are multiple profiles, which user does safebrowsing get its URLRequestContext from?  What if that user logs out?

If the system one doesn't work, could we instead either use domains for safebrowsing only, or use some mechanism to handle this diagnostic data other than cookies?  (like attaching headers directly)

Comment 9 by mmenke@chromium.org, Jan 12 2017

Also, I don't think we're getting those credentials now, are we?  SafeBrowsing creates its own NetworkSession, and I think that's where the HTTP auth cache lives?

Comment 10 by vakh@chromium.org, Jan 13 2017

Labels: SafeBrowsing-Triaged
Owner: nparker@chromium.org
Status: Assigned (was: Untriaged)
Yup, I remember now that the challenge is we don't know which profile has sufficient credentials to get to the Internet. We'd need to keep track of which profile had them, and attach to that. Does other code need such a thing (e.g. UMA)?

For cookies:  Can we, on a per-request basis, control which cookies are sent?  Like, can I say, "For this connection to safebrowsing.google.com, don't send any cookie scoped to *.google.com" 



No, you can't.  Can only send all matching cookies or not.
Could you host SB on a different domain, not under google.com?

Comment 14 by awoz@chromium.org, Jan 17 2017

That would take quite a bit of work, but may be a reasonable long-term solution. FWIW, API v4 is hosted on googleapis.com, so at least one backend is separated out as of today.
WebView now also requires the use of this custom URLRequestContextGetter since it also needs to have a special cookie jar. If there's not a viable solution to maintain that, we may need to leave this code for now.
WebView is using the SafeBrowsingURLRequestContextGetter just to use its own cookie jar?
Cc: timvolod...@chromium.org
RE#16, Yes. 

+timvolodine@ to cc for awareness
I happened upon the original bug to add this request context:  https://crbug.com/103243 
If we really need this, I'd rather we create a completely independent URLRequestContext (We could also attach cookie headers manually, and tell net/ not to attach them but I suspect that doesn't offer sufficient privacy protections), rather than introducing an API that allows NetworkContexts (With different lifetimes...) to depend on each other.
mmenke -- What do you think is the next step?  This is assigned to me, but I don't think I know how to solve this. Would you like to take it?
Not particularly.  :)  I have a ton of other stuff to do, more core to the network service effort.

It may be worth putting off until we're farther along with the network service effort, but worth noting the current code won't work when the network service is running out of process (i.e., there's no option to leave it alone, since there will be no other URLRequestContext in process to steal from).
We will need to do something for AppContexts (apps are deprecated everywhere but ChromeOS), which may need to do something similar, so it's possible we can piggy back off of whatever we end up doing for that.
Labels: Hotlist-EnamelAndFriendsFixIt
Labels: -Hotlist-EnamelAndFriendsFixIt

Sign in to add a comment