Brave-browser: Brave should not intercept non-navigation .torrent file requests

Created on 24 Jul 2019  路  5Comments  路  Source: brave/brave-browser

Description

If a web page embeds the WebTorrent client-side JS library and attempts to load a .torrent file using an XHR request or fetch, Brave will intercept the .torrent file load and replace it with the chrome-extension HTML, breaking the site. This is true not just for the WebTorrent JS library but for any request to fetch a .torrent file.

There's a CodePen that demonstrates this here: https://codepen.io/yciabaud/pen/XdOeWM

Steps to Reproduce

  1. Visit https://codepen.io/yciabaud/pen/XdOeWM
  2. The torrent demo should fail with an error in the console.
  3. Now, disable the WebTorrent extension in Brave settings.
  4. The demo now works.

Actual result:

Uncaught Error: Error downloading torrent: XHR error
    at VM37 webtorrent.min.js:5
    at t.exports.<anonymous> (VM37 webtorrent.min.js:7)
    at t.exports.t (VM37 webtorrent.min.js:5)
    at t.exports.r.emit (VM37 webtorrent.min.js:4)
    at XMLHttpRequest.c.onerror (VM37 webtorrent.min.js:7)

Expected result:

Brave should not intercept requests for .torrent files unless they are top-level navigation requests.

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Version 0.66.101 Chromium: 75.0.3770.142 (Official Build) (64-bit)

Version/Channel Information:

  • Can you reproduce this issue with the current release? Yes
  • Can you reproduce this issue with the beta channel?
  • Can you reproduce this issue with the dev channel?
  • Can you reproduce this issue with the nightly channel?

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields?
  • Does the issue resolve itself when disabling Brave Rewards?
  • Is the issue reproducible on the latest version of Chrome?

Miscellaneous Information:

QA Pass-Linux QA Pass-Win64 QA Pass-macOS QTest-Plan-Specified QYes bug featurwebtorrent release-noteexclude

All 5 comments

WebTorrent users reporting the issue here: https://github.com/webtorrent/webtorrent/issues/1649

@feross just a quick double check. When opening https://codepen.io/yciabaud/pen/XdOeWM while WebTorrent is enabled, it looks like the client-side JS library loads the .torrent and starts downloading it as per:

Screen Shot 2019-09-18 at 1 40 29 AM

Is the above the expected behaviour? When you have WebTorrent either enabled or disabled, you'll get the above and Brave will start loading the .torrent.

@kjozwiak Yep, this is expected behavior. This is JavaScript code running on the website itself and has nothing to do with the built-in WebTorrent implementation in Brave. It's supposed to work in both cases -- when the WebTorrent extension is enabled or disabled.

Verification PASSED on macOS 10.14.6 x64 using the following build:

Brave | 0.69.126 Chromium: 77.0.3865.65聽(Official Build)聽(64-bit)
-- | --
Revision | 87a331a3169cab563505fb44011058b904011ba1-refs/branch-heads/3865@{#726}
OS | macOS Version 10.14.6 (Build 18G95)

Verification passed on

Brave | 0.69.127 Chromium: 77.0.3865.75聽(Official Build)聽(64-bit)
-- | --
Revision | 201e747d032611c5f2785cae06e894cf85be7f8a-refs/branch-heads/3865@{#776}
OS | Ubuntu 18.04 LTS

Verification passed on

Brave | 0.69.128 Chromium: 77.0.3865.75聽(Official Build)聽(64-bit)
-- | --
Revision | 201e747d032611c5f2785cae06e894cf85be7f8a-refs/branch-heads/3865@{#776}
OS | Windows聽10 OS Version 1803 (Build 17134.1006)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexeyBarabash picture AlexeyBarabash  路  3Comments

fmarier picture fmarier  路  3Comments

bbondy picture bbondy  路  3Comments

moritzhaller picture moritzhaller  路  3Comments

jonathansampson picture jonathansampson  路  3Comments