web-fetch-http: add a config toggle to allow non-public DNS answers (fake-ip proxy compatibility) #5797
Replies: 4 comments
|
Setting http_proxy/https_proxy/all_proxy bypasses the check. |
|
楼上的绕过办法成立,但有一个例外 —— 两者都由源码和测试钉死。
(基于 0.1.5-rc.2 源码与测试核对。) |
|
补充一个已验证的窄网段方案,以及建议的配置入口。 我的环境是 在本地版本化的 provider override 中,仅对这个 建议的配置方法(新增字段提案,不是原版目前支持的配置)在 - id: web-fetch-http
config:
allowedNonPublicCidrs:
- 198.18.0.0/16Web UI 可复用现有「设置 → 插件 → 可配置插件」,加入一个简洁的「网页抓取网络」卡片,只提供网段添加、删除、校验和保存。设置层覆盖 profile base;删除全部网段并保存应显式保存 建议的行为约定:
这项提案针对 Fake-IP 透明代理下的直接解析路径;显式 HTTP 代理代为解析域名的现有语义是另一项边界,不应把本提案描述成对该路径重新增加了本地 DNS 校验。 本地设置卡已在测试实例完成浏览器验收:添加/删除、错误提示、规范化与去重、保存空列表、恢复原网段和刷新保留均通过。保存空列表后实际 本地测试覆盖:精确网段边界、默认空列表、移除后下一次 fetch 恢复拒绝、IPv6/mapped 地址、混合 DNS 结果、NAT64、配置校验/陈旧 revision、重定向快照、并发实例隔离,以及原有 URL/超时/大小限制。 源码核对:截至 c291e796 的 Config 仍只有抓取上限和 User-Agent 配置;地址策略位于 network.ts。相关提议还有 #4893。按仓库贡献指南在此补充实现思路和测试结果,不提交 PR。 |
|
Clash 代理配置里可以应用如下 fake ip 范围 dns:
...
fake-ip-range: 28.0.0.1/8
fake-ip-range6: 3ffe::/16
... |
Uh oh!
There was an error while loading. Please reload this page.
Summary
web_fetchfails withWEB_BLOCKED_URL("URL hostname ... resolves to a non-public IP address") whenever the local network resolves hostnames through a proxy client running in fake-ip DNS mode (e.g. Clash/sing-box TUN). Fake-ip answers return addresses from reserved benchmark ranges (198.18.0.0/15), whichisPublicIpAddress()in@deepseek-ai/dsh-web-fetch-httprejects. The check is hard-coded and there is currently no way to opt out.Reproduction
web_fetch https://github.com/....Result:
dns.lookup("github.com")under fake-ip returns e.g.198.18.0.11->ipaddr.range() !== "unicast"-> whole answer set rejected. The traffic itself works fine (the proxy client transparently forwards it), so this is a false positive of the SSRF guard, not an actual network failure.Why a config toggle is a reasonable ask
Proposal
Add an opt-in config field to
web-fetch-http(off by default, so the secure default is preserved), e.g.:allowNonPublicAddresses?: boolean- or, more surgically:allowedPrivateCidrs?: string[](e.g.["198.18.0.0/15"]) so proxy users can allow exactly the benchmark range while still blocking LAN/loopback/link-local.allowedPrivateCidrsis the better fit: it keeps the default fully locked down, gives fake-ip users a one-line fix, and still refuses loopback/link-private LAN by default. The check would apply inresolvePublicAddresses()(and the same-origin redirect re-validation) before the pin step.Happy to test a preview build on my setup.
All reactions