fix: allow files in extension spec
Support allowing explicit files in extensions. Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
parent
1a8f6ec8e1
commit
f95b537262
0
internal/pkg/extensions/testdata/good/extension1/rootfs/lib64/ld-linux-x86-64.so.2
vendored
Normal file
0
internal/pkg/extensions/testdata/good/extension1/rootfs/lib64/ld-linux-x86-64.so.2
vendored
Normal file
@ -76,13 +76,11 @@ func (ext *Extension) validateContents() error {
|
||||
|
||||
// regular file: check for file path being whitelisted
|
||||
if !d.IsDir() {
|
||||
dirPath := filepath.Dir(itemPath)
|
||||
|
||||
allowed := false
|
||||
|
||||
for _, allowedPath := range extensions.AllowedPaths {
|
||||
if strings.HasPrefix(dirPath, allowedPath) {
|
||||
_, err = filepath.Rel(allowedPath, dirPath)
|
||||
if strings.HasPrefix(itemPath, allowedPath) {
|
||||
_, err = filepath.Rel(allowedPath, itemPath)
|
||||
if err == nil {
|
||||
allowed = true
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user