mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 17:42:49 +02:00
use filepath.Match instead of regex
This commit is contained in:
+1
-2
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user