feat: publish v1.0.0-rc.36-custom.1
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
This commit is contained in:
commit
bb7968b612
2381 files changed
+551494
No files matched your search
@@ -0,0 +1,59 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestSSRFProtectionRejectsLiteralPrivateAndReservedIPs(t *testing.T) {
|
||||
protection := &SSRFProtection{
|
||||
AllowPrivateIp: false,
|
||||
DomainFilterMode: false,
|
||||
IpFilterMode: false,
|
||||
}
|
||||
|
||||
tests := []string{
|
||||
"127.0.0.1",
|
||||
"10.0.0.1",
|
||||
"169.254.169.254",
|
||||
"fc00::1",
|
||||
"::ffff:127.0.0.1",
|
||||
}
|
||||
for _, host := range tests {
|
||||
t.Run(host, func(t *testing.T) {
|
||||
require.Error(t, protection.ValidateNetworkTarget(host, 80))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSSRFProtectionAllowsPrivateIPWhenExplicitlyEnabled(t *testing.T) {
|
||||
protection := &SSRFProtection{
|
||||
AllowPrivateIp: true,
|
||||
DomainFilterMode: false,
|
||||
IpFilterMode: false,
|
||||
}
|
||||
|
||||
require.NoError(t, protection.ValidateNetworkTarget("10.0.0.1", 80))
|
||||
}
|
||||
|
||||
func TestSSRFProtectionRejectsResolvedPrivateIP(t *testing.T) {
|
||||
protection := &SSRFProtection{
|
||||
AllowPrivateIp: false,
|
||||
DomainFilterMode: false,
|
||||
IpFilterMode: false,
|
||||
ApplyIPFilterForDomain: true,
|
||||
}
|
||||
|
||||
require.NoError(t, protection.ValidateNetworkTarget("example.com", 80))
|
||||
require.Error(t, protection.ValidateResolvedIP("example.com", net.ParseIP("169.254.169.254")))
|
||||
}
|
||||
|
||||
func TestNewSSRFProtectionFromFetchSettingParsesPortRanges(t *testing.T) {
|
||||
protection, err := NewSSRFProtectionFromFetchSetting(false, false, false, nil, nil, []string{"80", "8000-8001"}, true)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.NoError(t, protection.ValidateNetworkTarget("example.com", 8001))
|
||||
require.Error(t, protection.ValidateNetworkTarget("example.com", 9000))
|
||||
}
|
||||
Reference in new issue
Block a user