Verified Commit 0aac2934 authored by Dan Ballard's avatar Dan Ballard Committed by Pier Angelo Vendrame
Browse files

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

parent 7583c3e7
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -29,16 +29,18 @@ 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);
//  tb-42660: This should not be used: it cannot safely get tor configs so would be a proxy leak 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 {
    // tb-42660: makeing a NOP
    if (true) {
      return GeckoResult.fromValue("0");
    }

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

    HttpURLConnection conn = null;