mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-19 19:41:16 +02:00
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
|
// regular file: check for file path being whitelisted
|
||||||
if !d.IsDir() {
|
if !d.IsDir() {
|
||||||
dirPath := filepath.Dir(itemPath)
|
|
||||||
|
|
||||||
allowed := false
|
allowed := false
|
||||||
|
|
||||||
for _, allowedPath := range extensions.AllowedPaths {
|
for _, allowedPath := range extensions.AllowedPaths {
|
||||||
if strings.HasPrefix(dirPath, allowedPath) {
|
if strings.HasPrefix(itemPath, allowedPath) {
|
||||||
_, err = filepath.Rel(allowedPath, dirPath)
|
_, err = filepath.Rel(allowedPath, itemPath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
allowed = true
|
allowed = true
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user