mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-24 06:24:18 +02:00
* Add FASTMCP_SSRF_TRUST_PROXY to allow SSRF fetches through a corporate proxy 🤖 Generated with Claude Code * Make SSRF fetch client trust_env explicit for proxy routing 🤖 Generated with Claude Code * Warn when SSRF proxy trust is enabled without a configured proxy 🤖 Generated with Claude Code * Warn when NO_PROXY would send an SSRF-trust-proxy fetch direct 🤖 Generated with Claude Code * Refuse SSRF-trust-proxy fetches when no proxy would route the target 🤖 Generated with Claude Code * Fix TestProxyMode mocks to patch httpx2.AsyncClient main's httpx -> httpx2 migration (#4503) landed after these tests were written; ssrf.py's fetch path already uses httpx2.AsyncClient, but TestProxyMode still patched the old httpx module, so the mock silently stopped intercepting and requests escaped to the real network. * Fix port-qualified NO_PROXY bypass in SSRF proxy-trust guard proxy_bypass(hostname) discarded the port, so a NO_PROXY entry like 127.0.0.1:8443 went undetected while httpx2 honored it and sent the request direct with the blocklist already disabled. Pass host:port instead, except for IPv6 literals, where httpx2 ignores port when matching NO_PROXY and neither bracketed nor unbracketed host:port reliably matches through proxy_bypass()'s own parser. * Replace NO_PROXY prediction with explicit proxy control in SSRF trust-proxy mode Predicting httpx2's proxy routing (via proxy_bypass(), then via httpx2's own get_environment_proxies()/URLPattern internals) kept diverging from its real NO_PROXY handling — three rounds, three different divergences, always in the unsafe direction. Read HTTPS_PROXY/ALL_PROXY directly and pass it to httpx2 explicitly with trust_env=False, so the request provably goes through that proxy instead of being predicted to. NO_PROXY is no longer evaluated in this mode: a NO_PROXY'd host is now routed through the proxy rather than refused, since that's strictly safer than the alternative (direct with the blocklist already off). --------- Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| auth | ||
| http | ||
| middleware | ||
| mount | ||
| providers | ||
| sampling | ||
| tasks | ||
| telemetry | ||
| transforms | ||
| versioning | ||
| __init__.py | ||
| test_app_state.py | ||
| test_auth_integration.py | ||
| test_auth_integration_errors.py | ||
| test_cache_hints.py | ||
| test_context.py | ||
| test_dependencies.py | ||
| test_dependencies_advanced.py | ||
| test_event_store.py | ||
| test_fastapi_testclient_compat.py | ||
| test_file_server.py | ||
| test_icons.py | ||
| test_input_validation.py | ||
| test_log_level.py | ||
| test_logging.py | ||
| test_pagination.py | ||
| test_protocol_eras.py | ||
| test_providers.py | ||
| test_server.py | ||
| test_server_docket.py | ||
| test_server_lifespan.py | ||
| test_server_safety.py | ||
| test_session_visibility.py | ||
| test_streamable_http_no_redirect.py | ||
| test_tool_annotations.py | ||
| test_tool_transformation.py | ||
| test_transport.py | ||