Skip to content

fix(blueprint): route unconfigured strict SSRF fetches through sandbox proxy (#4687) - #4932

Merged
cv merged 1 commit into
NVIDIA:mainfrom
yimoj:fix/4687-googlechat-cert-fetch-proxy
Jun 8, 2026
Merged

cv merged 1 commit into
NVIDIA:mainfrom
yimoj:fix/4687-googlechat-cert-fetch-proxy

Conversation

@yimoj

@yimoj yimoj commented Jun 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

@openclaw/googlechat rejects every inbound Google Chat webhook in a NemoClaw sandbox because JWT verification cannot fetch Google's signing certs. The plugin's fetchChatCerts() calls OpenClaw's fetchWithSsrFGuard with no explicit dispatcher policy, which builds a per-request DNS-pinned direct undici dispatcher that bypasses the global EnvHttpProxyAgent (NODE_USE_ENV_PROXY=1). In the proxy-only sandbox netns the direct connect never reaches the OpenShell L7 proxy and fails. This routes such fetches through the sandbox egress proxy while preserving SSRF protections.

Related Issue

Fixes #4687

Changes

  • Dockerfile (Patch 4): OpenClaw's fetch-guard already has a managed-proxy branch that routes strict fetches through the env proxy (createHttp1EnvHttpProxyAgent) while still running resolvePinnedHostnameWithPolicy, but it's gated on isManagedProxyActive() (OPENCLAW_PROXY_ACTIVE=1), which NemoClaw never sets. The patch extends the canUseManagedProxy gate so that inside an OpenShell sandbox (OPENSHELL_SANDBOX=1) the configured egress proxy is treated as the managed proxy — only for STRICT-mode fetches that supply no explicit dispatcherPolicy.
    • Explicit-proxy and direct (mTLS) dispatcher policies are untouched (Google auth proxy / client-cert paths keep their behavior).
    • Out-of-sandbox behavior is unchanged.
    • resolvePinnedHostnameWithPolicy still resolves and SSRF-validates the target, so private/link-local/metadata targets remain blocked.
    • The classifier fails the image build loudly on OpenClaw dist-shape drift, like Patches 1/2/2b.
  • test/fetch-guard-patch-regression.test.ts: anchors the reviewed canUseManagedProxy gate, and covers the applied / not-needed / fail-closed classifier paths plus the in-sandbox vs explicit-policy vs out-of-sandbox activation matrix.

Type of Change

  • Code change (feature, bug fix, or refactor)

Verification

Real Google Chat webhook E2E requires a Google Workspace service account + published Chat app + inbound webhook credentials, which are unavailable in this environment. Per the issue's documented fallback, the fix was reproduced through the exact OpenClaw SSRF dispatcher path the plugin's fetchChatCerts() uses, against the real pinned [email protected] dist:

  • Before: cert fetch selects a per-request direct Agent — bypasses the env proxy (bug reproduced).

  • After (real Dockerfile Patch 4 block applied to the dist): cert fetch selects EnvHttpProxyAgent — routes through the proxy.

  • Guards: explicit-proxy → ProxyAgent; direct/mTLS → Agent; outside sandbox → Agent; private/link-local target → still SSRF-blocked.

  • Tests added or updated for new or changed behavior

  • No secrets, API keys, or credentials committed

  • Targeted test/fetch-guard-patch-regression.test.ts passes (22 tests); other Dockerfile-parsing suites pass. Pre-existing service-env/nemoclaw-start failures are uid-ownership environment artifacts unrelated to this change (confirmed identical on the pristine tree).


Signed-off-by: Yimo Jiang [email protected]

Summary by CodeRabbit

  • New Features

    • Introduced Patch 4 to adjust strict-mode fetch routing in sandboxed environments so unconfigured strict fetches are routed via the proxy; build now detects and verifies this managed-proxy gate and includes updated patch lifecycle handling.
  • Tests

    • Added regression tests covering Patch 4 behavior and failure modes across sandboxed, non-sandboxed, strict/non-strict, and managed-proxy activation scenarios.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7af1f9b6-af7b-4481-963d-3254efd62d52

📥 Commits

Reviewing files that changed from the base of the PR and between db04400 and e8d7cff.

📒 Files selected for processing (2)
  • Dockerfile
  • test/fetch-guard-patch-regression.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • Dockerfile

📝 Walkthrough

Walkthrough

Adds Patch 4 to the Dockerfile OpenClaw dist patcher to route unconfigured STRICT-mode fetchWithSsrFGuard calls through the sandbox egress proxy when OPENSHELL_SANDBOX=1 and no dispatcherPolicy is provided, plus regression tests for activation, not-needed reporting, and drift fail-closed behavior.

Changes

Managed-proxy strict-fetch patch for sandbox egress routing

Layer / File(s) Summary
Patch 4 specification and lifecycle documentation
Dockerfile
Adds inline comments explaining Patch 4's purpose: routing unconfigured STRICT-mode fetchWithSsrFGuard requests through sandbox egress proxy when dispatcherPolicy is absent; documents removal criteria.
Patch 4 implementation and verification
Dockerfile
Implements Patch 4 in the dist patching script with managed-proxy gate shape detection, condition rewrite to activate under OPENSHELL_SANDBOX=1 when params.dispatcherPolicy is missing, verification logic, and fail-closed stderr messaging on drift.
Test shape constants and Dockerfile integration assertion
test/fetch-guard-patch-regression.test.ts
Adds reviewed OpenClaw 2026.5.27 managed-proxy gate shape fragment constant and a regression test that verifies the Dockerfile patch injects the routing clause.
Patch behavior and failure mode regression tests
test/fetch-guard-patch-regression.test.ts
Adds regression tests covering sandbox-only activation when no dispatcherPolicy is supplied, preservation of original behavior outside the sandbox, OPENCLAW_PROXY_ACTIVE=1 override, exclusion of non-strict modes, "Patch 4 not needed" reporting when the gate is absent, and fail-closed stderr when the gate drifts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes


Suggested labels

integration: openclaw, area: networking, area: sandbox, Docker, bug-fix, fix


Suggested reviewers

  • cv
  • prekshivyas

Poem

🐰 A tiny patch hops through the build,
strict fetches find a safer field,
sandbox winds guide the proxy's song,
tests hum steady, all night long—
a rabbit cheers: the routes belong.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly summarizes the main change: routing unconfigured strict SSRF fetches through a sandbox proxy to fix the fetch-guard behavior.
Linked Issues check ✅ Passed The changes implement fix shape (a) from issue #4687: detect and route through the host's globalDispatcher for unconfigured strict fetches in sandbox environments while preserving SSRF validation and explicit policies.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the managed-proxy gate patch for sandbox SSRF routing; no unrelated modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

…x proxy

OpenClaw's fetchWithSsrFGuard builds a per-request DNS-pinned direct undici
dispatcher for STRICT-mode fetches that pass no explicit dispatcherPolicy, e.g.
@openclaw/googlechat's inbound JWT signing-cert fetch from
www.googleapis.com/service_accounts/v1/metadata/x509/.... That direct
dispatcher ignores the global EnvHttpProxyAgent installed by
NODE_USE_ENV_PROXY=1, so the request never reaches the OpenShell L7 proxy and
fails in the proxy-only sandbox netns, rejecting every inbound Google Chat
webhook.

OpenClaw already has a managed-proxy branch that routes such fetches through
the env proxy (createHttp1EnvHttpProxyAgent) while still resolving and
SSRF-validating the target hostname, but it is gated on isManagedProxyActive()
(OPENCLAW_PROXY_ACTIVE=1), which NemoClaw does not set. Inside an OpenShell
sandbox the configured egress proxy IS the managed proxy, so Dockerfile Patch 4
extends that activation to OPENSHELL_SANDBOX=1 for fetches that supply no
explicit dispatcherPolicy. Explicit-proxy and direct(mTLS) dispatcher policies
and out-of-sandbox behavior are unchanged, and resolvePinnedHostnameWithPolicy
still blocks private/link-local targets.

The classifier fails loudly on dist-shape drift like Patches 1/2/2b; the
fetch-guard regression test anchors the reviewed gate and covers the applied,
not-needed, and fail-closed paths.

Signed-off-by: Yimo Jiang <[email protected]>
@yimoj
yimoj force-pushed the fix/4687-googlechat-cert-fetch-proxy branch from db04400 to e8d7cff Compare June 8, 2026 03:20
@cv cv added the v0.0.61 label Jun 8, 2026
@wscurran wscurran added area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression integration: openclaw OpenClaw integration behavior labels Jun 8, 2026
@wscurran

wscurran commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@cv
cv merged commit 44b9b0b into NVIDIA:main Jun 8, 2026
27 checks passed
cjagwani pushed a commit that referenced this pull request Nov 18, 2026
## Outcome

Classic Hermes routing verification now requires a fresh host preflight
before it can send a capable-provider request. Missing, inconsistent, or
changed routing inputs reject verification. Ordinary gateway health
remains separate from routing readiness and request results.

## Reason

Provider attachment checks alone cannot establish that the installed
router package, complete deployment, credentials, policy, and running
gateway still match the selected routing configuration.

### Related issues

Fixes #13864.

Security qualification in #13865 and adaptive-flow qualification in
#13866 remain separate.

## Changes

- Add request-free validation through the pinned Hermes, Relay, and
Switchyard contracts, including native activation cleanup. The existing
judge qualifier runs this validation before its separate model request.
- Gate onboarding, connect readiness, and status with fresh provider,
role, policy, credential-reference, configuration, and gateway PID/start
observations. Recheck after verification and reject changed evidence.
Status and onboarding send at most one capable-provider request.
- Publish the three protected routing files together only after
validation and while the gateway is stopped. A filesystem lock excludes
concurrent supervised startup. Existing partial or mixed files fail
without automatic repair.
- Preserve an expected configuration fingerprint in the gateway
environment. It identifies startup inputs; it does not attest that the
gateway activated routing.
- Refresh the generated startup runtimes and use the production
publisher in the existing routed-image fixture. Preserve existing E2E
assertions, call counts, deadlines, and cleanup.

The native helper is needed to use the installed loader and protected
process state. A host parser cannot establish that contract. The
publication lock covers concurrent startup, which per-file atomic writes
cannot exclude. `hermes-switchyard-preflight.test.ts` covers
publication, exclusion, malformed inputs, credential references, and
cleanup. `onboard/switchyard/preflight.test.ts` covers request
suppression, stale evidence, and consumer wiring.

The shared managed-startup bundle is also copied by
`agents/pi/Dockerfile:15`. Regenerating it changes a Pi image input, so
`scripts/checks/pi-qualification-receipt-refresh.mts` requires both
architecture receipts and their exact authority hashes to refresh. This
is a validation prerequisite of the shared bundle change. The new
deployment-verification branches select on `context.switchyardEntry`,
including malformed requested routing that must remain gated.

## Verification

- Focused CLI and Python publication tests: passing, including 167 tests
in the final publication/readiness selection and 66 tests in the final
consumer/bound-capture selection.
- Existing inference invocation and route-health regression suites: 188
passed.
- Managed image artifact contract suite: 23 passed in a credential-free
local sandbox. Its initial temporary-directory denial was corrected in
the sandbox configuration.
- Actual pinned native libraries on macOS arm64: 11 valid and invalid
deployment cases passed, with zero model requests and successful
activation cleanup. This does not qualify Linux images.
- CLI TypeScript compilation, Python compilation, shell syntax,
generated artifacts, and installed commit hooks: passed.
- Installed publication validation and all three compiler hooks passed
in a credential-free sandbox. Git transport authentication remained
outside that boundary.
- Cycle 1 Linux image workflow 44179672919 passed Hermes qualification,
all-agent activation on AMD64/ARM64, and rootless Podman activation.
Both authenticated Pi receipts were refreshed from that run; strict
source parity passes. [Cycle 2 managed-image
qualification](https://github.com/NVIDIA/NemoClaw/actions/runs/44190258380/attempts/2)
also passed for the latest commit, including both architectures and
rootless Podman. Docker is unavailable locally.
- Cycle 2 focused validation:210 unique tests passed across seven files.
The affected26-test publication suite passed after correcting the local
sandbox's ancestor-directory traversal policy; credential and session
paths remain denied.
- Local macOS startup/config-integrity fixtures had 27 special-mode
failures before the changed qualifier. All 25 extracted helper functions
match canonical main byte-for-byte. No assertions or permissions were
weakened.
- The diff contains no secrets, API keys, or credentials. No inference
credential was used for local validation.
-
[CI](https://github.com/NVIDIA/NemoClaw/actions/runs/44190258324/attempts/2),
[portable
qualification](https://github.com/NVIDIA/NemoClaw/actions/runs/44190258234),
and [Staging Brev
Launchable](https://github.com/NVIDIA/NemoClaw/actions/runs/44376814689)
passed for this commit. The [manual E2E
suite](https://github.com/NVIDIA/NemoClaw/actions/runs/44382987374/attempts/2)
remains failed on the OpenShell CA restart error; other selected test
jobs passed. See the scoped maintainer exception below. This is not a
passing full-suite result.

## Review notes

Self-review covered NVIDIA/NemoClaw commit
`9fd3072f0b6555a1432bcfc47c2837bfb3ad5141` against
`495896a404d77fb4673fc41dbf18d5e0fec91b2a`, including the sensitive
changes under `agents/hermes/`, `src/lib/onboard/`, and
`tools/mcp-tool-discovery-runtime/`. Source inspection and behavioral
tests covered publication races, partial state, credential handling,
cleanup, and stale verification. Cycle 1 CodeRabbit review and all nine
Advisor specialists completed. The security specialist reported no
introduced security finding; the accepted startup-exclusion and consumer
findings are repaired in this revision. CodeRabbit passed for the latest
commit. All nine latest-head Advisor specialists completed; the request
for automatic partial-publication recovery was rejected because it
changes the accepted fail-closed contract. Independent human code review
remains pending. Public docs under `docs/**` are deferred to the
repository-authorized post-merge catch-up; owning runtime and E2E
guidance is included here.

[Maintainer qualification
exception](#14560 (comment)),
posted by @rsliter with repository admin permission, applies only to
commit `9fd3072f0b6555a1432bcfc47c2837bfb3ad5141` and the OpenShell
corporate-CA stop/start failure. The failed `onboard-repair` /
`onboard-resume` runs and aggregates remain visible. OpenShell owns the
lifecycle repair, tracked in [OpenShell
#4932](ai-openshell/openshell#4932), with [draft
repair #5265](ai-openshell/openshell#5265). The
retained evidence fits that defect but does not conclusively identify
the writer in these runs. No timeout workaround, error suppression,
extra retry, or dependency change is included. Other validation and
independent review requirements remain in effect.

Cycle 2 of at most three published revision cycles. The author will
collect CI and automated-review results, then pause before another
revision. Suggestions unrelated to regression risk are rejected or
deferred. No merge is requested in this cycle.

---
Signed-off-by: Rebecca Sliter <[email protected]>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added preflight verification for Hermes Switchyard routing during
setup, launch readiness, status checks, and inference verification.
* Routing changes are published together, with startup blocked if
validation fails or another gateway is active.
* Added documentation explaining routing validation and how preflight
results affect verification.
* **Bug Fixes**
* Verification now rejects results when routing evidence is missing,
unavailable, or changes during a check, without modifying provider
settings.
* Transient inference failures are identified separately from other
failures.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Rebecca Sliter <[email protected]>
Co-authored-by: Rebecca Sliter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression integration: openclaw OpenClaw integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@openclaw/googlechat cert fetch fails: SSRF guard's per-request dispatcher bypasses NemoClaw's nemoclaw-http-proxy-fix.js global-agent hook

3 participants