mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-11 07:46:37 +08:00
初始化
初始化项目
This commit is contained in:
@@ -7,28 +7,6 @@ import (
|
||||
"github.com/ShukeBta/MediaStationGo/internal/config"
|
||||
)
|
||||
|
||||
func TestValidateSTRMProxyURLBlocksPrivateTargets(t *testing.T) {
|
||||
blocked := []string{
|
||||
"http://127.0.0.1/video.mkv",
|
||||
"http://192.168.1.2/video.mkv",
|
||||
"http://169.254.169.254/latest/meta-data",
|
||||
"file:///etc/passwd",
|
||||
}
|
||||
for _, raw := range blocked {
|
||||
if _, err := validateSTRMProxyURL(raw); err == nil {
|
||||
t.Fatalf("validateSTRMProxyURL(%q) allowed unsafe target", raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateSTRMProxyURLAllowsPublicHTTP(t *testing.T) {
|
||||
for _, raw := range []string{"https://example.com/video.mkv", "http://8.8.8.8/video.mkv"} {
|
||||
if _, err := validateSTRMProxyURL(raw); err != nil {
|
||||
t.Fatalf("validateSTRMProxyURL(%q) = %v, want nil", raw, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestBackupFilePathRejectsTraversal(t *testing.T) {
|
||||
svc := &BackupService{cfg: &config.Config{}}
|
||||
svc.cfg.App.DataDir = t.TempDir()
|
||||
|
||||
Reference in New Issue
Block a user