Repository navigation
fix(secrets): exec can't reach local HTTP servers with the secret egress proxy enabled - #160974
Conversation
Gateway-hosted exec grants set HTTPS_PROXY/HTTP_PROXY and NODE_USE_ENV_PROXY without NO_PROXY, so proxy-aware clients tunneled loopback HTTP through the egress proxy, which refuses plain HTTP. Overlay the grant with NO_PROXY/no_proxy that keep existing host entries and add localhost, 127.0.0.1, and ::1.
|
🦞👀 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: needs maintainer review before merge. Reviewed September 29, 2026, 6:28 AM ET / 10:28 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch lets Gateway-hosted exec children reach literal-loopback HTTP servers through the secret egress proxy, updates the security documentation, and adds proxy and opt-in Gateway tests. Merge readiness✅ Ready for maintainer review Current main still refuses plain HTTP through the secret egress proxy, so this PR remains useful. The final branch keeps the new loopback path under proxy authentication and destination policy; this review found no discrete blocking defect. Priority: P2 Review scores
Verification
How this fits togetherGateway-hosted exec gives each child process a proxy credential and secret sentinels. The local egress proxy authenticates requests, applies destination and secret rules, then forwards eligible traffic to the requested server. flowchart LR
A[Exec child] --> B[Proxy credential]
B --> C[Local egress proxy]
C --> D{Destination and secret rules}
D --> E[Loopback HTTP server]
D --> F[HTTPS server]
D --> G[Refusal and audit]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +7, Tests +521, Docs 0. Total +528 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the proxy-owned loopback exception with its existing grant, allowlist, revocation, and sentinel controls, and preserve the documented cleartext limits. Do we have a high-confidence way to reproduce the issue? Yes. Current main unconditionally refuses direct plain HTTP, and the PR reports a real-child control receiving 502 before the change versus 200 afterward. Is this the best way to solve the issue? Yes. The final branch places the exception in the proxy's existing authorization and forwarding owner; the earlier environment bypass identified in review was removed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 876334dc7f7f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Replace the NO_PROXY overlay with literal-loopback HTTP forwarding inside the proxy. Keep authentication, destination policy, audit, upload limits, and sentinel refusal on the shared forwarding path so localhost HTTPS substitution and lockdown retain their existing behavior. Cover actual child-process forwarding and lockdown, preserve HTTPS coverage, and document the cleartext exception. The optional gated Gateway proof remains blocked by runtime artifact publication on this host; real-child proof passes.
Decode Basic proxy authorization directly to validated token bytes, removing the intermediate password handoff while preserving every authentication check. Remove the private allocation wrapper whose length checks duplicate buffered request admission. Production delta for the complete PR is now zero (+47/-47), down from +14.
The earlier buffered-path guard already bounds the length, but static analysis cannot see it across the branch; keep the explicit check beside Buffer.allocUnsafeSlow (restores the pre-cleanup helper).
|
Landing qualification: CI run 36554990288, attempt 1, fails |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
74 upstream commits, including a batch of core and Feishu test removals (openclaw#161136) and the secret egress proxy fix for local HTTP servers (openclaw#160974). One conflict, in extensions/feishu/src/reply-dispatcher.test.ts, where openclaw#161136 removed or shortened tests next to ones this branch edited. Test curation follows main. Tests this branch did not change take upstream's form, so the removed ones stay removed and the shortened ones take the new shape. "keeps oversized auto mode markdown final text on the chunked card path" stays, since this branch changed its chunk limit so a fence fits. It moves to reply-dispatcher.markdown-tables.test.ts, the sibling this branch keeps its fence and table tests in, because keeping it in reply-dispatcher.test.ts grew that over-cap file past the line-cap baseline, and the helper it used there was removed. Its assertions are unchanged and read the mock calls directly, in that file's style. For the receipt loss test, openclaw#161136 kept only the text case, which is the same as this branch's text row, so upstream's version is taken and the card row this branch edited goes with it. "falls back to post mode for 6 tables with explicit renderMode=card" is kept once, in reply-dispatcher.markdown-tables.test.ts where this branch moved the table limit tests, rather than in both files. The two other tests moved there that openclaw#161136 removed, the five table static card case and the six table post case with streaming off, are removed from the moved copy as well, together with the useNonStreamingAutoAccount helper only they used. test/vitest/vitest.extension-database-workers-paths.mjs merged cleanly and keeps this branch's outbound.handoff.test.ts entry. Neither side changed the generated config baseline in this range. build:docker ran in a separate detached checkout of this commit outside the nested node_modules install. Regenerating there left every file as it was (core 2475, channel 3788, plugin 4444), and the three generated-file checks pass there. Upstream deleted 26 test files in this range. None of them were added or changed by this branch. Feishu: 105 files and 1749 tests in the extension project, 17 files and 309 tests in the database-workers project, lower than the previous merge because of openclaw#161136. The forwarder test and the routing guards pass, 431 tests. tsgo:core, tsgo:extensions, tsgo:extensions:test, tsgo:test:root, the line-cap, max-lines and assertion-safety ratchets against upstream/main, oxlint and oxfmt on the 43 changed code files all pass.
…ess proxy enabled (openclaw#160974) * fix(secrets): keep loopback direct under the secret egress proxy Gateway-hosted exec grants set HTTPS_PROXY/HTTP_PROXY and NODE_USE_ENV_PROXY without NO_PROXY, so proxy-aware clients tunneled loopback HTTP through the egress proxy, which refuses plain HTTP. Overlay the grant with NO_PROXY/no_proxy that keep existing host entries and add localhost, 127.0.0.1, and ::1. * fix(secrets): allow loopback HTTP through the secret egress proxy Replace the NO_PROXY overlay with literal-loopback HTTP forwarding inside the proxy. Keep authentication, destination policy, audit, upload limits, and sentinel refusal on the shared forwarding path so localhost HTTPS substitution and lockdown retain their existing behavior. Cover actual child-process forwarding and lockdown, preserve HTTPS coverage, and document the cleartext exception. The optional gated Gateway proof remains blocked by runtime artifact publication on this host; real-child proof passes. * docs(secrets): qualify the non-HTTPS egress warning for loopback HTTP * refactor(secrets): fund loopback forwarding with nearby cleanup Decode Basic proxy authorization directly to validated token bytes, removing the intermediate password handoff while preserving every authentication check. Remove the private allocation wrapper whose length checks duplicate buffered request admission. Production delta for the complete PR is now zero (+47/-47), down from +14. * fix(secrets): keep the buffered body bound next to its allocation The earlier buffered-path guard already bounds the length, but static analysis cannot see it across the branch; keep the explicit check beside Buffer.allocUnsafeSlow (restores the pre-cleanup helper).
What Problem This Solves
Fixes local HTTP fixture and development-server requests failing with 502 when Gateway-hosted exec children use the secret egress proxy.
User Impact
Children using ordinary HTTP proxy forwarding can reach literal loopback HTTP origins while remaining subject to grant authentication, the traffic allowlist, refusal audit, and upload limits. Lockdown still refuses unbound loopback destinations, and localhost HTTPS secret substitution continues to work. No configuration or child-environment changes are required.
Why This Change Was Made
The maintainer decision is to keep loopback under proxy policy. This replaces the earlier NO_PROXY overlay, which bypassed both localhost HTTPS substitution and lockdown enforcement, with a narrow exception at the proxy boundary.
Only direct plain-HTTP requests to
localhost,127.0.0.0/8, or::1use HTTP forwarding. Eligibility is determined from the literal target, never DNS answers. The shared request owner retains authentication, destination policy, resource ownership, reservation/timeout limits, and audit. Its sentinel resolver refuses cleartext substitution in URLs, headers, fixed-length bodies, and streamed bodies. CONNECT and HTTPS retain their existing handling.Evidence
Production LOC: +14 -> 0 (before +38/-24; after +47/-47 against merge base
6f4c801c18f911625c971fa6cb7c3bd4de1d5e87, excluding tests and test-support paths). The cleanup is confined to the two proxy implementation files.Basic proxy authentication now returns validated token bytes directly, removing the intermediate password handoff without changing validation. Buffered allocation now uses the length already validated by admission, removing the private wrapper that repeated those bounds.
Cleanup revalidation: 132 focused tests passed in 199.21s wall, including the real-child loopback forwarding and lockdown regressions. Core typechecking, selected test-type graphs (agents-tools: 16.2s; gateway-root: 17.8s), core-lane typed lint, oxfmt, and diff checks passed. Fresh Codex autoreview at P1 is scoped-clean. Tests and model-facing text are unchanged; prompt snapshots are not applicable.
http.createServerorigins for localhost, IPv4, and IPv6; non-loopback refusals; HTTP sentinel refusal; authentication; allowlisted/bound/bypass hosts; and lockdown.NODE_USE_ENV_PROXY=1. It receives200andloopback-ok; the origin observes a different connection from the child's proxy connection, and audit records the forward. UnderallowedHosts: [], the child receives the exact403remediation, audit recordshost-not-allowed, and the origin receives no request. Node's HTTP client exercises absolute-form forwarding; fetch can use CONNECT, and curl ignores uppercaseHTTP_PROXY.origin/mainrevision6c92ece5beeab4f1b975394c1ec62270dc9dfbfd. The child test failed withAssertionError: expected 502 to be 200; its lockdown counterpart failed withAssertionError: expected 502 to be 403. This control took 307.16s wall. An earlier full baseline run also failed all three loopback-forwarding cases (expected 200/body, received 502/refusal).pnpm tsgo:core, targeted test types (agents-tools and gateway-root), formatting, and diff checks passed; the native core-scoped type-aware lint command passed with no diagnostics (the root-tsconfig form could not get past its extension-declaration preparation timeout). The full changed-scope gate was interrupted after eleven passing checks at 400.02s, before config-doc validation completed; it is not a full gate pass. The work-order time-budget exception applies to that unfinished run. The completed checks include conflict markers, line-cap/suppression/assertion ratchets, changelog attribution, Doctor registry, both wildcard-export guards, duplicate coverage, dependency pins, and formatting. The original proxy-boundary fix passed independent Codex review through P2; the subsequent production-LOC cleanup passed the fresh P1 review recorded above.UpdatePreMutationError: Runtime artifacts changed, but the affected Gateway is running or its offline state could not be verified.(94.88s wall; 18.032s test). No runtime-publication guard was bypassed and no operator state or Gateway was modified. The required real-child proof above passed.Commands and timing scope
The proxy shard passed 125 tests; the unchanged/restored exec-environment suite passed 7. Cold worker compilation dominates wall time (83% transform in the candidate proxy shard), rather than real timers or polling in the new HTTP tests. No new per-test Gateway boot, worker pin, or test timeout is added to the unit suite. CI timing is not yet available for the replacement head.
The interrupted changed-gate tail (SIGINT during the lint-cleanup edit window, not a config-doc mismatch):