HIGH AI PREVALENCE: HIGH auth.py.mcp.tool-handler-ssrf
An argument of an MCP tool handler (@mcp.tool()) flows into an outbound HTTP request without validation, a server-side request forgery (SSRF, CWE-918).
Why AI tools produce this: AI coding tools generate this anti-pattern by default, it appears in a large share of AI-written auth code.
Why this matters
Tool arguments are attacker-influenced: an LLM (or a malicious caller) can point the URL at internal services, cloud metadata (169.254.169.254), or localhost. BlueRock found ~36.7% of MCP servers SSRF-prone.
Validate the target before fetching: resolve and allow-list the host, reject private/link-local ranges, and disable redirects. Never pass a raw tool argument straight into httpx/requests.
VULNERABLE
SAFE
Suppressing this rule
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.
# oauthlint-disable-next-line auth.py.mcp.tool-handler-ssrf -- <reason>