MCP 服务 2026-10-08 12:43 UTC
plane-mcp-server
由提交人 mguptahub 提交,主要更新类型为:安全加固与漏洞修复。提交说明:[INFRA-1077] fix(security): close DNS-rebinding TOCTOU and unchecked-redirect SSRF gap in attachment upload (#241)。修补了可能被利用的安全隐患,建议尽快升级。
Commit提交信息原文
[INFRA-1077] fix(security): close DNS-rebinding TOCTOU and unchecked-redirect SSRF gap in attachment upload (#241) * [INFRA-1077] fix(security): close DNS-rebinding TOCTOU and unchecked-redirect SSRF gap in attachment upload Honor HTTP_PROXY/HTTPS_PROXY/NO_PROXY for the attachment-upload-from-URL fetch again, restoring behavior the prior requests.get() based fetch had and the pinned-IP rewrite dropped. Proxy selection reuses requests' own NO_PROXY matching (requests.utils.select_proxy) rather than reimplementing it, and is re-evaluated on every redirect hop since it runs inside the per-hop fetch function the existing redirect loop already calls fresh each time. When a proxy applies to a request, that request gets none of the DNS-rebinding/private-IP preflight the direct path performs -- the proxy connects to and resolves the original hostname itself, independently and later, so a local check would reject legitimate split-horizon-DNS hosts reached only via NO_PROXY while adding no real protection. This is a deliberate, human-confirmed trade-off: the proxy (and its network policy) becomes the sole SSRF control for a proxied request. Documented with a loud comment at the branch point and in the README. That skip is scoped to hostnames, though: an IP-literal target (e.g. the cloud metadata address given directly, not via a resolvable name) needs no DNS lookup to classify, so it carries none of the split-horizon-DNS justification for skipping validation. The proxy branch now parses the host as an IP literal first and runs the existing private/reserved-address check on it directly before delegating; only an actual hostname still defers entirely to the proxy. The non-proxied path is untouched -- same DNS pinning, same validation, same connection pooling as before. It does switch from urlparse to urlsplit to rebuild the request target: urlparse splits a trailing ";params" path segment (matrix parameters, legacy ";jsessionid=" links) into a separate attribute that was never folded back in, silently dropping it from the outgoing request; urlsplit leaves it in `.path`. Also cap both response-reading paths (direct and proxied) at UPLOAD_SIZE_ LIMIT bytes via a shared _read_bounded helper: a response is rejected on its declared Content-Length alone when that already exceeds the limit (body never read), or otherwise read with a bounded response.read(max_ bytes + 1) and rejected if the actual length still exceeds it. Closes a pre-existing memory-exhaustion gap where the full body was buffered before _upload's own size check ever ran. fetch_validated_get takes max_bytes as an explicit parameter; _upload passes UPLOAD_SIZE_LIMIT explicitly rather than the function reaching for the module constant itself. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012wFs8WkyrTsmVMzdAzFAbu * bumped the patch version --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>