mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Reject proxy requests to 0.0.0.0 as well
This commit is contained in:
parent
2af53e9f64
commit
05cc0fb1df
@ -97,7 +97,7 @@ func IsProxyableIP(ip string) error {
|
||||
}
|
||||
|
||||
func isProxyableIP(ip net.IP) error {
|
||||
if ip.IsLoopback() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast() || ip.IsInterfaceLocalMulticast() {
|
||||
if !ip.IsGlobalUnicast() {
|
||||
return ErrAddressNotAllowed
|
||||
}
|
||||
return nil
|
||||
|
@ -103,6 +103,7 @@ func TestIsProxyableIP(t *testing.T) {
|
||||
ip string
|
||||
want error
|
||||
}{
|
||||
{"0.0.0.0", ErrAddressNotAllowed},
|
||||
{"127.0.0.1", ErrAddressNotAllowed},
|
||||
{"127.0.0.2", ErrAddressNotAllowed},
|
||||
{"169.254.169.254", ErrAddressNotAllowed},
|
||||
@ -112,6 +113,7 @@ func TestIsProxyableIP(t *testing.T) {
|
||||
{"192.168.0.1", nil},
|
||||
{"172.16.0.1", nil},
|
||||
{"8.8.8.8", nil},
|
||||
{"::", ErrAddressNotAllowed},
|
||||
{"::1", ErrAddressNotAllowed},
|
||||
{"fe80::", ErrAddressNotAllowed},
|
||||
{"ff02::", ErrAddressNotAllowed},
|
||||
|
Loading…
Reference in New Issue
Block a user