mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-08 14:13:22 +00:00
https://github.com/XTLS/Xray-core/pull/5992#issuecomment-4320551920 Usage: https://github.com/XTLS/Xray-core/pull/5992#issuecomment-4291168039
33 lines
604 B
Go
33 lines
604 B
Go
package filesystem_test
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
. "github.com/xtls/xray-core/common/platform/filesystem"
|
|
)
|
|
|
|
func TestStatAssetRejectsInvalidPath(t *testing.T) {
|
|
for _, file := range []string{
|
|
"",
|
|
".",
|
|
"..",
|
|
"../geoip.dat",
|
|
"nested/..",
|
|
"nested/../geoip.dat",
|
|
"nested//geoip.dat",
|
|
"/geoip.dat",
|
|
"/tmp/geoip.dat",
|
|
`C:\geoip.dat`,
|
|
`C:geoip.dat`,
|
|
`\\server\share\geoip.dat`,
|
|
`nested\geoip.dat`,
|
|
`nested\..\geoip.dat`,
|
|
filepath.Join(t.TempDir(), "geoip.dat"),
|
|
} {
|
|
if _, err := StatAsset(file); err == nil {
|
|
t.Fatalf("expected error for %q", file)
|
|
}
|
|
}
|
|
}
|