Repository navigation
fix(blueprint): route unconfigured strict SSRF fetches through sandbox proxy (#4687) - #4932
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Patch 4 to the Dockerfile OpenClaw dist patcher to route unconfigured STRICT-mode ChangesManaged-proxy strict-fetch patch for sandbox egress routing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…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]>
db04400 to
e8d7cff
Compare
## 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]>
Summary
@openclaw/googlechatrejects every inbound Google Chat webhook in a NemoClaw sandbox because JWT verification cannot fetch Google's signing certs. The plugin'sfetchChatCerts()calls OpenClaw'sfetchWithSsrFGuardwith no explicit dispatcher policy, which builds a per-request DNS-pinned direct undici dispatcher that bypasses the globalEnvHttpProxyAgent(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'sfetch-guardalready has a managed-proxy branch that routes strict fetches through the env proxy (createHttp1EnvHttpProxyAgent) while still runningresolvePinnedHostnameWithPolicy, but it's gated onisManagedProxyActive()(OPENCLAW_PROXY_ACTIVE=1), which NemoClaw never sets. The patch extends thecanUseManagedProxygate 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 explicitdispatcherPolicy.resolvePinnedHostnameWithPolicystill resolves and SSRF-validates the target, so private/link-local/metadata targets remain blocked.test/fetch-guard-patch-regression.test.ts: anchors the reviewedcanUseManagedProxygate, 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
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.tspasses (22 tests); other Dockerfile-parsing suites pass. Pre-existingservice-env/nemoclaw-startfailures 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
Tests