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> |
||
|---|---|---|
| .. | ||
| oauth_proxy | ||
| providers | ||
| __init__.py | ||
| test_auth_provider.py | ||
| test_authorization.py | ||
| test_cimd.py | ||
| test_cimd_validators.py | ||
| test_debug_verifier.py | ||
| test_enhanced_error_responses.py | ||
| test_jwt_issuer.py | ||
| test_jwt_provider.py | ||
| test_jwt_provider_bearer.py | ||
| test_multi_auth.py | ||
| test_oauth_consent_flow.py | ||
| test_oauth_consent_page.py | ||
| test_oauth_mounting.py | ||
| test_oauth_proxy_redirect_validation.py | ||
| test_oauth_proxy_storage.py | ||
| test_oidc_proxy.py | ||
| test_oidc_proxy_token.py | ||
| test_redirect_validation.py | ||
| test_remote_auth_provider.py | ||
| test_ssrf_protection.py | ||
| test_static_token_verifier.py | ||