JavaScript Restrictor
Browser extension that improves privacy and security
|
This file contains wrappers for the Geolocation API. More...
Functions | |
function | spoofCall (fakeData, originalPositionObject, successCallback) |
Modifies the given PositionObject according to settings. | |
function | processOriginalGPSDataObject (expectedMaxAge, originalPositionObject) |
switch (args[0]) | |
Variables | |
function let | randomx = geo_prng() |
let | randomy = geo_prng() |
let | previouslyReturnedCoords |
let | clone = obj => Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj)) |
var | geoTimestamp = Date.now() |
Store the limit for the returned timestamps. | |
var | setArgs |
process the parameters of the wrapping function | |
var | provideAccurateGeolocationData = (args[0] === -1) |
let | desiredAccuracy = 0 |
var | wrappers |
This file contains wrappers for the Geolocation API.
The goal is to prevent leaks of user current position. The Geolocation API also provides access to high precision timestamps which can be used to various web attacks (see for example, http://www.jucs.org/jucs_21_9/clock_skew_based_computer, https://lirias.kuleuven.be/retrieve/389086).
Although it is true that the user needs to specificaly approve access to location facilities, these wrappers aim on improving the control of the precision of the geolocation.
The wrappers support the following controls:
When modifying position:
navigator.geolocation.getCurrentPosition()
return the same position without page load and typically return another position after page reload.navigator.geolocation.watchPosition()
does not change position. function processOriginalGPSDataObject | ( | expectedMaxAge, | |
originalPositionObject | |||
) |
function spoofCall | ( | fakeData, | |
originalPositionObject, | |||
successCallback | |||
) |
Modifies the given PositionObject according to settings.
expectedMaxAge | The maximal age of the returned time stamps as defined by the wrapped API (https://www.w3.org/TR/geolocation-API/#max-age) |
originalPositionObject | the position object to be returned without this wrapper, see the Position interface (https://www.w3.org/TR/geolocation-API/#position) |
The function modifies the originalPositionObject and stores it for later readins. The returned position does not modify during the life time of a pages. The returned postion can be different after a page reload.
The goal of the behavoiur is to prevent learning the current position so that different original postion can be mapped to the same position and the same position should generally yield a different outcome to prevent correlation of user activities.
The algorithm works as follows:
The returned timestamp is not older than 1 hour and it is the same as was during the last call or newer. Different calls to the function can yield different timestamps.
switch | ( | args[0] | ) |
let clone = obj => Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj)) |
let desiredAccuracy = 0 |
var geoTimestamp = Date.now() |
Store the limit for the returned timestamps.
This is used to avoid returning older readings compared to the previous readings. The timestamp needs to be the same as was last time or newser.
let previouslyReturnedCoords |
Make sure that repeated calls shows the same position (BUT different objects, via cloning) to reduce fingerprintablity.
var provideAccurateGeolocationData = (args[0] === -1) |
function let randomx = geo_prng() |
let randomy = geo_prng() |
var setArgs |
process the parameters of the wrapping function
Checks if the wrappers should be active, and the position modified. Transforms the desired precision into kilometers.
var wrappers |