6import httpx
7
8▶from langchain_core._security._exceptions import SSRFBlockedError
9from langchain_core._security._policy import (
10 SSRFPolicy,
· · ·
65 try:
66 validate_url_sync(str(request.url), self._policy)
67▶ except SSRFBlockedError:
68 raise
69
· · ·
82 type=socket.SOCK_STREAM,
83 )
84▶ except socket.gaierror as exc:
85 raise SSRFBlockedError("DNS resolution failed") from exc
86
· · ·
85▶ raise SSRFBlockedError("DNS resolution failed") from exc
86
87 if not addrinfo:
· · ·
88▶ raise SSRFBlockedError("DNS resolution returned no results")
89
90 # 5. Validate ALL resolved IPs - any blocked means reject.
+ 3 more matches in this file