8 months ago
636a553Add normalizeHost to strip trailing dots and surrounding brackets and use it in isBlockedHost so IP detection and private/internal checks work for bracketed IPv6 and trailing-dot hostnames. Update isBlockedHost to pass the normalized host to isIP and the IPv4/IPv6 private checks. Adjust tests to use case-insensitive regex matches for error messages, add coverage for IPv4-mapped IPv6 (public, loopback, and link-local/metadata) cases, and verify canonicalized hostnames for allowed mapped addresses.
Parenteba8954