Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

security: bind to 127.0.0.1 by default

Mario7aa7bbd86372
diff --git a/cmd_dashboard.go b/cmd_dashboard.go
index ce406421..59dd6979 100644
--- a/cmd_dashboard.go
+++ b/cmd_dashboard.go
@@ -83,7 +83,7 @@ func runDashboard() {
loggingMiddleware(corsMiddleware(authMiddleware(mux))),
)
- srv := &http.Server{Addr: ":" + dashPort, Handler: handler}
+ srv := &http.Server{Addr: cfg.Bind + ":" + dashPort, Handler: handler}
autoLaunch := strings.EqualFold(os.Getenv("PINCHTAB_AUTO_LAUNCH"), "1") ||
strings.EqualFold(os.Getenv("PINCHTAB_AUTO_LAUNCH"), "true") ||
diff --git a/config.go b/config.go
index 47cb6cc6..20bdf6ac 100644
--- a/config.go
+++ b/config.go
@@ -48,6 +48,7 @@ var welcomeHTML string
// RuntimeConfig holds all runtime configuration in a single struct.
// Loaded once at startup from environment variables and optional config file.
type RuntimeConfig struct {
+ Bind string
Port string
CdpURL string
Token string
@@ -112,6 +113,11 @@ func homeDir() string {
return h
}
+// ListenAddr returns bind:port for http.Server.Addr.
+func (c *RuntimeConfig) ListenAddr() string {
+ return c.Bind + ":" + c.Port
+}
+
// FileConfig is the JSON config file format.
type FileConfig struct {
Port string `json:"port"`
@@ -129,6 +135,7 @@ type FileConfig struct {
func loadConfig() {
// Populate from environment with defaults
cfg = RuntimeConfig{
+ Bind: envOr("BRIDGE_BIND", "127.0.0.1"),
Port: envOr("BRIDGE_PORT", "9867"),
CdpURL: os.Getenv("CDP_URL"),
Token: os.Getenv("BRIDGE_TOKEN"),
diff --git a/main.go b/main.go
index 99ef71a6..b83f3d96 100644
--- a/main.go
+++ b/main.go
@@ -152,7 +152,7 @@ func main() {
}
}
- srv := &http.Server{Addr: ":" + cfg.Port, Handler: dashboard.TrackingMiddleware(
+ srv := &http.Server{Addr: cfg.ListenAddr(), Handler: dashboard.TrackingMiddleware(
[]EventObserver{profileObserver},
loggingMiddleware(corsMiddleware(authMiddleware(mux))),
)}