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

How move forward with chromium removing --remote-debugging-address=0.0.0.0 ? #253

Open
evandrocoan opened this issue Jul 1, 2024 · 0 comments
Labels

Comments

@evandrocoan
Copy link

evandrocoan commented Jul 1, 2024

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:

  1. Support --headless=new #225
  2. devtools external socket binding in chrome headed mode #158
@evandrocoan evandrocoan added the bug label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant