fetch: --allowed-hosts accepts wildcard IP entries (e.g. *.0.0.1) and matches any IPv4 ending with that suffix
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 src/fetch/src/mcp_server_fetch/allowlist.py 开始,阅读 issue 指出的受影响入口 normalize_allowed_host 和 host_is_allowed。检查现有的允许主机规范化和匹配测试,然后补充对带通配符的 IP 字面量、数字后缀和 IP 地址主机的测试覆盖。完成标准是这些输入会被拒绝,或永远不会匹配 IP 字面量,同时主机名子域通配符仍能正常工作。
由索引模型根据 Issue 内容生成。
描述
Problem
mcp-server-fetch's --allowed-hosts allowlist (src/fetch/src/mcp_server_fetch/allowlist.py) documents two valid entry forms:
Two entry forms only, to keep the semantics obvious: an exact host (a name or an IP literal), and
*.example.com, which matches any subdomain at any depth of example.com...
However, normalize_allowed_host only checks ipaddress.ip_address(...) when not wildcard (line 37). When a wildcard prefix *. is given before an IP literal or numeric IP suffix (such as *.10.0.0.1 or *.0.0.1), httpx.URL(f"http://{name}/") parses name without error and returns *.10.0.0.1 / *.0.0.1.
Then in host_is_allowed(host, allowed_hosts), host.endswith(entry[1:]) matches any IPv4 literal ending with .0.0.1 (for example, *.0.0.1 matches both 10.0.0.1 and 127.0.0.1).
from mcp_server_fetch.allowlist import host_is_allowed, normalize_allowed_hosts
entries = normalize_allowed_hosts(["*.0.0.1"]) # returns ('*.0.0.1',)
assert host_is_allowed("127.0.0.1", entries) is True
assert host_is_allowed("10.0.0.1", entries) is True
Expected
normalize_allowed_hostrejects wildcard IP literals and numeric-TLD wildcard suffixes (*.10.0.0.1,*.0.0.1,*.[::1]) withValueError.host_is_alloweddoes not match*.subdomain wildcards against IP address literals.
- 主要语言
- TypeScript
- 星标
- 91.9k
- 派生
- 11.9k
- 平均合并
- 3 小时 10 分钟
- 30 天内合并 PR
- 178
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/servers 的其他 Issue
-
bug server-sequentialthinking v2
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/servers#5526 · 1 条评论 ·
维护者通常 1 天内回复
-
fix(docker): correct stale --db-path comments in fetch/git Dockerfiles and clarify git README可能已有人在做 @cliffhall 今天认领。 未关闭documentation server-fetch server-git v2
难度 1/5 1 小时以内 新手友好度 88/100
modelcontextprotocol/servers#5483 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
chore v2
难度 3/5 1-2 天 新手友好度 35/100
modelcontextprotocol/servers#5527 ·
维护者通常 1 天内回复
-
enhancement server-memory v2
难度 4/5 3-5 天 新手友好度 52/100
modelcontextprotocol/servers#5525 · 1 条评论 ·
维护者通常 1 天内回复
-
everything: README description of `get-env` masking omits the whole-segment rule — `APIKEY` / `MYKEY` are not masked可能已有人在做 @cliffhall 今天认领。 未关闭documentation server-everything v2
modelcontextprotocol/servers#5524 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/servers 的全部 Issue
相似的 Issue
-
maintenance
难度 2/5 1-3 小时 新手友好度 73/100
assistant-ui/assistant-ui#10499 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
app-server bug CLI
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
better-auth/better-auth#12458 · 1 个 reaction ·
维护者通常 1 天内回复
-
Codex使用可 コード
难度 2/5 1-3 小时 新手友好度 72/100
ryuki-moro/Nicomaru#218 ·
维护者通常 3 天内回复