Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebTorrent: intercept only top-level frame requests for .torrent files #3035

Merged
merged 3 commits into from
Jul 27, 2019

Commits on Jul 26, 2019

  1. small style fix

    - `renderFileLink` is never called when `torrent` is null
    - Remove duplicate props deconstruction
    feross committed Jul 26, 2019
    Configuration menu
    Copy the full SHA
    8c15aef View commit details
    Browse the repository at this point in the history
  2. Do not redirect URL requests with #ix= to the .torrent file

    When the user clicks on a file in the torrent file list, a new tab opens which points to the .torrent file, but with a file fragment appended. For example, the torrent https://webtorrent.io/torrents/big-buck-bunny.torrent would have a link to https://webtorrent.io/torrents/big-buck-bunny.torrent#ix=1 for the 2nd file in the torrent.
    
    Without this PR, this request passes the `IsWebtorrentInitiated(ctx)` condition and is therefore allowed to reach the network. Instead, we should confirm that the request is not for an individual file before letting it go to the network. That's what this commit does.
    
    Fixes: brave/brave-browser#3966
    feross committed Jul 26, 2019
    Configuration menu
    Copy the full SHA
    623a37f View commit details
    Browse the repository at this point in the history
  3. WebTorrent: intercept only top-level frame requests for .torrent files

    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.
    
    Fixes: brave/brave-browser#5361
    Fixes: brave/brave-browser#3164
    Fixes: brave/brave-browser#1436
    feross committed Jul 26, 2019
    Configuration menu
    Copy the full SHA
    03868fe View commit details
    Browse the repository at this point in the history