Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Potential fix for code scanning alert no. 72: Binding a socket to all network interfaces

Nick Sweeting6f9a4714af59
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index c929e0873..2aa6eb1b7 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -999,7 +999,7 @@ class BrowserSession(BaseModel):
import socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
- s.bind(('', 0))
+ s.bind(('127.0.0.1', 0))
s.listen(1)
debug_port = s.getsockname()[1]