feat: block private outbound MCP and model-provider URLs - #759
Open
bhaveshpatel640 wants to merge 12 commits into
Open
bhaveshpatel640 wants to merge 12 commits into
bhaveshpatel640 wants to merge 12 commits into
Conversation
bhaveshpatel640
marked this pull request as ready for review
September 16, 2026 07:44
bhaveshpatel640
requested review from
chiragjn,
debajyoti-truefoundry,
heerambavi1998,
sr07asthana and
thesujai
as code owners
September 16, 2026 07:44
🦋 Changeset detectedLatest commit: 7b20691 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
bhaveshpatel640
force-pushed
the
AGE-2246
branch
from
September 16, 2026 07:46
c643ed1 to
6c871fa
Compare
bhaveshpatel640
force-pushed
the
AGE-2246
branch
3 times, most recently
from
September 16, 2026 08:36
6c042e3 to
7399f93
Compare
bhaveshpatel640
force-pushed
the
AGE-2246
branch
from
September 16, 2026 08:36
7399f93 to
2342c30
Compare
bhaveshpatel640
force-pushed
the
AGE-2246
branch
from
September 16, 2026 09:26
90bb076 to
0ff35fd
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 05e4e43. Configure here.
bhaveshpatel640
force-pushed
the
AGE-2246
branch
from
September 16, 2026 10:24
05e4e43 to
75268a4
Compare
bhaveshpatel640
force-pushed
the
AGE-2246
branch
2 times, most recently
from
September 16, 2026 17:58
b535eff to
13f3565
Compare
bhaveshpatel640
force-pushed
the
AGE-2246
branch
from
September 16, 2026 18:00
13f3565 to
eecd758
Compare
bhaveshpatel640
force-pushed
the
AGE-2246
branch
from
September 17, 2026 05:59
c9991a0 to
a1895e0
Compare
bhaveshpatel640
commented
Sep 17, 2026
| // Node fetch (undici) defaults bodyTimeout to 300s of silence, then kills the stream with | ||
| // `Body Timeout Error` — we reconnect and the ~5m cycle repeats in logs. 30m matches the | ||
| // Gateway idle-body window; MCP request deadlines still come from requestTimeoutMs. | ||
| const MCP_BODY_TIMEOUT_MS = 30 * 60 * 1000; |
Contributor
Author
There was a problem hiding this comment.
moved to ssrfGuard.ts
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.

Summary
Block private, reserved, loopback, and in-cluster destinations for MCP
urland model-providerbase_urlon save and on fetch.Modeled on
tfy-llm-gatewaysafeFetch(connect-time DNS lookup + per-hop redirect checks, deny CIDRs, k8s hostname shapes). Not a full port: noENABLE_SSRF/ssrf: 'none', no forward-proxy path, noURL_VERIFY_CONFIG.Closes AGE-2246
Changes
.svc,.cluster,.internal, …) unless allowlistedOUTBOUND_URL_ALLOW_PRIVATE_HOSTS/OUTBOUND_URL_BLOCKED_HOSTS(Helm:configs.outboundUrl)Localhost and other private hosts need an allowlist entry (for example Ollama).
How was this tested?
Unit tests for the URL guard (including redirects), MCP connect/save, and model-provider save.
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,python/trueforge_sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
High Risk
Changes security-critical outbound HTTP for MCP, LLM providers, and OAuth; misconfigured allowlists could break legitimate internal gateways or, if disabled, re-open SSRF.
Overview
Adds an outbound URL guard (on by default via
ENABLE_SSRF) that blocks SSRF-style targets—private/reserved/loopback/link-local IPs, in-cluster-style hostnames (e.g..svc,.internal), and non-http(s) schemes—with optional allow and block host lists.ssrfFetchroutes MCP, model-provider, and MCP OAuth HTTP through a guarded undici agent: DNS is checked before connect, redirects are followed manually hop-by-hop so a public URL cannot redirect to metadata or RFC1918, and the prior MCP-specific long body timeout is preserved on the shared agent.Save-time validation returns HTTP 400 when MCP server
urlor model-providerbase_urlwould be blocked. Helm and.env.exampleexposeconfigs.outboundUrl/OUTBOUND_URL_*; tests cover the guard, API rejection, and updated mocks for undici.Reviewed by Cursor Bugbot for commit 7b20691. Bugbot is set up for automated code reviews on this repo. Configure here.