brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.84k stars 2.33k forks source link

expose option to route background network connections through Tor #13208

Open diracdeltas opened 3 years ago

diracdeltas commented 3 years ago

For users who already have Tor installed in Brave, we should route some network connections through them when possible to reduce linkage by IP address. Examples:

Flow:

  1. If user has enabled the Use Tor for background requests when possible option, start the Tor daemon on browser startup. Download and install Tor binary if needed.
  2. Attempt requests in the list above through Tor; cancel and retry using a regular connection if they don't succeed within some timeout.
  3. Show user a warning if Tor disconnects or is unable to initialize

Other technical requirements:

  1. These requests should probably enforce some of the load flags in https://source.chromium.org/chromium/chromium/src/+/master:net/base/load_flags_list.h;drc=dfc900f264620d40dc6dc1a9be24d32eaa9e751e;l=0, like disabling cookies/cache.
  2. May want to expose a brave-only extension API for this so that requests from our builtin extensions can use Tor connections.
bbondy commented 3 years ago

At the time of implementing this, let's also do new P3A for how often a Tor request is downgraded to a normal connection. We might also want to split this up into multiple issues and do the easiest first.

If Use Tor for background requests when possible is set I think it would be best to not lazy load Tor. We could start with off by default to start.