fix(security): support IPv6 in SSRF validation via whitelist mechanism
- Keep strict mode blocking all direct IPs (IPv4 and IPv6 uniformly) - Unify all SSRF call sites to use ValidateURLForSSRF (whitelist-aware) - Add Teredo (2001:0000::/32) and 6to4 (2002::/16) tunnel detection - Make redirect handler and DNS pinning respect SSRF_WHITELIST - Unexport isSSRFSafeURL to prevent future callers bypassing whitelist - Add scheme validation for whitelisted redirect targets - Document IPv6 whitelist syntax in .env.example - Add comprehensive IPv6 test coverage
This commit is contained in:
@@ -667,9 +667,9 @@ func (r *ImageResolver) ResolveRemoteImages(
|
||||
continue
|
||||
}
|
||||
|
||||
// --- SSRF check ---
|
||||
if safe, reason := secutils.IsSSRFSafeURL(imgURL); !safe {
|
||||
log.Printf("WARN: remote image blocked by SSRF check (%s): %s", reason, imgURL)
|
||||
// --- SSRF check (centralised entry-point with whitelist support) ---
|
||||
if err := secutils.ValidateURLForSSRF(imgURL); err != nil {
|
||||
log.Printf("WARN: remote image blocked by SSRF check (%v): %s", err, imgURL)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user