Verified Commit 94ad82f6 authored by Dan Ballard's avatar Dan Ballard Committed by Pier Angelo Vendrame
Browse files

TB 42660: Disable ProxySelector.openConnectionWithProxy and NOPify CrashReporter.sendCrashReport

parent ab1ff834
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -29,16 +29,19 @@ import java.util.List;

public class ProxySelector {
  public static URLConnection openConnectionWithProxy(final URI uri) throws IOException {
    final java.net.ProxySelector ps = java.net.ProxySelector.getDefault();
    Proxy proxy = Proxy.NO_PROXY;
    if (ps != null) {
      final List<Proxy> proxies = ps.select(uri);
      if (proxies != null && !proxies.isEmpty()) {
        proxy = proxies.get(0);
      }
    }

    return uri.toURL().openConnection(proxy);
    // tor-browser#42660: This should not be used: it cannot safely get tor configs so would be a
    // proxy bypass risk.
    throw new IOException("openConnectionWithProxy disabled by tb-42660");
    // final java.net.ProxySelector ps = java.net.ProxySelector.getDefault();
    // Proxy proxy = Proxy.NO_PROXY;
    // if (ps != null) {
    //   final List<Proxy> proxies = ps.select(uri);
    //   if (proxies != null && !proxies.isEmpty()) {
    //     proxy = proxies.get(0);
    //   }
    // }
    //
    // return uri.toURL().openConnection(proxy);
  }

  public ProxySelector() {}
+5 −0
Original line number Diff line number Diff line
@@ -169,6 +169,11 @@ public class CrashReporter {
      @NonNull final File minidumpFile,
      @NonNull final JSONObject extras)
      throws IOException, URISyntaxException {
    // tor-browser#42660: makeing a NOP
    if (true) {
      return GeckoResult.fromValue("0");
    }

    Log.d(LOGTAG, "Sending crash report: " + minidumpFile.getPath());

    HttpURLConnection conn = null;