Repository navigation
fix(secrets): route protected egress through Gateway env proxies - #178080
Conversation
…/secret-egress-proxy-env-upstream
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
|
Codex review: needs real behavior proof before merge. What this changesThis PR routes protected egress through the Gateway’s existing environment proxies while preserving destination checks and grant-owned connections. Example: The Gateway has HTTPS_PROXY=http://127.0.0.1:1055, and an HTTPS destination is reachable only through that proxy.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this maintainer-authored PR addresses a verified routing defect with a focused change, and source review found no actionable introduced bug. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Gateway’s secret-egress Worker authenticates subprocess grants, checks destination bindings, substitutes sentinels, and forwards requests to upstream services. flowchart LR
A[Managed subprocess] --> B[Authenticated egress Worker]
B --> C[Grant and destination checks]
C --> D[Secret substitution]
D --> E[Environment proxy routing]
E --> F[Destination TLS service]
C --> G[Blind bypass tunnel]
G --> E
Technical reviewBest possible solution: Keep the existing routing adapters and grant lifecycle, with final-effect authority evidence covering the new upstream-proxy path. Do we have a high-confidence way to reproduce the issue? Current-main source establishes direct dialing despite the Gateway proxy environment, and mogol supplies deployment controls and a successful local workaround; no target code was executed during this read-only review. Is this the best way to solve the issue? Reusing the existing environment-proxy adapter addresses the transport owner directly, preserves the shared NO_PROXY policy, and avoids another parser or handshake implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d97b12486899. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Source inspection preserves the security checks, but pending-proxy revocation needs final-effect evidence. EvidenceSecurity concerns:
What I checked:
PR surfaceSource +45, Tests +98, Docs +2. Total +145 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 20, 2026, 1:33 AM ET / 05:33 UTC. |
|
Merged via squash.
|
Fixes #170145
What Problem This Solves
Fixes protected exec requests returning 502 when their destination is reachable only through the Gateway's environment proxy.
User Impact
Secret egress now honors the Gateway's
HTTPS_PROXY/HTTP_PROXYandNO_PROXY, including loopback exclusions, for HTTPS requests, permitted loopback HTTP, andbypassHoststunnels. No new configuration is required; restart the Gateway after changing its proxy environment. Connections remain direct when no proxy is configured.Why This Change Was Made
The secret proxy previously used a direct HTTPS agent, direct HTTP requests, and direct bypass sockets. Reuse the existing Node env-proxy adapter and shared
NO_PROXYowner, with Proxyline's CONNECT implementation for blind tunnels. This implements the maintainer product decision: “Honor env proxy (Recommended).”Destination allowlists and secret bindings still authorize the destination before forwarding. HTTPS keeps substituted secrets inside destination TLS; blind tunnels never substitute. Per-grant TLS trust, connection ownership, and revocation remain intact, including cancellation while a proxy tunnel is pending.
Evidence
e20f553f4f88: direct forwarding originated inb9c6789560bc;668eef75225badded the per-grant TLS pools retained here. That main revision still bypassed env routing in all three upstream paths.routes HTTPS through $route (bypass=$bypass): real local proxy/origin fixtures cover HTTPS proxying, HTTP proxy fallback, loopbackNO_PROXY, no-env direct routing, blind tunnels, successful substitution, and rejection of a destination-denied sentinel before opening another upstream connection.routes loopback HTTP through HTTP_PROXY unless NO_PROXY excludes it: observes proxy requests and CIDR bypass at the actual forwarding boundary.4af5cbeeb8df4065a3e747369e9c1052fda735df: 35 successful jobs, no failures. Per-file timings were not measured locally.+65/-20(net+45), tests+100/-2, docs+2/-0. The necessary growth handles asynchronous blind-tunnel cancellation/errors and grant-owned proxy agents; no policy checks were removed to offset it.