Skip to content

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

feat: support wildcard (*) in attach allowHosts (#364)

Jamil Zakirovdecab3ec1ac7
diff --git a/internal/orchestrator/handlers_instances.go b/internal/orchestrator/handlers_instances.go
index 96a384b7..c1f5661e 100644
--- a/internal/orchestrator/handlers_instances.go
+++ b/internal/orchestrator/handlers_instances.go
@@ -451,7 +451,7 @@ func (o *Orchestrator) validateAttachURL(rawURL string) error {
host := parsed.Hostname()
hostAllowed := false
for _, allowed := range o.runtimeCfg.AttachAllowHosts {
- if host == allowed {
+ if allowed == "*" || host == allowed {
hostAllowed = true
break
}
diff --git a/internal/orchestrator/orchestrator_test.go b/internal/orchestrator/orchestrator_test.go
index b9d5f0bd..5994c1ba 100644
--- a/internal/orchestrator/orchestrator_test.go
+++ b/internal/orchestrator/orchestrator_test.go
@@ -436,6 +436,22 @@ func TestValidateAttachURL_RejectsBridgeBaseURLWithPath(t *testing.T) {
}
}
+func TestValidateAttachURL_WildcardHost(t *testing.T) {
+ o := NewOrchestratorWithRunner(t.TempDir(), &mockRunner{portAvail: true})
+ o.ApplyRuntimeConfig(&config.RuntimeConfig{
+ AttachEnabled: true,
+ AttachAllowHosts: []string{"*"},
+ AttachAllowSchemes: []string{"http", "ws"},
+ })
+
+ if err := o.validateAttachURL("http://192.168.1.100:9868"); err != nil {
+ t.Fatalf("wildcard host should allow any host, got: %v", err)
+ }
+ if err := o.validateAttachURL("http://bridge-container:9868"); err != nil {
+ t.Fatalf("wildcard host should allow hostname, got: %v", err)
+ }
+}
+
func TestOrchestrator_RegisterHandlers_LocksSensitiveRoutes(t *testing.T) {
o := NewOrchestratorWithRunner(t.TempDir(), &mockRunner{portAvail: true})
o.ApplyRuntimeConfig(&config.RuntimeConfig{})