mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-24 12:42:38 +00:00
89aa9e1f10
The SSRF gate resolved the client_id host, checked the answer and then handed the hostname to fetch(), which resolved it again at connect time. A DNS-rebinding host could pass the check with a public answer and be connected to an internal one. The metadata fetch now runs through a dedicated undici dispatcher whose connect.lookup is the gate: one resolution per connection, every address must be public, the socket connects only to those addresses. The global fetch is untouched. The address classifier now refuses every IANA special-purpose block (IPv4), allows only global unicast 2000::/3 minus its special-purpose blocks (IPv6), and refuses zone ids and IPv4-mapped addresses. The tests enumerate the unedited IANA registries (tests/fixtures/ iana-special-purpose-addresses) and prove on loopback sockets that a refused host opens no socket and that an allowed one is connected to exactly the address the gate returned. Adds undici ^8.11.2 (engines >=22.19.0). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>