Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa4518f7 authored by Jason Monk's avatar Jason Monk
Browse files

PAC Local Proxy to only receive lo connections

This changes the Local Proxy used in PAC to only accept connections coming
from the device.

Bug: 10230718
Change-Id: I5fbeb3aa018df5179a403301021f452e910a517d
parent c255a711
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import com.google.android.collect.Lists;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.ProxySelector;
@@ -198,9 +199,15 @@ public class ProxyServer extends Thread {

                while (mIsRunning) {
                    try {
                        ProxyConnection parser = new ProxyConnection(serverSocket.accept());
                        Socket socket = serverSocket.accept();
                        // Only receive local connections.
                        if (socket.getInetAddress().isLoopbackAddress()) {
                            ProxyConnection parser = new ProxyConnection(socket);

                            threadExecutor.execute(parser);
                        } else {
                            socket.close();
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }