Skip to content

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

test: a credentials-only target proxy must not replace a working parent proxy, pinning applyTargetToRuntime to the server-keyed predicate (PIN-178)

Luigi Agosti5632c1603e50
diff --git a/internal/config/browser_proxy_test.go b/internal/config/browser_proxy_test.go
index 0936983b..35c8e7b1 100644
--- a/internal/config/browser_proxy_test.go
+++ b/internal/config/browser_proxy_test.go
@@ -761,3 +761,32 @@ func TestAnEmptyProxyBlockIsStillValidatedAsAbsent(t *testing.T) {
}
}
}
+
+func TestACredentialsOnlyTargetProxyDoesNotReplaceAWorkingParentProxy(t *testing.T) {
+ cfg := &RuntimeConfig{
+ DefaultBrowser: BrowserChrome,
+ Proxy: BrowserProxyConfig{Server: "http://parent.example:8080"},
+ Targets: BrowserTargetsConfig{
+ "creds": {
+ Provider: BrowserChrome,
+ Proxy: BrowserProxyConfig{Username: "bob", Password: "secret"},
+ },
+ },
+ }
+
+ resolved, err := ResolveExplicitBrowserTarget(cfg, "creds")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got := resolved.Config.Proxy.Server; got != "http://parent.example:8080" {
+ t.Fatalf("resolved proxy server = %q; a target proxy carrying only credentials replaced the working parent proxy, so the target's traffic would egress directly", got)
+ }
+
+ flags, err := BrowserProxyFlags(resolved.Config.Proxy)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(flags) == 0 {
+ t.Fatal("resolved target produced no proxy launch flags; traffic would egress directly, un-proxied")
+ }
+}