mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 18:28:13 +00:00 
			
		
		
		
	Reject proxy requests to 0.0.0.0 as well
This commit is contained in:
		| @@ -97,7 +97,7 @@ func IsProxyableIP(ip string) error { | |||||||
| } | } | ||||||
|  |  | ||||||
| func isProxyableIP(ip net.IP) error { | func isProxyableIP(ip net.IP) error { | ||||||
| 	if ip.IsLoopback() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast() || ip.IsInterfaceLocalMulticast() { | 	if !ip.IsGlobalUnicast() { | ||||||
| 		return ErrAddressNotAllowed | 		return ErrAddressNotAllowed | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
|   | |||||||
| @@ -103,6 +103,7 @@ func TestIsProxyableIP(t *testing.T) { | |||||||
| 		ip   string | 		ip   string | ||||||
| 		want error | 		want error | ||||||
| 	}{ | 	}{ | ||||||
|  | 		{"0.0.0.0", ErrAddressNotAllowed}, | ||||||
| 		{"127.0.0.1", ErrAddressNotAllowed}, | 		{"127.0.0.1", ErrAddressNotAllowed}, | ||||||
| 		{"127.0.0.2", ErrAddressNotAllowed}, | 		{"127.0.0.2", ErrAddressNotAllowed}, | ||||||
| 		{"169.254.169.254", ErrAddressNotAllowed}, | 		{"169.254.169.254", ErrAddressNotAllowed}, | ||||||
| @@ -112,6 +113,7 @@ func TestIsProxyableIP(t *testing.T) { | |||||||
| 		{"192.168.0.1", nil}, | 		{"192.168.0.1", nil}, | ||||||
| 		{"172.16.0.1", nil}, | 		{"172.16.0.1", nil}, | ||||||
| 		{"8.8.8.8", nil}, | 		{"8.8.8.8", nil}, | ||||||
|  | 		{"::", ErrAddressNotAllowed}, | ||||||
| 		{"::1", ErrAddressNotAllowed}, | 		{"::1", ErrAddressNotAllowed}, | ||||||
| 		{"fe80::", ErrAddressNotAllowed}, | 		{"fe80::", ErrAddressNotAllowed}, | ||||||
| 		{"ff02::", ErrAddressNotAllowed}, | 		{"ff02::", ErrAddressNotAllowed}, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Angus Lees
					Angus Lees