Page MenuHomePhabricator

ULS GeoIP should not use meta.wm.o/geoiplookup
Closed, ResolvedPublic

Description

In https://github.com/wikimedia/mediawiki-extensions-UniversalLanguageSelector/blob/4dc4b7b81ba16a6fa7e39b2341c3f890e5b6464a/UniversalLanguageSelector.hooks.php#L130 - it appears ULS at least conditionally uses GeoIP data from https://meta.wikimedia.org/geoiplookup. We'll need to fix this to use some alternative free/public source, or have the extension optionally bundle its own server-side service, or just remove the code entirely.

Event Timeline

Change 305412 had a related patch set uploaded (by BBlack):
ULS: Use GeoIP Cookie exclusively for geolocation

https://gerrit.wikimedia.org/r/305412

The cookie is already always used on WMF sites, because $wgULSGeoService = false; in CommonSettings.php. All other users however use the given URL by default.

Nemo_bis renamed this task from ULS GeoIP should use the Cookie to ULS GeoIP should only use the Cookie.Aug 19 2016, 6:50 AM

Ok, I guess I missed the cookie-parsing code in ULS.... or is it relying on the fact that CN has already parsed it into window.Geo?

BBlack renamed this task from ULS GeoIP should only use the Cookie to ULS GeoIP should not use meta.wm.o/geoiplookup.Aug 19 2016, 1:39 PM
BBlack updated the task description. (Show Details)

Change 305412 abandoned by BBlack:
ULS: Use GeoIP Cookie exclusively for geolocation

https://gerrit.wikimedia.org/r/305412

Ok, I guess I missed the cookie-parsing code in ULS.... or is it relying on the fact that CN has already parsed it into window.Geo?

The latter.

return window.Geo && ( window.Geo.country || window.Geo.country_code );

So, the obvious options are:

http://freegeoip.net/json/8.8.8.8
http://geoip.nekudo.com/api/8.8.8.8

Both of these return simple JSON data and are public, and we could do JSON-P here as well as an option. Each has slightly different field naming/structure vs our existing "Geo" layout, though, which would need to be mapped appropriately. We could suggest both as alternative provider settings, and have our JS code automagically support both formats by mapping either layout into the existing Geo fields (based on the observed data keys)?

Simplest thing would be to switch the default freegeoip.net which is already supported and give some time for people update to new MediaWiki Language Extension Bundle or change the configuration manually.

geoip.nekudo.com is on EasyPrivacy blocklist and has a format which is not already supported.

ULS already supports the freegeoip format?

ULS already supports the freegeoip format?

Yes as far as I can see.

Ah, yes, I see now for country_code it does via https://github.com/wikimedia/mediawiki-extensions-UniversalLanguageSelector/blob/9e0dcbde35f3c6c70da3273fad72ebe0fa0e720b/resources/js/ext.uls.common.js#L136 :
return window.Geo && ( window.Geo.country || window.Geo.country_code );

BBlack closed this task as Resolved.Aug 26 2016, 5:13 PM
BBlack claimed this task.