diff --git a/pkg/util/fs_util.go b/pkg/util/fs_util.go index 7cadce1a3..0e03fa5fc 100644 --- a/pkg/util/fs_util.go +++ b/pkg/util/fs_util.go @@ -26,7 +26,6 @@ import ( "net/http" "os" "path/filepath" - "regexp" "strings" "syscall" "time" @@ -696,7 +695,7 @@ func HasFilepathPrefix(path, prefix string, prefixMatchOnly bool) bool { } for index := range prefixArray { - m, err := regexp.MatchString(prefixArray[index], pathArray[index]) + m, err := filepath.Match(prefixArray[index], pathArray[index]) if err != nil { return false } diff --git a/pkg/util/fs_util_test.go b/pkg/util/fs_util_test.go index ac5568863..d3640553d 100644 --- a/pkg/util/fs_util_test.go +++ b/pkg/util/fs_util_test.go @@ -66,6 +66,7 @@ func Test_DetectFilesystemWhitelist(t *testing.T) { {"/sys", false}, {"/var/run", false}, {"/etc/mtab", false}, + {"/tmp/apt-key-gpghome", true}, } actualWhitelist := whitelist sort.Slice(actualWhitelist, func(i, j int) bool {