openwpm / OpenWPM

A web privacy measurement framework

Home Page:https://openwpm.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Firefox's Tracking Protection

englehardt opened this issue · comments

Tracking Protection was added in Firefox 42, so we should be able to turn on support for it.

The pref is currently disabled: https://github.com/citp/OpenWPM/blob/master/automation/DeployBrowsers/configure_firefox.py#L30-L35

However, enabling the pref still won't work correctly as we remove the update URL to prevent stray HTTP requests to mozilla's servers during a crawl (see: https://github.com/citp/OpenWPM/blob/master/automation/DeployBrowsers/configure_firefox.py#L137). It should be pretty easy to figure out the API to query and manually download the list at the start of a crawl.

The two update urls are:

  • https://tracking-protection.cdn.mozilla.net/mozstd-track-digest256/1471874828
  • https://tracking-protection.cdn.mozilla.net/mozstd-trackwhite-digest256/1478554625

So we can just make these requests manually with the requests library and update the timestamp at the end of the url. In order to have Firefox consume these lists we probably need to set browser.safebrowsing.provider.mozilla.lists to mozstd-track-digest256,mozstd-trackwhite-digest256, but we'll need to be sure that auto-updates are not enabled.

The basic way to reenable tracking protection is to have a browser_params["tp_cookies"].lower() == "etp" check in here
https://github.com/mozilla/OpenWPM/blob/65337e0c19dc857f63bbca1b3aa3773a2c49fd42/automation/DeployBrowsers/configure_firefox.py#L17-L23
and set cookie_behaviour to 5 if that's the case.
The only other modification required is to wrap this code block in an if to check the same thing.
https://github.com/mozilla/OpenWPM/blob/65337e0c19dc857f63bbca1b3aa3773a2c49fd42/automation/DeployBrowsers/configure_firefox.py#L98-L115