Skip to content
This repository was archived by the owner on Apr 17, 2026. It is now read-only.

Commit decab3e

Browse files
jzakirovclaude
andauthored
feat: support wildcard (*) in attach allowHosts (pinchtab#364)
Allow "*" as a value in security.attach.allowHosts to permit any host when orchestrator and bridge instances share a Docker network or run on different machines. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c619c43 commit decab3e

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

internal/orchestrator/handlers_instances.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ func (o *Orchestrator) validateAttachURL(rawURL string) error {
451451
host := parsed.Hostname()
452452
hostAllowed := false
453453
for _, allowed := range o.runtimeCfg.AttachAllowHosts {
454-
if host == allowed {
454+
if allowed == "*" || host == allowed {
455455
hostAllowed = true
456456
break
457457
}

internal/orchestrator/orchestrator_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,22 @@ func TestValidateAttachURL_RejectsBridgeBaseURLWithPath(t *testing.T) {
436436
}
437437
}
438438

439+
func TestValidateAttachURL_WildcardHost(t *testing.T) {
440+
o := NewOrchestratorWithRunner(t.TempDir(), &mockRunner{portAvail: true})
441+
o.ApplyRuntimeConfig(&config.RuntimeConfig{
442+
AttachEnabled: true,
443+
AttachAllowHosts: []string{"*"},
444+
AttachAllowSchemes: []string{"http", "ws"},
445+
})
446+
447+
if err := o.validateAttachURL("http://192.168.1.100:9868"); err != nil {
448+
t.Fatalf("wildcard host should allow any host, got: %v", err)
449+
}
450+
if err := o.validateAttachURL("http://bridge-container:9868"); err != nil {
451+
t.Fatalf("wildcard host should allow hostname, got: %v", err)
452+
}
453+
}
454+
439455
func TestOrchestrator_RegisterHandlers_LocksSensitiveRoutes(t *testing.T) {
440456
o := NewOrchestratorWithRunner(t.TempDir(), &mockRunner{portAvail: true})
441457
o.ApplyRuntimeConfig(&config.RuntimeConfig{})

0 commit comments

Comments
 (0)