diff options
Diffstat (limited to 'internal/netutil')
-rw-r--r-- | internal/netutil/netutil.go | 2 | ||||
-rw-r--r-- | internal/netutil/netutil_test.go | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/internal/netutil/netutil.go b/internal/netutil/netutil.go index 8fef3115..2c457519 100644 --- a/internal/netutil/netutil.go +++ b/internal/netutil/netutil.go @@ -52,7 +52,7 @@ func init() { // allowlist). func IsBlockedLocalHostname(hostname string, allowlist []string) bool { for _, allow := range allowlist { - if hostname == allow { + if hostname == allow || allow == "*" { return false } } diff --git a/internal/netutil/netutil_test.go b/internal/netutil/netutil_test.go index 9bd9c982..08b4dc50 100644 --- a/internal/netutil/netutil_test.go +++ b/internal/netutil/netutil_test.go @@ -31,6 +31,8 @@ func TestIsLocalHostname(t *testing.T) { {hostname: "192.168.123.45", allowlist: []string{"10.0.0.17"}, want: true}, // #11 {hostname: "gogs.local", allowlist: []string{"gogs.local"}, want: false}, // #12 + + {hostname: "192.168.123.45", allowlist: []string{"*"}, want: false}, // #13 } for _, test := range tests { t.Run("", func(t *testing.T) { |