From f05b4a6b4cee6ee2b1d06dd56f8f55cbde6fb77e Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Wed, 4 Mar 2026 12:43:10 -0600 Subject: [PATCH] fix: include user/password in HTTP_PROXY URL for macOS daemon mode The HTTP CONNECT proxy URL was missing credentials from the SOCKS5 proxy URL. Now extracts userinfo from the configured proxy URL so apps authenticating via HTTP_PROXY get the same credentials. --- internal/sandbox/macos.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/internal/sandbox/macos.go b/internal/sandbox/macos.go index da93c56..ba4a6f9 100644 --- a/internal/sandbox/macos.go +++ b/internal/sandbox/macos.go @@ -767,11 +767,18 @@ func WrapCommandMacOS(cfg *config.Config, command string, exposedPorts []int, da // HTTP CONNECT proxy (port 42051) for apps that only understand // HTTP proxies (opencode, Node.js tools, etc.). The CONNECT // proxy resolves DNS server-side. - proxyHost := "localhost" - if u, err := url.Parse(socks5hURL); err == nil && u.Hostname() != "" { - proxyHost = u.Hostname() + httpProxyURL := "http://localhost:42051" + if u, err := url.Parse(socks5hURL); err == nil { + userinfo := "" + if u.User != nil { + userinfo = u.User.String() + "@" + } + host := u.Hostname() + if host == "" { + host = "localhost" + } + httpProxyURL = "http://" + userinfo + host + ":42051" } - httpProxyURL := "http://" + proxyHost + ":42051" sandboxEnvs = append(sandboxEnvs, "ALL_PROXY="+socks5hURL, "all_proxy="+socks5hURL, "HTTP_PROXY="+httpProxyURL, "http_proxy="+httpProxyURL,