Skip to content

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

fix: wire build version into HAR export creator field

Bosch7b3306274181
diff --git a/cmd/pinchtab/cmd_bridge.go b/cmd/pinchtab/cmd_bridge.go
index 3249fa07..1899a6d2 100644
--- a/cmd/pinchtab/cmd_bridge.go
+++ b/cmd/pinchtab/cmd_bridge.go
@@ -20,7 +20,7 @@ var bridgeCmd = &cobra.Command{
return err
}
cfg.Engine = engineMode
- server.RunBridgeServer(cfg)
+ server.RunBridgeServer(cfg, version)
return nil
},
}
diff --git a/cmd/pinchtab/cmd_cli_runtime.go b/cmd/pinchtab/cmd_cli_runtime.go
index 584a4891..f9263cf3 100644
--- a/cmd/pinchtab/cmd_cli_runtime.go
+++ b/cmd/pinchtab/cmd_cli_runtime.go
@@ -1,6 +1,7 @@
package main
import (
+ "fmt"
"net/http"
"os"
"strings"
@@ -35,7 +36,12 @@ func resolveCLIBase(cfg *config.RuntimeConfig) string {
if envURL := os.Getenv("PINCHTAB_SERVER"); envURL != "" {
return strings.TrimRight(envURL, "/")
}
- return "http://127.0.0.1:9867"
+ // Default to first instance port from config, falling back to 9868.
+ port := cfg.InstancePortStart
+ if port == 0 {
+ port = 9868
+ }
+ return fmt.Sprintf("http://127.0.0.1:%d", port)
}
func resolveCLIToken(cfg *config.RuntimeConfig) string {
diff --git a/cmd/pinchtab/cmd_cli_runtime_test.go b/cmd/pinchtab/cmd_cli_runtime_test.go
index 2b489412..5196cc9a 100644
--- a/cmd/pinchtab/cmd_cli_runtime_test.go
+++ b/cmd/pinchtab/cmd_cli_runtime_test.go
@@ -35,8 +35,8 @@ func TestResolveCLIBase(t *testing.T) {
expected: "http://env:5678",
},
{
- name: "default fallback uses 127.0.0.1 and 9867",
- expected: "http://127.0.0.1:9867",
+ name: "default fallback uses 127.0.0.1 and instancePortStart",
+ expected: "http://127.0.0.1:9868",
},
}
diff --git a/cmd/pinchtab/root.go b/cmd/pinchtab/root.go
index ef30ce9b..c6a94f4a 100644
--- a/cmd/pinchtab/root.go
+++ b/cmd/pinchtab/root.go
@@ -51,7 +51,7 @@ browsers, manage tabs, and perform interactive tasks.`,
case "daemon":
handleDaemonCommand("")
case "bridge":
- server.RunBridgeServer(loadConfig())
+ server.RunBridgeServer(loadConfig(), version)
case "mcp":
runMCP(loadConfig())
case "config":
@@ -111,7 +111,7 @@ func init() {
rootCmd.SetVersionTemplate("pinchtab {{.Version}}\n")
// Global flags
- rootCmd.PersistentFlags().StringVar(&serverURL, "server", "", "PinchTab server URL (default: http://127.0.0.1:9867)")
+ rootCmd.PersistentFlags().StringVar(&serverURL, "server", "", "PinchTab server URL (default: http://127.0.0.1:<instancePortStart>)")
// Grouping commands
primaryGroup := &cobra.Group{ID: "primary", Title: "Primary Commands"}
diff --git a/internal/handlers/download.go b/internal/handlers/download.go
index 7f9e6340..58341083 100644
--- a/internal/handlers/download.go
+++ b/internal/handlers/download.go
@@ -142,6 +142,11 @@ func newDownloadRequestGuard(validator *downloadURLGuard, maxRedirects int) *dow
}
func (g *downloadRequestGuard) Validate(rawURL string, redirected bool) error {
+ // Skip validation for Chrome internal URLs (about:blank, chrome-error://, etc.)
+ // that fire during tab creation before the actual navigation begins.
+ if rawURL == "about:blank" || strings.HasPrefix(rawURL, "chrome") {
+ return nil
+ }
if err := g.validator.Validate(rawURL); err != nil {
return fmt.Errorf("unsafe browser request: %w", err)
}
diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go
index 378a9dc9..072f3024 100644
--- a/internal/handlers/handlers.go
+++ b/internal/handlers/handlers.go
@@ -29,6 +29,7 @@ type Handlers struct {
Recovery *recovery.RecoveryEngine
Router *engine.Router // optional; nil ⇒ chrome-only
IDPIGuard idpi.Guard
+ Version string // build version injected at startup
clipboard clipboardStore
}
diff --git a/internal/handlers/network_export.go b/internal/handlers/network_export.go
index 8c2d0cf5..7f133cf9 100644
--- a/internal/handlers/network_export.go
+++ b/internal/handlers/network_export.go
@@ -524,6 +524,9 @@ func parseNetworkFilter(r *http.Request) bridge.NetworkFilter {
}
func (h *Handlers) version() string {
+ if h.Version != "" {
+ return h.Version
+ }
return "dev"
}
diff --git a/internal/server/bridge.go b/internal/server/bridge.go
index d5b6708e..79f4803c 100644
--- a/internal/server/bridge.go
+++ b/internal/server/bridge.go
@@ -18,7 +18,7 @@ import (
"github.com/pinchtab/pinchtab/internal/handlers"
)
-func RunBridgeServer(cfg *config.RuntimeConfig) {
+func RunBridgeServer(cfg *config.RuntimeConfig, version string) {
listenAddr := cfg.ListenAddr()
cli.PrintStartupBanner(cfg, cli.StartupBannerOptions{
Mode: "bridge",
@@ -43,6 +43,7 @@ func RunBridgeServer(cfg *config.RuntimeConfig) {
mux := http.NewServeMux()
h := handlers.New(bridgeInstance, cfg, nil, nil, nil)
+ h.Version = version
configureBridgeRouter(h, cfg)
shutdownOnce := &sync.Once{}