open-webui/backend/open_webui/retrieval
Classic298 854440f703
fix: mitigate DNS rebinding in web loader fetch paths (#24759)
validate_url() resolves DNS to check IPs but discards the result; the
HTTP client resolves again independently.  Between those two lookups an
attacker can swap the DNS record from a public IP to an internal one
(DNS rebinding).

Push the IP-is-global check into the actual connection layer so the
validated resolution is the one used for the TCP connect:

- aiohttp (_fetch): _SSRFSafeResolver wraps DefaultResolver and rejects
  non-global IPs at resolve time (zero TOCTOU window).
- requests (_scrape): _SSRFSafeAdapter mounts custom urllib3 connection
  classes whose _new_conn resolves, validates, and connects to the
  validated IP in one shot (zero TOCTOU window).

Both paths respect ENABLE_RAG_LOCAL_WEB_FETCH (skip validation when on).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-19 23:57:12 +04:00
..
loaders fix: log expected fetch/transcript/tool-server failures as warnings (#24903) 2026-05-19 21:55:40 +04:00
models refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00
vector refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00
web fix: mitigate DNS rebinding in web loader fetch paths (#24759) 2026-05-19 23:57:12 +04:00
utils.py refac 2026-05-19 20:55:04 +04:00