fix: always verify TLS on aibridgeproxyd upstream transport#26131
Conversation
|
Are we worried that this might cause issues in real world deployments?
If so, should we perhaps adjust the docs to mention that explicitly? |
jdomeracki-coder
left a comment
There was a problem hiding this comment.
Approving setting potential doc adjustments aside
aaae0b6 to
71062aa
Compare
Docs preview📖 View docs preview for |
AFAIK, we don't have data on how AI Gateway Proxy is typically deployed, but this shouldn't affect most deployments. It only happens when the Coder access URL is HTTPS and its TLS certificate is signed by a self-signed or internal CA not in the system trust store. |

Problem
aibridgeproxyd's HTTP transport (
proxy.Tr) was configured with secure TLS defaults only when an upstream proxy was set. Without one, it fell back to goproxy's default transport, which hasInsecureSkipVerify: true, leaving the connection between the proxy and aibridge vulnerable to MITM on HTTPS deployments.This PR moves the secure transport assignment outside the upstream proxy branch so it applies unconditionally.
Changes
proxy.Trunconditionally (verifiedRootCAs,MinVersion: TLS 1.2).TestProxy_AIBridgeTLSVerificationto cover the verification path between the proxy and aibridge.Notes
HTTPS_PROXYenv var: previously, whenUpstreamProxywas unset,proxy.TrhonoredHTTP_PROXYandHTTPS_PROXYenv vars. After this PR it does not, since MITM'd requests now always go directly to aibridge. This matches the behavior whenUpstreamProxyis configured, which already ignored env vars.CoderAccessURLis HTTPS and its TLS certificate (or the load balancer's certificate fronting it) is signed by a CA not in the system trust store, the proxy will now fail withx509: certificate signed by unknown authority.Closes https://linear.app/codercom/issue/AIGOV-386/ai-bridge-proxy-uses-goproxy-default-with-tls-verification-disabled
Note
Initially generated by Claude Opus 4.7, modified and reviewed by @ssncferreira