How move forward with chromium removing --remote-debugging-address=0.0.0.0 ?
Opened this issue · 1 comments
Describe the bug
Chromium removed the --remote-debugging-address=0.0.0.0 option, now it does nothing.
There is this issue open https://issues.chromium.org/issues/41487252, [bug] Flag --remote-debugging-address
does not work as expected
But it looks like the do not care and are doing nothing about it, by stating:
--remote-debugging-address switch presents a security issue and should not be used. We are planning to remove it from the old headless and there are no plans to implement it in the new headless.
I looked around the chromium source code, and figured out this patch to force 0.0.0.0 instead of 172.0.0.1:
diff --git a/chrome/browser/devtools/remote_debugging_server.cc b/chrome/browser/devtools/remote_debugging_server.cc
index bc8a7d1402a99..bcfec1f560f7b 100644
--- a/chrome/browser/devtools/remote_debugging_server.cc
+++ b/chrome/browser/devtools/remote_debugging_server.cc
@@ -49,9 +49,10 @@ class TCPServerSocketFactory
std::unique_ptr<net::ServerSocket> CreateLocalHostServerSocket(int port) {
std::unique_ptr<net::ServerSocket> socket(
new net::TCPServerSocket(nullptr, net::NetLogSource()));
- if (socket->ListenWithAddressAndPort(
- "127.0.0.1", port, kBackLog) == net::OK)
+ if (socket->ListenWithAddressAndPort("0.0.0.0", port, kBackLog) ==
+ net::OK) {
return socket;
+ }
if (socket->ListenWithAddressAndPort("::1", port, kBackLog) == net::OK)
return socket;
return nullptr;
diff --git a/content/browser/devtools/devtools_http_handler.cc b/content/browser/devtools/devtools_http_handler.cc
index a24477b920c5f..2e2451c533bce 100644
--- a/content/browser/devtools/devtools_http_handler.cc
+++ b/content/browser/devtools/devtools_http_handler.cc
@@ -284,7 +284,8 @@ void StartServerOnHandlerThread(
std::unique_ptr<ServerWrapper> server_wrapper;
std::unique_ptr<net::ServerSocket> server_socket =
socket_factory->CreateForHttpServer();
- std::unique_ptr<net::IPEndPoint> ip_address(new net::IPEndPoint);
+ std::unique_ptr<net::IPEndPoint> ip_address(
+ new net::IPEndPoint(net::IPAddress(0, 0, 0, 0), 9222));
if (server_socket) {
server_wrapper =
std::make_unique<ServerWrapper>(handler, std::move(server_socket),
Can we manage to include our own patched chromium with this fix or can we use something like, this, which will forward port ip:9222 to localhost:9223:
socat TCP-LISTEN:9222,fork TCP:127.0.0.1:9223 &
chromium --headless --disable-gpu --no-sandbox --remote-debugging-port=9223
Related:
Rather than patching chromium could a simple proxy be added that listens on 0.0.0.0 and redirects to 172.0.0.1?