Repository navigation
Conversation
joshavant
marked this pull request as draft
June 9, 2026 15:10
joshavant
force-pushed
the
remove-internal-fetch-ssrf-guard
branch
from
June 9, 2026 19:03
6a47e0e to
b400f90
Compare
This was referenced Jun 14, 2026
This was referenced Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note from Dallin: this may be a good change, but likely should be split up. My agent went rogue and closed it but I think best to leave closed for now
Summary
This PR replaces OpenClaw's old in-process SSRF fetch guard architecture with a smaller HTTP egress model:
proxy.enabled=trueplus an operator-managed external proxy is the high-assurance SSRF and egress-control boundary.fetchWithSsrFGuard/ DNS pinning / per-call SSRF policy framework as a public plugin SDK or app-wide fetch API.What Changed
src/infra/net/egress-fetch.ts.fetchWithSsrFGuardAPI and retired old per-call SSRF policy/config knobs.openclaw/plugin-sdk/ssrf-runtimeopenclaw/plugin-sdk/ssrf-policyopenclaw/plugin-sdk/ssrf-dispatcherscripts/check-runtime-http-egress-boundary.mjs, which blocks raw app-owned runtime fetches, retired SSRF guard vocabulary, and broad new Plugin SDK network-policy facades.Behavior
When
proxy.enabled=false, OpenClaw's untrusted URL helper rejects local/private/internal targets for OpenClaw-owned arbitrary URL fetches by default, including localhost, loopback, link-local, RFC1918 private networks, known metadata hosts, DNS results resolving to blocked ranges, and redirect targets resolving to blocked ranges.This direct-mode check is a narrow stock safety guard. It is not a complete SSRF defense and is not a substitute for an external egress proxy in high-assurance deployments.
When
proxy.enabled=true, OpenClaw routes app-owned HTTP egress through the configured proxy and does not try to duplicate the proxy's comprehensive destination policy in application code.Operator-configured endpoints, fixed product/vendor endpoints, and transport-owned fetch behavior are treated separately from arbitrary untrusted web URLs.
Breaking Changes
fetchWithSsrFGuard/GUARDED_FETCH_MODEstyle APIs.fetchor supported generic fetch runtime mechanics where appropriate.proxy.enabled=trueplus the operator-managed external proxy.Out Of Scope
This PR does not claim full SSRF coverage for Browser/CDP, subprocesses, sandbox executors, Docker/SSH boundaries, MCP stdio children, native addons, or non-Node transport libraries. Those remain separate defense-in-depth follow-ups.
Verification
Focused local checks
node scripts/check-runtime-http-egress-boundary.mjsnode scripts/check-plugin-sdk-subpath-exports.mjsgit diff --checkpnpm docs:check-mdxpnpm buildpnpm tsgo:extensionsnode scripts/run-vitest.mjs test/scripts/check-runtime-http-egress-boundary.test.tsnode scripts/run-vitest.mjs src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts src/plugins/contracts/plugin-sdk-subpaths.test.tsnode scripts/run-vitest.mjs src/plugins/contracts/extension-package-project-boundaries.test.ts src/plugins/contracts/package-manifest.contract.test.ts test/extension-package-tsc-boundary.test.ts test/scripts/check-extension-package-tsc-boundary.test.ts.agents/skills/autoreview/scripts/autoreview --mode local: clean, no accepted/actionable findings.Package smoke
blacksmith-testbox,tbx_01ktnh39xjqvzaqyvnk4tek7bf27188175859External proxy E2E
blacksmith-testbox,tbx_01ktnh8w3mgdvg1rgvd8z4tmr827188302520proxy.enabled=trueroutes covered runtime fetches through the configured external proxy.AWS product-path proof
aws,cbx_5b6e8d6f5c94web_fetchMarketplace private-redirect proof
aws,cbx_9bd99a3d87b9run_b117a76160d3,run_714cc4109634,run_b47458f97c57,run_62972875e8be,run_636a90f349b7,run_0058dee2fdac0for the private redirect target in both modes.Real Behavior Proof
Behavior addressed: OpenClaw-owned arbitrary URL fetch paths no longer depend on the old scattered
fetchWithSsrFGuardarchitecture, while stock direct mode still blocks local/private/metadata-style targets for untrusted URL fetches.Real environment tested: Local focused tests, Blacksmith Testbox, and AWS Crabbox live network topology proof.
Exact steps or command run after this patch: Focused test lanes, runtime egress boundary check, package smoke, external proxy E2E, AWS product-path proof, targeted marketplace archive redirect proof, docs check, build, typecheck, and autoreview.
Evidence after fix: Direct-mode untrusted URL fetches block private redirect targets before honeypot access; proxy-mode fetches route through the external proof proxy and are blocked by proxy policy before honeypot access. Retired SSRF SDK/runtime surfaces are absent from package exports and broad network-policy facades are guarded against reintroduction.
Observed result after fix: All planned proof rows passed for this refactor's stated scope.
What was not tested: Browser/CDP, subprocess, sandbox executor, Docker, SSH, MCP stdio, native addon, and non-Node transport boundaries.