fix(client): route side-channel handshake through configured proxy - #396
Draft
parametalol wants to merge 1 commit into
Draft
parametalol wants to merge 1 commit into
parametalol wants to merge 1 commit into
Conversation
ConnectViaProxy's data path honors HTTP(S)_PROXY, but the transport credentials' side-channel handshake dialed the endpoint directly with a plain net.Dialer to obtain the TLS AuthInfo. Behind an egress proxy that direct dial hangs, so gRPC calls (e.g. roxctl image scan) failed with "authentication handshake failed: dial tcp <central-ip>:443: i/o timeout" even though a proxy was configured (ROX-37149). Add a proxy-aware dialer (HTTP/HTTPS CONNECT with basic-auth + SOCKS5, direct fallback) and use it for the side channel. The WebSocket data transport gets the same Proxy: http.ProxyFromEnvironment treatment, which it was also missing. httpproxy.FromEnvironment is used instead of http.ProxyFromEnvironment to avoid the latter's process-wide env caching (also makes it testable). Prompt: "Address ROX-37149 ... Fix HTTP here. Fix grpc-http1 in ../go-grpc-http1". Partially generated by AI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4 of 9 tasks
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 SummarySummary by CodeRabbit
WalkthroughChangesProxy-aware client dialing
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant ClientHandshake
participant dialProxyAwareContext
participant HTTPProxy
participant Target
ClientHandshake->>dialProxyAwareContext: dial endpoint with context
dialProxyAwareContext->>HTTPProxy: resolve environment proxy
dialProxyAwareContext->>HTTPProxy: send CONNECT request
HTTPProxy->>Target: establish tunnel
HTTPProxy-->>dialProxyAwareContext: return CONNECT response
dialProxyAwareContext-->>ClientHandshake: return connection
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk remains in the proxy dialing changes. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ConnectViaProxy's data path honorsHTTP(S)_PROXY, but the transport credentials' side-channel handshake dialed the endpoint directly with a plainnet.Dialerto obtain the TLSAuthInfo. Behind an egress proxy that direct dial hangs, so gRPC calls (e.g.roxctl image scan) failed withauthentication handshake failed: dial tcp <central-ip>:443: i/o timeouteven though a proxy was configured.This routes the side-channel handshake through a proxy-aware dialer. The WebSocket data transport gets the same
Proxy: http.ProxyFromEnvironmenttreatment, which it was also missing.Downstream context: StackRox ROX-37149. The HTTP path is fixed in the main repo; this PR covers the gRPC path.
Changes
client/proxy_dialer.go:dialProxyAwareContextresolves the proxy viahttpproxy.FromEnvironment()(per-call, avoidinghttp.ProxyFromEnvironment's process-wide caching) and tunnels through HTTP/HTTPSCONNECT(withProxy-Authorizationbasic auth and TLS-to-proxy support) or SOCKS5, falling back to a direct dial when no proxy matches.client/side_channel_creds.go: use the proxy-aware dialer for the side-channel handshake.client/ws_proxy.go: addProxy: http.ProxyFromEnvironmentto the WebSocket proxy transport.Testing
client/proxy_dialer_test.gocovering direct dial, HTTP CONNECT (+ basic auth),NO_PROXYbypass, refused CONNECT, unsupported scheme, and default-port resolution.roxctl image scanagainst a non-resolvablefake-central.invalid:443withHTTPS_PROXYset loggedCONNECT fake-central.invalid:443at the proxy with the fix, and produced no proxy traffic (direct-dial timeout) without it.Partially generated by AI.