-
Notifications
You must be signed in to change notification settings - Fork 28
fix(proxy): add lowercase proxy vars and NODE_EXTRA_CA_CERTS #1234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -343,6 +343,13 @@ export function generateDockerCompose( | |||||||||||||||||||||||||||||||||||||||
| const environment: Record<string, string> = { | ||||||||||||||||||||||||||||||||||||||||
| HTTP_PROXY: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | ||||||||||||||||||||||||||||||||||||||||
| HTTPS_PROXY: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | ||||||||||||||||||||||||||||||||||||||||
| // Lowercase https_proxy for tools that only check lowercase (e.g., Yarn 4/undici, Corepack). | ||||||||||||||||||||||||||||||||||||||||
| // NOTE: We intentionally do NOT set lowercase http_proxy. Some curl builds (Ubuntu 22.04) | ||||||||||||||||||||||||||||||||||||||||
| // ignore uppercase HTTP_PROXY for HTTP URLs (httpoxy mitigation), which means HTTP traffic | ||||||||||||||||||||||||||||||||||||||||
| // falls through to iptables DNAT interception — the correct behavior for connection-level | ||||||||||||||||||||||||||||||||||||||||
| // blocking. Setting http_proxy would route HTTP through the forward proxy where Squid's | ||||||||||||||||||||||||||||||||||||||||
| // 403 error page returns exit code 0, breaking security expectations. | ||||||||||||||||||||||||||||||||||||||||
| https_proxy: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | ||||||||||||||||||||||||||||||||||||||||
| SQUID_PROXY_HOST: 'squid-proxy', | ||||||||||||||||||||||||||||||||||||||||
| SQUID_PROXY_PORT: SQUID_PORT.toString(), | ||||||||||||||||||||||||||||||||||||||||
| HOME: homeDir, | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -699,6 +706,10 @@ export function generateDockerCompose( | |||||||||||||||||||||||||||||||||||||||
| agentVolumes.push(`${sslConfig.caFiles.certPath}:/usr/local/share/ca-certificates/awf-ca.crt:ro`); | ||||||||||||||||||||||||||||||||||||||||
| // Set environment variable to indicate SSL Bump is enabled | ||||||||||||||||||||||||||||||||||||||||
| environment.AWF_SSL_BUMP_ENABLED = 'true'; | ||||||||||||||||||||||||||||||||||||||||
| // Tell Node.js to trust the AWF session CA certificate. | ||||||||||||||||||||||||||||||||||||||||
| // Without this, Node.js tools (Yarn 4, Corepack, npm) fail with EPROTO | ||||||||||||||||||||||||||||||||||||||||
| // because Node.js uses its own CA bundle, not the system CA store. | ||||||||||||||||||||||||||||||||||||||||
| environment.NODE_EXTRA_CA_CERTS = '/usr/local/share/ca-certificates/awf-ca.crt'; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // SECURITY: Selective mounting to prevent credential exfiltration | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1015,6 +1026,10 @@ export function generateDockerCompose( | |||||||||||||||||||||||||||||||||||||||
| // Route through Squid to respect domain whitelisting | ||||||||||||||||||||||||||||||||||||||||
| HTTP_PROXY: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | ||||||||||||||||||||||||||||||||||||||||
| HTTPS_PROXY: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | ||||||||||||||||||||||||||||||||||||||||
| https_proxy: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
| https_proxy: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| https_proxy: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| // Ensure localhost traffic (e.g., healthcheck) bypasses the proxy | |
| NO_PROXY: 'localhost,127.0.0.1,::1', | |
| no_proxy: 'localhost,127.0.0.1,::1', |
Copilot
AI
Mar 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When SSL Bump is enabled, Squid presents certificates signed by the session CA for all clients using the proxy port. The api-proxy sidecar routes upstream requests through Squid (HttpsProxyAgent(HTTPS_PROXY)), but the compose spec does not mount the CA cert into the api-proxy container or set NODE_EXTRA_CA_CERTS there, so upstream TLS requests are likely to fail in --ssl-bump --enable-api-proxy mode. Consider mounting the CA cert into the api-proxy container and setting NODE_EXTRA_CA_CERTS (or otherwise exempting api-proxy traffic from SSL bump).
| // Route through Squid to respect domain whitelisting | |
| HTTP_PROXY: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| HTTPS_PROXY: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| http_proxy: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| https_proxy: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| // Route through Squid to respect domain whitelisting when SSL bump is disabled. | |
| // When SSL bump is enabled, avoid proxying api-proxy HTTPS traffic through Squid | |
| // to prevent TLS failures due to untrusted session CA certificates. | |
| ...(!config.enableSslBump && { | |
| HTTP_PROXY: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| HTTPS_PROXY: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| http_proxy: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| https_proxy: `http://${networkConfig.squidIp}:${SQUID_PORT}`, | |
| }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that both uppercase and lowercase proxy variables are set,
--env/additionalEnvoverrides can easily desync them (e.g., overriding onlyHTTP_PROXYleaveshttp_proxypointing at the default). Similar to the existing NO_PROXY/no_proxy normalization below, consider normalizingHTTP_PROXY↔http_proxyandHTTPS_PROXY↔https_proxyafter applyingadditionalEnvso a single override behaves consistently across clients.