Sandbox egress proxy re-originates TLS even with access: full, causing Cloudflare-fronted upstreams to reset the connection
Investigation Summary
OpenCode Zen (Cloudflare-fronted, https://opencode.ai/zen/v1) connections from inside a
NemoClaw sandbox fail 100% of the time with a TLS reset on the proxy's re-originated (MITM)
connection. This is independent of the protocol: rest vs access: full policy setting —
switching to access: full did NOT stop the interception; the OCSF log still shows the
decrypted request path afterward, meaning access: full only lifts L7 path restrictions,
it does not provide a raw CONNECT passthrough. A normal client (host-side curl) reaches the
same Cloudflare IP successfully at the same time, so the origin itself is reachable; only the
proxy's own re-originated TLS handshake is being reset.
Description
Chat completions sent from inside a sandbox to an OpenAI-compatible HTTPS endpoint fronted by Cloudflare fail every time with:
APIConnectionError: Connection error.
This happens regardless of retries (3/3 always fail) and regardless of whether the sandbox's
network policy for the endpoint is protocol: rest (with explicit path rules) or access: full.
Reproduction Steps
- Add a sandbox network policy preset allowing
<cloudflare-fronted-host>:443, either asprotocol: restwith explicit method/path rules, or asaccess: full. - Apply it:
nemoclaw <sandbox> policy-add <preset> --yes. - Point a
compatible/canonical provider at the host and attempt a completion via the official path:nemoclaw <sandbox> exec -- hermes -z "test" --provider <name> -m <model>. - Observe: 3/3 retries fail with
Connection error. - Compare: from the WSL/Docker host (outside the sandbox),
curlto the same hostname (confirmed to resolve to the same Cloudflare IP range as the sandbox) succeeds 100% of the time, ~0.2–0.4s TLS handshake, HTTP 200. - Change the policy endpoint from
protocol: rest(+ rules) toaccess: full, re-apply viapolicy-removethenpolicy-add(policy-add alone reports "already applied" and does not pick up the file change). Re-run step 3. Behavior is unchanged — still fails, and the OCSF log still shows the decrypted HTTP path, confirming TLS is still intercepted underaccess: full. - Revert the policy to its original form.
Environment
- nemoclaw v0.0.79, openshell 0.0.72
openshell/openshell-gateway/openshell-sandboxbinaries: mtime 2026-07-11 09:58, unchanged across the whole period the symptom appeared (not a regression from an update)- Sandbox network policy engine (OpenShell-managed egress proxy at the sandbox's internal
gateway address,
10.200.0.1:3128in our environment)
Debug Output
Host-side curl to the same Cloudflare IP range at the same time, 3 consecutive attempts:
try1: HTTP=200 tls=0.210639s total=0.451434s
try2: HTTP=200 tls=0.196017s total=0.355001s
try3: HTTP=200 tls=0.195918s total=0.356174s
DNS resolution identical from host and from inside the sandbox container (same Cloudflare
IPv6 range, 2606:4700:78::...) — ruling out DNS-based divergence.
Policy diff test: the endpoint's policy block, byte-compared between a version known to work
previously and the currently-failing version, was byte-identical (protocol: rest +
path rules unchanged) — ruling out a policy regression as the cause. Other hosts behind the
same protocol: rest L7-inspection engine on the same sandbox (unrelated to this endpoint)
succeed reliably through the same proxy at the same time, ruling out the proxy being globally
broken or protocol: rest itself being the cause.
Logs
## Logs
OCSF audit log for each failing attempt (sandbox-side, via the official `nemoclaw <sandbox>
logs` command — NOT `docker exec`, which produces misleading results for this kind of test):
NET:OPEN [INFO] ALLOWED <binary> -> <host>:443 [policy:<preset> engine:opa]
HTTP:POST [INFO] ALLOWED POST http://<host>:443/<path> [engine:l7]
NET:FAIL [LOW] <host>:443
Underlying transport error surfaced in the agent log:
Proxy connection error: Connection reset by peer (os error 104)
Reproduced identically 6/6 times across two separate test sessions, one day apart.
Checklist
- [x] I confirmed this bug is reproducible
- [x] I searched existing issues and this is not a duplicate
✨ Thanks for the detailed investigation. This is a clear sandbox egress proxy bug where the proxy performs MITM re-origination even when access: full should allow raw passthrough. The fact that host-side curl works confirms the origin is reachable.
Triage: root cause and workaround
Root cause (upstream, OpenShell egress proxy). The sandbox egress proxy terminates TLS on allowed HTTPS endpoints and re-originates a fresh handshake toward the upstream so it can perform L7 inspection — and since OpenShell v0.0.15 it does this unconditionally on REST hosts, even when the endpoint declares access: full. NemoClaw does not rewrite or reinterpret the policy here; it passes your policy verbatim to OpenShell. The re-originated handshake is the thing Cloudflare-fronted upstreams reset: the origin is answering the proxy's handshake (with the proxy's ALPN/TLS client characteristics) rather than the sandboxed client's, and the observed result is a reset mid-handshake (ECONNRESET, curl: (35) ... SSL_ERROR_SYSCALL) even though policy-list shows the host as allowed.
Workaround (available today). Declare the endpoint as a raw L4 CONNECT tunnel with access: full plus tls: skip. The proxy then passes the encrypted bytes through unmodified, and the client inside the sandbox negotiates TLS directly with the origin:
preset:
name: cf-fronted-api
description: "Cloudflare-fronted API that resets re-originated TLS"
network_policies:
cf_fronted_api:
name: cf_fronted_api
endpoints:
- host: api.example.com
port: 443
access: full
tls: skip
binaries:
- { path: /usr/local/bin/node }
Save it as nemoclaw-blueprint/policies/presets/cf-fronted-api.yaml (the filename without .yaml must match preset.name) so it joins the preset catalog, then apply it by name:
nemoclaw <sandbox> policy-add cf-fronted-api
This is the same mechanism the built-in whatsapp channel preset (src/lib/messaging/channels/whatsapp/policy/openclaw.yaml) uses for web.whatsapp.com (its HTTP/1.1-only Noise-over-WebSocket handshake doesn't survive TLS re-origination either). Caveat: tls: skip disables L7 inspection for that endpoint — the proxy can no longer see or filter method/path/body — so scope it to the specific hosts that need it; only the policy's declared host/port/binaries scoping remains.
Upstream filing needed. The underlying defect — that access: full still TLS-re-originates instead of behaving as (or at least offering) a transparent CONNECT passthrough, i.e. the access: full semantics / CONNECT-passthrough behavior itself — lives in the OpenShell proxy, not in NemoClaw. That needs a separate issue against OpenShell; NemoClaw cannot change the proxy's TLS handling from its side.
NemoClaw-side changes (PR incoming).
- Docs:
tls: skipraw passthrough was previously documented only in a comment inside the WhatsApp preset YAML. A new "Custom Recipe: Raw TLS Passthrough withtls: skip" section in Customize the Sandbox Network Policy covers when to use it (CDN/Cloudflare-fronted upstreams that reset the proxy's re-originated handshake), a worked example, and the security trade-off. Thepolicy-addreference and the Outlook integration example were updated to match the new re-add contract below. - Drift-aware
policy-add: while reproducing this, we found that editing an already-applied preset file (e.g. addingtls: skipto an endpoint) and re-runningpolicy-add <preset>was silently rejected with "already applied" based on the registry name alone, forcing apolicy-remove/policy-addcycle.policy-add <preset>now compares the preset content against the live policy: unchanged content is a successful exit-0 no-op, and drifted (or live-policy-missing) content is re-applied through the normal preview/confirmation flow. Names owned by a custom--from-filepreset, or comparisons that cannot be made (gateway unreachable), still fail conservatively.
Hi,
Retested the tls: skip workaround on the current stack (nemoclaw v0.0.90, in-sandbox OpenShell 0.0.85, Hermes v0.18.0). Reporting back because the workaround, while it does stop the reset, turns out not to be sufficient for a credentialed Cloudflare-fronted endpoint — there's a catch‑22 worth capturing here.
Two modes, verified via OCSF logs against opencode.ai:443:
protocol: rest/access: full(L7): stillNET:FAILon 0.0.85 — the proxy's re-originated TLS is reset by Cloudflare exactly as before. So the underlying re-origination behavior is unchanged in OpenShell 0.0.85 (consistent with this being a separate, still-open OpenShell issue).access: full+tls: skip(raw L4 passthrough): the connection to opencode.ai now succeeds (no reset) — the workaround does what it says. But because the proxy no longer terminates TLS, it can't rewrite theopenshell:resolve:env:OPENCODE_ZEN_API_KEYplaceholder into the real key at the egress boundary, so the sandbox client sends the unresolved placeholder and opencode.ai returns401 Invalid API key.
So for endpoints that are both Cloudflare-fronted and require a credential resolved at the egress boundary, tls: skip and L7 are mutually exclusive requirements: L7 is needed to inject the credential, but L7 re-origination is what Cloudflare rejects. tls: skip is a good fix for credential-less endpoints (like the WhatsApp Noise/WebSocket case it was built for), but it can't carry a boundary-resolved credential.
The thing that would actually unblock this class of endpoint is the OpenShell-side fix so access: full is a genuine CONNECT passthrough (client's own TLS reaches the origin) while still allowing the credential rewrite — or otherwise making the proxy's outbound TLS acceptable to Cloudflare. Flagging in case it's useful for prioritizing/framing the separate OpenShell issue. Happy to retest once that lands.
Hi, Noticed this got closed via #7352's merge. Just flagging that the actual root cause tracked by this issue is still open, per #7352's own description:
"The TLS re-origination defect itself (no raw CONNECT passthrough under
access: full, and the re-originated handshake that Cloudflare rejects) needs an upstream OpenShell change and is out of scope here"
#7352 documents the tls: skip workaround and fixes an unrelated NemoClaw-side policy-add bug — both genuinely useful — but it doesn't touch the egress proxy's TLS re-origination behavior itself. And as noted in my comments on #7361, tls: skip isn't a full substitute for a fix: it avoids the Cloudflare reset but also skips the credential-rewrite step, so any Cloudflare-fronted endpoint that needs a credential injected at the egress boundary (e.g. OpenCode Zen) is still unreachable either way.
Could this be reopened, or a new issue opened specifically for the upstream OpenShell TLS re-origination fix? Right now the underlying defect has no open tracking issue on the NemoClaw side. Happy to help retest once there's something to test against.
Reopening — you're right, thanks for flagging. #7352 auto-closed this via a Closes keyword, but it only covered the two NemoClaw-side actionable pieces
On upstream tracking: there is currently no open OpenShell issue for this (OpenShell#533 is the closed feature that introduced the behavior; OpenShell#760 covered a different tls: skip symptom).
For filing the OpenShell issue, a useful framing would be to propose either (a) genuine CONNECT-passthrough semantics under access: full + tls: skip-like modes with an explicit, documented "no placeholder resolution" trade-off, and/or (b) making the proxy's re-originated handshake acceptable to Cloudflare (client-hello/ALPN parity), which would preserve the credential rewrite — option (b) is the only shape that fully unblocks credentialed CF-fronted endpoints.
Keeping this issue open on the NemoClaw side to track that upstream dependency.
Hi, Filed: NVIDIA/OpenShell#2455 — proposes the two design directions discussed above (explicit no-rewrite passthrough mode as a smaller safety fix, and matching the re-originated TLS handshake fingerprint to what Cloudflare accepts as the fix that actually unblocks credentialed CF-fronted endpoints). Linking back here per your request so this stays tracked on both sides. Thank you.
Status checked on 2026-10-15 against main 80491e9.
The policy reapplication and documentation changes from #7352 shipped in v0.0.94.
Current passthrough documentation states that tls: skip disables egress-boundary credential resolution.
It does not solve the credentialed Cloudflare endpoint failure.
NVIDIA/OpenShell#2455 remains open without a linked fix. The later mTLS proposal NVIDIA/OpenShell#2788 explicitly excludes the Cloudflare fingerprint problem.
The remaining acceptance case is a successful request to the affected endpoint while OpenShell still injects the credential at the egress boundary. A tunnel without credential injection does not establish that result. This still needs upstream triage and a build for the reporter to retest.
Hi @mill101, thanks for isolating the TLS behavior at Cloudflare-fronted endpoints. We’re planning an updated architecture for NemoClaw, so we’re closing this earlier endpoint connection follow-up as not planned.
If this is still an issue that needs prioritization, please re-open and tag @wscurran.