The vulnerability was caused by a logical error in the sandbox-manager.ts file within the wrapWithSandbox function. The system was designed to restrict network access based on an allowedDomains list. The documented behavior stated that an empty allowedDomains array should block all network access. However, the code incorrectly equated an empty list with a disabled network sandbox.
The key flaw was the line const needsNetworkProxy = allowedDomains.length > 0, the result of which was then used to determine if network restrictions should be applied (needsNetworkRestriction: needsNetworkProxy). When a user provided an empty allowedDomains: [], needsNetworkProxy became false, which in turn meant needsNetworkRestriction was false. This caused the sandbox to be created without any network isolation, allowing sandboxed code to make unrestricted network requests.
The patch addresses this by decoupling the concept of "network restriction" from "network proxying". A new variable, needsNetworkRestriction, is set to true whenever any network configuration is provided, including an empty allowedDomains array. This ensures that the platform-specific sandboxing functions (wrapCommandWithSandboxLinux and wrapCommandWithSandboxMacOS) are always invoked with the instruction to isolate the network. The fix in wrapCommandWithSandboxLinux then uses --unshare-net to create a new, empty network namespace, effectively blocking all network access unless proxy sockets are explicitly provided for filtered access.