Repository navigation
Commit 4fa5b6a
fix(provider-transport): exempt fake-IP DNS ranges from model transport SSRF guard
The model transport guarded fetch passes `{ allowPrivateNetwork: true }` to
`fetchWithSsrFGuard` only when the operator opts in via
`models.providers.<id>.request.allowPrivateNetwork`. That covers RFC1918
private networks, but not the RFC 2544 benchmark range (198.18.0.0/15) or
IPv6 ULA (fc00::/7) that fake-IP DNS proxies (sing-box / Clash / Surge)
hand back for foreign provider hostnames.
Result: every model API call (LiteLLM gateway, api.openai.com,
generativelanguage.googleapis.com, api.x.ai, api.anthropic.com, etc) on a
fake-IP setup fails with:
[security] blocked URL fetch (url-fetch) target=https://api.openai.com/...
reason=Blocked: resolves to private/internal/special-use IP address
…even though those hostnames are reachable just fine through the proxy.
The schema on `models.providers.<id>.request` doesn't currently accept
`allowRfc2544BenchmarkRange` / `allowIpv6UniqueLocalRange` either, so
users have no way to opt in via config.
Fix: thread a fake-IP-only narrow exemption
(`{ allowRfc2544BenchmarkRange: true, allowIpv6UniqueLocalRange: true }`)
into the model transport guard policy. Same pattern the public
`tools.web.fetch` policy uses (#74571) and the trusted/self-hosted
web-tools endpoint policy in `agents/tools/web-guarded-fetch.ts` (#76530).
The narrow exemption only un-blocks the two fake-IP-specific special-use
ranges — loopback, RFC1918 private networks, link-local (including
169.254.169.254 cloud metadata), and `metadata.google.internal` stay
blocked unless the operator separately opts in via
`allowPrivateNetwork`. This is a strict subset of the
`ssrfPolicyFromHttpBaseUrlAllowedHostname` allowlist path used by
adjacent plugins, addressing the codex review concern that an
`allowedHostnames` bypass would be broader than the reported fake-IP
failure.
Adds regression coverage in `provider-transport-fetch.test.ts` asserting
that:
* the policy threaded into `fetchWithSsrFGuard` only contains the
fake-IP flags (no `allowedHostnames`, no
`dangerouslyAllowPrivateNetwork`, no `allowPrivateNetwork`)
* `allowPrivateNetwork: true` from the resolved provider request
config still merges into the policy when the operator opts in
Refs #74351 (the original fake-IP IPv6 ULA report) and #74571 (the
`tools.web.fetch` companion fix). Together with #76530 (the trusted-web-
tools-endpoint companion), this closes the remaining major fake-IP
user-visible failure path.1 parent b6cbd92 commit 4fa5b6a
3 files changed
Lines changed: 61 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
79 | 122 | | |
80 | 123 | | |
81 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
13 | 26 | | |
14 | 27 | | |
15 | 28 | | |
| |||
303 | 316 | | |
304 | 317 | | |
305 | 318 | | |
306 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
307 | 323 | | |
308 | 324 | | |
309 | 325 | | |
| |||
0 commit comments