Skip to content

Commit

Permalink
Merge pull request #110364 from danbudris/automated-cherry-pick-of-#1…
Browse files Browse the repository at this point in the history
…07402-upstream-release-1.21

Automated cherry pick of #107402: Reject proxy requests to 0.0.0.0 as well
  • Loading branch information
k8s-ci-robot committed Jun 7, 2022
2 parents a24eb09 + 1419c08 commit 80390b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/proxy/util/utils.go
Expand Up @@ -96,7 +96,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
Expand Down
2 changes: 2 additions & 0 deletions pkg/proxy/util/utils_test.go
Expand Up @@ -104,6 +104,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},
Expand All @@ -113,6 +114,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},
Expand Down

0 comments on commit 80390b8

Please sign in to comment.