Page MenuHomePhabricator

New GeoIP service endpoint that returns JSON, not JSONP
Closed, DeclinedPublic2 Estimated Story Points

Description

If Varnish fails to add geolocation headers, or on non-WMF wikis, CentralNotice will fall back to a JSONP request to https://geoiplookup.wikimedia.org/ which sets the window.Geo variable.

That's a needless security risk for users, and as I understand it most browsers will block such a request anyway. We should change the hosted endpoint to serve JSON at https://geoiplookup.wikimedia.org/v2 or something, and fix the CORS, or otherwise debug why fresh installs won't geolocate correctly.

Event Timeline

As you can tell, I barely know enough about CORS to write this bug. But I changed the ext.centralNotice.geoIP.js ajax call to use dataType=json, and although the request still fails, it at least allows Firefox to reach the "always" callback. Otherwise, there is a silent failure and reallyChooseAndMaybeDisplay is never called.

This is a known bug in jQuery 1.x, see Krinkle's work here!
https://github.com/jquery/jquery/issues/2413

DStrine set the point value for this task to 2.May 10 2016, 8:06 PM
DStrine moved this task from Triage to Q4 FY21-22 on the Fundraising-Backlog board.