From fb6cfce37c5fb5e3d14671ed8bf140014cdaa7a8 Mon Sep 17 00:00:00 2001 From: PJ Date: Sun, 7 Jun 2026 21:35:08 +0530 Subject: [PATCH] fix(companion): pin the runner listener to loopback --- companion/Sources/Server.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/companion/Sources/Server.swift b/companion/Sources/Server.swift index 4075c8e..1d67f94 100644 --- a/companion/Sources/Server.swift +++ b/companion/Sources/Server.swift @@ -24,7 +24,11 @@ final class Server { self.port = NWEndpoint.Port(rawValue: resolvedPort)! let parameters = NWParameters.tcp parameters.allowLocalEndpointReuse = true - self.listener = try NWListener(using: parameters, on: self.port) + // The simulator shares the host network stack, so an unbound listener + // would be reachable from the host's LAN interfaces. Pin it to + // loopback so only local processes can drive the automation surface. + parameters.requiredLocalEndpoint = NWEndpoint.hostPort(host: "127.0.0.1", port: self.port) + self.listener = try NWListener(using: parameters) } func start() {