Open Bug 492043 Opened 16 years ago Updated 3 years ago

consider storing the geolocation token as a proper cookie

Categories

(Firefox :: General, defect)

defect

Tracking

()

People

(Reporter: zeniko, Unassigned)

Details

Attachments

(1 file)

There's an increasing number of hacks for treating the geolocation token the same as a tracking cookie (which it effectively is) - see e.g. bug 491810. These hacks wouldn't be needed if the token was stored in the cookie manager to start with - e.g. with "<geolocation>" as the cookie's host (making sure that the cookie isn't actually sent out with any http connection).
Also see 492043.
Attached patch like so?Splinter Review
Attachment #376456 - Flags: review?(doug.turner)
Flags: wanted-firefox3.5?
Comment on attachment 376456 [details] [diff] [review] like so? >diff --git a/dom/src/geolocation/NetworkGeolocationProvider.js b/dom/src/geolocation/NetworkGeolocationProvider.js >--- a/dom/src/geolocation/NetworkGeolocationProvider.js >+++ b/dom/src/geolocation/NetworkGeolocationProvider.js <...snip...> >+ let cookieManager = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2); >+ // XXXzeniko use getCookiesFromHost once bug 423132 is fixed >+ let cookieEnum = cookieManager.enumerator; >+ while (cookieEnum.hasMoreElements()) { >+ let cookie = enu.getNext().QueryInterface(Ci.nsICookie); enu? what's that? :)
(In reply to comment #3) > >+ let cookie = enu.getNext().QueryInterface(Ci.nsICookie); s/enu/cookieEnum/
Comment on attachment 376456 [details] [diff] [review] like so? >+ // the token host is created such that >+ // * it isn't a valid host name so that the cookie is never sent anywhere >+ let tokenHost = "<geolocation>." + req.target.channel.URI.host; Is that comment true? "<geolocation>.foo.com" appears to be a valid hostname, at least as far as nsIURI is concerned. Are we relying on it not being valid in DNS or something? At least some versions of "host" seem to resolve "<geo>.g4v.org", though I apparently can't get firefox or wget to do it...
(In reply to comment #5) > Is that comment true? "<geolocation>.foo.com" appears to be a valid hostname It shouldn't be valid, at least according to RFC 2396 3.2.2. However it indeed looks like internally we only check for spaces - not conformance to the RFC. On second thought, I actually rely on "<geolocation>.foo.com" to pass for a valid host name internally (otherwise clearing all data for a site wouldn't clear the geolocation cookie). If this isn't acceptable, I guess we'd need first a cookie manager enhancement for storing chrome-only cookies...
having a chrome only flag would be good for safe browsing, right?
Yes, see bug 368255. dwitte has said it would be feasible to make the cookie DB support something like this, if someone finds the time.
(i can find the time in late June, but not until then unfortunately.)
Flags: wanted-firefox3.5?
Attachment #376456 - Flags: review?(doug.turner)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: