Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

tor frontend changes for 0.23.x #14143

Merged
merged 79 commits into from
Jun 28, 2018
Merged

tor frontend changes for 0.23.x #14143

merged 79 commits into from
Jun 28, 2018

Conversation

diracdeltas
Copy link
Member

@diracdeltas diracdeltas commented May 15, 2018

requires brave/muon#473
requires brave/muon#470
requires brave/muon#476

fix #12235
fix #1185
fix #8224
fix #12997
fix #13064
fix #13212
fix #13065
fix #12990
fix #13396
fix #13447
fix #12922
fix #13658
fix #13925

Test plans

Basic functionality

  1. Open a new private tab. The 'Use tor' and 'Use duckduckgo' switches should be off. Check that turning on Tor turns on DDG, and that DDG can be disabled independently of Tor.
  2. Go to check.torproject.org in the private tab. It should say that you're using Tor.
  3. Go to check.torproject.org in a regular tab. It should not say that you're using Tor.
  4. Go to https://www.whatismyip.com/ in a second private tab. It should show a different IP than what was shown on check.torproject.org in the first private tab.
  5. Open a new private tab and do a search. It should go over duckduckgo.
  6. Open shields in a tor tab. It should show a warning that some sites don't work over Tor.
  7. Open shields in a regular tab. It shouldn't show a warning.

Enable/disable

  1. Disable Tor in a private tab. Disable DDG.
  2. Visit check.torproject.org in the tab. It should not say that you're using Tor. If you open more private tabs, you should see the same result.
  3. Re-enable Tor. DDG should be auto-enabled too.
  4. Go to check.torproject.org in the private tab. It should say that you're using Tor.
  5. Disable duckduckgo in the private tab. Do a search and it should go over Google now.

Issue 12990

  1. go to http://3expgpdnrrzezf7r.onion/ in a tor tab
  2. no icon should be in the urlbar
  3. go to https://3g2upl4pq6kufc4m.onion/
  4. you should see a lock icon

Issue 13347

  1. go to https://browserleaks.com/geo in a tor tab
  2. you should not see a prompt asking to access your location
  3. the tab should show "PERMISSION DENIED - user denied geolocation"

Plugins

  1. ensure flash is installed and enabled in preferences
  2. go to https://www.onlinemictest.com/webcam-test-in-adobe-flash/
  3. make sure there is no popup asking you to run flash
  4. right click on the flash click-to-play element (looks like a puzzle
    piece) on the page. no context menu should appear.
  5. go to https://shaka-player-demo.appspot.com in a tor private tab
  6. you should not see a widevine notification

Favicon leak

  1. Go to bing.com in a tor tab.
  2. Open the browser inspector (shift + fn + f8 on mac) and inspect the favicon in the tab area.
  3. It should show up as a data: URL instead of https://bing.com....

Search autocomplete

  1. In preferences > Search, enable 'autocomplete search term'
  2. Verify that it's working as expected in a regular tab
  3. Open a new Tor tab and type in the URL bar. You should not see autocomplete search results.

WebRTC

  1. Open https://browserleaks.com/webrtc in a Tor tab. It should not show any private IPs.

WebTorrent

  1. Open a new Tor tab
  2. Go to https://webtorrent.io/torrents/sintel.torrent
  3. It should not load webtorrent

New circuit

  1. Open a Tor tab.
  2. Go to check.torproject.org, note the IP.
  3. Do a hard refresh
  4. It should now show a different IP
  5. Do a regular refresh
  6. It should show the same IP
  7. Open another Tor tab, go to https://www.whatismyip.com/. Do a hard refresh. The IP should change.
  8. Go back to the original Tor tab, do a regular refresh. It should still show the same IP.

cc @riastradh-brave @darkdh

app/filtering.js Outdated
}
torDaemon.onCircuitEstablished(circuitEstablished, (err) => {
if (err) {
appActions.onTorInitError(`Tor error opening a circuit: ${err}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI: An error here means not that there was a problem opening a circuit, but that there was a problem in subscribing to the circuit establishment notifications. (It's rather unlikely that this would happen.)

@bsclifton bsclifton force-pushed the tor/0.23.x branch 3 times, most recently from 8ce6725 to 7e844be Compare June 22, 2018 04:07
@bsclifton bsclifton force-pushed the tor/0.23.x branch 3 times, most recently from 997b07b to 0a2b0e1 Compare June 26, 2018 07:29
riastradh-brave and others added 12 commits June 27, 2018 00:38
Support isolated_storage and tor_proxy
requires brave/muon#473

Use Session::IsOffTheRecord to detect private tab
requires
brave/muon@edad1b2

Set Tor new identify
fix #12997
requires
brave/muon@7e052dd

Session::IsOffTheRecord for app/filtering

Refresh page after getting new identity
requires
brave/muon@c3d6769

implement switch Tor Private Tabs in about:newtab
set isTor depending on tor private tab setting and tor availability
close/re-open private tab when tor switch is toggled
Recreate tor private tab at the same index it was previously at
always enable new identity button for now

Disable search suggestions in private mode for Tor
Fix #13064

set ddg as default search engine in tor private tabs
fix #13212

Disable webtorrent in tor private mode
fix #13063

load favicons in Tor tabs as data: URLs
fix #13065

Omit unlocked icon for HTTP onion sites
Fix #12990
also fix unittests
Test Plan:
1. go to http://3expgpdnrrzezf7r.onion/ in a private tab
2. no icon should be in the urlbar
3. go to https://3g2upl4pq6kufc4m.onion/
4. you should see a lock icon

disable webrtc in tor mode
fix #13397
add note to shields panel about breakage in tor mode

Tor binary path will be passed from browser-laptop (#13455)

Disable widevine notification on Tor tabs
needed for #13396
Test Plan:
1. go to https://shaka-player-demo.appspot.com in a tor private tab
2. you should not see a widevine notification

disable plugins in Tor private tabs

Workaround browser-context-created not being emitted for tor tabs

Disable flash click to play on tor tabs
TODO: figure out a way to disable widevine on a per-tab basis
Test Plan:
1. ensure flash is installed and enabled in preferences
2. go to https://get.adobe.com/flashplayer/about/
3. make sure there is no popup asking you to run flash
4. right click on the flash click-to-play element (looks like a puzzle
   piece) on the page. no context menu should appear.

deny geolocation in tor mode
fix #13447

implement new tor tabs mockup
fix #12922

implement new Tor New Identity UX
fix #13658
Test Plan:
1. open new private tab
2. go to check.torproject.org and open shields
3. click 'new circuit' button in shields
4. it should reload the page and show a new IP
5. open shields again, click the info circle next to 'new circuit'
5. it should open a FAQ page

Bundling tor with Brave

Set the tor socks port and data directory. (#13641)
Pass the port and data directory down for tor to use depending on channel

bind tor new circuit to hard refresh in tor tabs
fix #13925

upgrade to muon 6.1.0 for tor API support
to reduce delay when opening the tor private tab, in preparation for
moving tor initialization to startup.

Auditors: @darkdh
fix #14103

Test Plan:
1. make sure tor tabs is enabled
2. go to a link and right-click 'open in new private tab'
3. in the new private tab, go to check.torproject.org to make sure Tor
   is enabled
4. right click on the onion image, select 'open image in new tab'
5. in the new tab, go to check.torproect.org to make sure Tor is enabled

auditors: @darkdh
bsclifton and others added 9 commits June 27, 2018 00:38
…rror branches for clarity. (#14554)

* Use host 127.0.0.1 explicitly, instead of defaulting to localhost.

May fix Brave's failure to connect to Tor on some networks, with the
following symptom printed to the console:

    tor: control socket error: Error: getaddrinfo ENOTFOUND localhost undefined:55219
    tor: control socket error: Error: getaddrinfo ENOTFOUND localhost undefined:55219
    tor: control socket closed early

Auditors: @diracdeltas

Test Plan:
Sneak into David's house and try running Brave on his home network.
If he has reconfigured it, invent a time machine to revert it to the
previous state where it didn't work.

* Make early error message distinct.

* Pass error along to control connection destruction for consistency.
fix #14567

TEST PLAN:
1. start a local http server on port 9250, ex: "python3 -m http.server 9250 --bind 127.0.0.1"
2. start brave and open tor tab
3. wait for tor error to show
4. click 'retry' button
5. it should show 'connecting...' then show the error again
6. now kill the HTTP server from step 1
7. click 'retry' again. tor should connect this time.
riastradh-brave and others added 2 commits June 27, 2018 23:25
Previously, we would never retry polling for tor launch if we ever
made the decision to open a control connection.

1. If we _haven't_ successfully opened a control connection, make
   sure we call this._polled() on all error paths to process a
   deferred file system watch notification.

2. If we have opened a control connection enough to set the `close`
   event handler, call this._polled() to handle a deferred poll
   (which, in the next tick, will either do the work it needs to do,
   or discover that there is already a control connection and do
   nothing).

3. In the `close` event handler for the control connection, poll for
   tor launch in case tor relaunched, and all the watch events were
   received and ignored, before we noticed that the control
   connection had closed.

With this, browser-laptop will notice when the tor daemon has come
back after muon executes ses.relaunchTor, without needing to call
setupTor again -- which might have had unpredictable consequences of
multiple simultaneous file system watchers and control connections to
tor.

fix #14584

Auditors: @diracdeltas

Test Plan:
1. Turn off your network.
2. Launch Brave.
3. Open a private tab with Tor enabled.
4. Check that the console reports `tor: daemon listens on ...`.
5. Wait 20sec for the connection error dialogue box to pop up.
6. Hit 'retry connection'.
7. Check that the console reports `tor: daemon listens on ...` _again_.
Make polling for tor restart work.  Call setupTor only once.
@bsclifton
Copy link
Member

QA has completed testing of this as of 2:30 today (PST); ready for merge! 😄

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@bsclifton bsclifton merged commit 78b6a53 into 0.23.x Jun 28, 2018
@bsclifton bsclifton deleted the tor/0.23.x branch June 28, 2018 00:21
@bsclifton bsclifton added this to the 0.23.x (Release Channel) milestone Jun 28, 2018
diracdeltas pushed a commit that referenced this pull request Jun 28, 2018
tor frontend changes for 0.23.x
diracdeltas pushed a commit that referenced this pull request Jun 28, 2018
tor frontend changes for 0.23.x
@diracdeltas
Copy link
Member Author

0.23.x: 78b6a53
0.24.x: 70d4f51
master (not merged yet): beffe90 but github won't let me push to master until this has an approving review apparently

bsclifton added a commit that referenced this pull request Jun 28, 2018
Merge pull request #14143 from brave/tor/0.23.x
@bsclifton
Copy link
Member

merged to master with 5108937 (thanks, @diracdeltas!)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants