by chunk_waffle · 3y ago · 0 comments
a: The FQDN does not resolve to an RFC1918 address (You don't want to be POSTing payloads to endpoints within your internal network.)
b: If you respond to redirect responses (easier to just not do so for other reasons as well) also make sure those don't resolve to internal addresses too!
I mean, there's a lot of things you should do when dealing with this that most people don't pay attention to:
https://datatracker.ietf.org/doc/html/rfc2606 https://datatracker.ietf.org/doc/html/rfc3927 https://datatracker.ietf.org/doc/html/rfc4193 https://datatracker.ietf.org/doc/html/rfc6761
... and so on. At least in Go some of the handy checks are simplified by IP.Is(Private|Loopback|Multicast|InterfaceLocalMulticast()|LinkLocal*etc.)
You would:
1. Resolve the FQDN
2. check the IP
3. Make the request
When the request is actually made, the FQDN is resolved again and a different IP is returned?