diff --git a/pkg/ssrf/ssrf.go b/pkg/ssrf/ssrf.go index 1ed96bd8f88c7005276e2d772161f3dbddf7c4a1..6a94d72e564c98698d8c43330f005b4ce253ec42 100644 --- a/pkg/ssrf/ssrf.go +++ b/pkg/ssrf/ssrf.go @@ -39,7 +39,14 @@ func NewSecureClient() *http.Client { ip := net.ParseIP(host) if ip == nil { - return nil, fmt.Errorf("unexpected non-IP address in dial: %s", host) + ips, err := net.LookupIP(host) //nolint + if err != nil { + return nil, fmt.Errorf("DNS resolution failed for host %s: %v", host, err) + } + if len(ips) == 0 { + return nil, fmt.Errorf("no IP addresses found for host: %s", host) + } + ip = ips[0] // Use the first resolved IP address } if isPrivateOrInternal(ip) { return nil, fmt.Errorf("%w", ErrPrivateIP)