fix(proxy): respect upstream_proxy in TLS CONNECT intercept path (#1048) - #1091
Conversation
PR Review SummarySize
Affected crates
Blast radius — ContainedThis PR touches: source code Updated automatically on each push to this PR. |
There was a problem hiding this comment.
Code Review
This pull request implements upstream proxy chaining for TLS intercepted connections, allowing the upstream leg to route through a corporate proxy when configured. The reviewer suggests extracting the strategy selection logic into a helper function select_upstream_strategy to eliminate code duplication between the production code and the newly added unit tests.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…abs-ai#1048) The TLS intercept upstream leg (used for credential injection) always connected directly to the target host, ignoring the configured upstream_proxy / external_proxy. In enterprise environments where the target is only reachable through a corporate proxy, this caused the intercepted request to hang or fail. - Added InterceptUpstreamProxy struct and upstream_proxy field to InterceptCtx so the intercept code can select UpstreamStrategy::ExternalProxy when a proxy is configured. - server.rs now checks the bypass matcher and passes the resolved proxy info into InterceptCtx, mirroring the existing transparent CONNECT path. - Auth-not-implemented check (config.auth.is_some()) fails early and consistently with the external proxy handler. - 3 unit tests for strategy selection (ExternalProxy vs Direct). Signed-off-by: Caio Silva <caio@cdcs.dev>
41b8574 to
c9c7264
Compare
- build_proxy_config_maps_upstream_proxy_to_external_proxy: verifies that build_proxy_config_from_flags maps upstream_proxy to ProxyConfig.external_proxy (nolabs-ai#1048/nolabs-ai#1091 / D-01), documenting that the fork already delivers this intent via the external_proxy field - No cherry-pick of upstream nolabs-ai#1048/nolabs-ai#1091 needed; equivalence confirmed Signed-off-by: Oscar Mack Jr <oscar.mack.jr@gmail.com>
…e test Summary of plan 89-01: - fix: proxy activation predicate now includes !prepared.custom_credentials.is_empty() in both ACTIVE and WARN branches (0c08e5d) - test: D-07 regression tests proxy_activates_with_custom_credentials_only and block_net_overrides_custom_credentials_activation (73bd03a) - test: D-01 equivalence test build_proxy_config_maps_upstream_proxy_to_external_proxy confirms cherry-pick of nolabs-ai#1048/nolabs-ai#1091 unnecessary (751c6ca) - 13/13 proxy_runtime tests green; cross-target verify PARTIAL→CI Signed-off-by: Oscar Mack Jr <oscar.mack.jr@gmail.com>
…ergence ledger Records the four equivalence findings (D-09 nolabs-ai#1077, D-01 nolabs-ai#1048/nolabs-ai#1091, D-02 nolabs-ai#1151, D-10 nolabs-ai#1132), two won't-sync findings (D-05 nolabs-ai#1192, D-04 nolabs-ai#1199), and the one deliberate fork-divergence (D-07 nolabs-ai#1197, fix 0c08e5d) with their guard-test fn names so future syncs expect the Cluster F divergence and never blind-cherry-pick the tls_intercept/RouteSelection/TlsInterceptIntent hunks (D-11). Signed-off-by: Oscar Mack Jr <oscar.mack.jr@gmail.com>
…abs-ai#1048) (nolabs-ai#1091) The TLS intercept upstream leg (used for credential injection) always connected directly to the target host, ignoring the configured upstream_proxy / external_proxy. In enterprise environments where the target is only reachable through a corporate proxy, this caused the intercepted request to hang or fail. - Added InterceptUpstreamProxy struct and upstream_proxy field to InterceptCtx so the intercept code can select UpstreamStrategy::ExternalProxy when a proxy is configured. - server.rs now checks the bypass matcher and passes the resolved proxy info into InterceptCtx, mirroring the existing transparent CONNECT path. - Auth-not-implemented check (config.auth.is_some()) fails early and consistently with the external proxy handler. - 3 unit tests for strategy selection (ExternalProxy vs Direct). Signed-off-by: Caio Silva <caio@cdcs.dev> Co-authored-by: Luke Hinds <lukehinds@gmail.com> Co-authored-by: Aleks <121458075+SequeI@users.noreply.github.com>
The TLS intercept upstream leg (used for credential injection) always connected directly to the target host, ignoring the configured
upstream_proxy/external_proxy. In enterprise environments where the target is only reachable through a corporate proxy, this caused the intercepted request to hang or fail.Issue: #1048
Approach
Two changes in
server.rs::handle_connectionandtls_intercept::handle::forward_inner_request:InterceptCtxasInterceptUpstreamProxy. This mirrors the existing bypass logic for transparent CONNECT.forward_inner_requestselectsUpstreamStrategy::ExternalProxywhenctx.upstream_proxyis set, falling back toUpstreamStrategy::Direct. Theforward.rspipeline already knew how to chain through a proxy — the intercept path just never asked it to.Files changed
crates/nono-proxy/src/tls_intercept/handle.rs— AddedInterceptUpstreamProxystruct +upstream_proxyfield; strategy selection inforward_inner_request; 3 unit tests.crates/nono-proxy/src/tls_intercept/mod.rs— Re-exportInterceptUpstreamProxy.crates/nono-proxy/src/server.rs— Bypass & auth gate beforeInterceptCtxconstruction.Compliance
ProxyError, not applicable to libraryNonoError)AI-assisted contribution.