fix(web): dial all validated IPs for dual-stack fallback (I1); fix live SSRF test to await fetch (M1)

This commit is contained in:
sausheong committed 2026-06-13 11:56:30 +08:00
1 parent fb5103fb87
commit d6db565d7c
3 files changed
+49 -8

No files matched your search

+11
View File
@@ -39,5 +39,16 @@ func TestSafeHTTPClient_RedirectToPrivateBlocked(t *testing.T) {
require.Error(t, err)
}
func TestSafeHTTPClient_PublicUnreachableReturnsDialError(t *testing.T) {
// 192.0.2.1 is RFC5737 TEST-NET-1 (public, unrouteable). It is NOT in the
// private blocklist, so validation passes and we should get a DIAL error
// (timeout/unreachable), not a "blocked" validation error — proving the
// path dials rather than rejecting.
client := SafeHTTPClient(2 * time.Second)
_, err := client.Get("http://192.0.2.1/")
require.Error(t, err)
require.NotContains(t, err.Error(), "internal address")
}
var _ = isPrivateIP(net.IPv4(127, 0, 0, 1))
var _ = strings.TrimSpace