`createMcpHandler` is validation-free; bare fetch mounts can skip the Host/Origin guards the framework helpers install |
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- nodejs, typescript
- Lĩnh vực
- backend-api-design, security
Hướng nghiên cứu
The issue is about adding Host/Origin validation to createMcpHandler in packages/server/src/server/createMcpHandler.ts. Start by reading the existing JSDoc and the docs/serving/http.md guide to understand the current validation-free behavior. Look at the hostHeaderValidationResponse and originValidationResponse utilities to see how validation is applied. The goal is to design an API option or wrapper that adds these guards, while keeping an escape hatch for reverse-proxy deployments. Test by mounting the handler in a fetch-native runtime like Workers or Deno.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Static review of public source at commit 603217008710. No traffic was sent to any MCP environment.
createMcpHandler intentionally performs no Host/Origin (or token) checks — documented in the JSDoc and in docs/serving/http.md. Framework helpers (createMcpExpressApp / Hono / Fastify) arm those checks for loopback. The bare fetch entry does not:
packages/server/src/server/createMcpHandler.ts (doc comment on the export):
* When mounting bare on a fetch-native runtime,
* put Origin/Host validation in front of the handler — the entry itself is
* deliberately validation-free:
*
* const rejected =
* hostHeaderValidationResponse(request, localhostAllowedHostnames()) ??
* originValidationResponse(request, localhostAllowedOrigins());
* return rejected ?? handler.fetch(request);
On Workers / Deno / Bun, export default handler (as shown earlier in the same guide for “Mount it on your runtime”) is a one-liner that never installs those guards unless the reader continues to the later section. That is a footgun relative to the Express path, where loopback protection is automatic.
Suggested change:
- Offer
createMcpHandler(factory, { allowedHosts, allowedOrigins })(or awithLocalhostProtection(handler)wrapper) that applieshostHeaderValidationResponse/originValidationResponsebeforefetch. - Or make the quickstart
export defaultexample always show the validation wrapper first. - Keep a documented escape hatch for authenticated reverse-proxy deployments.
Severity: low–medium / API footgun and defense-in-depth (complements finding #1 on non-loopback Express/Hono binds). No proof-of-concept.
Happy to send a focused PR if useful.
- Ngôn ngữ chính
- TypeScript
- Star
- 13.6k
- Fork
- 2.3k
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 51
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/typescript-sdk
-
Stateless 405 response omits the Allow headerCó thể đã có người làm @Hugo-DDT đã nhận 1 ngày trước. Đang mởv2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
modelcontextprotocol/typescript-sdk#2970 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[v2] @modelcontextprotocol/server inlines fast-uri 3.1.0, which has 9 published advisoriesCó thể đã có người làm @Andiii208 đã nhận 3 ngày trước. Đang mởv2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/typescript-sdk#2966 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
v1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/typescript-sdk#2946 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[v2] URI template reserved expansions encode existing %HH sequences againCó thể đã có người làm @takagibit18 đã nhận 10 ngày trước. Đang mởv1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
modelcontextprotocol/typescript-sdk#2920 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[v2] URI template strict expansions leave !'()* unencodedCó thể đã có người làm @takagibit18 đã nhận 10 ngày trước. Đang mởv1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
modelcontextprotocol/typescript-sdk#2919 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/typescript-sdk
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoft/playwright#43327 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/TypeScript#64758 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
opensearch-project/OpenSearch-Dashboards#12937 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Liveness marks block-included attesters live in the block's epoch instead of the attestation's epochĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
status: needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
a2ui-project/a2ui#3158 ·
Maintainer thường phản hồi trong vòng 2 ngày