Skip to content

Commit

Permalink
feat: allow hardlinks in the system extension images
Browse files Browse the repository at this point in the history
They should cause no harm as every extension as an image on its own, so
hardlinks are only available between the files in one image only.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Mar 21, 2022
1 parent 1e98280 commit 58cb9db
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions internal/pkg/extensions/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"os"
"path/filepath"
"strings"
"syscall"

hashiversion "github.com/hashicorp/go-version"

Expand Down Expand Up @@ -70,18 +69,6 @@ func (ext *Extension) validateContents() error {
return fmt.Errorf("world-writeable files are not allowed: %q", itemPath)
}

var st fs.FileInfo

st, err = d.Info()
if err != nil {
return err
}

// no hardlinks
if !d.IsDir() && st.Sys().(*syscall.Stat_t).Nlink > 1 {
return fmt.Errorf("hardlinks are not allowed: %q", itemPath)
}

// no special files
if !d.IsDir() && !d.Type().IsRegular() && d.Type().Type() != os.ModeSymlink {
return fmt.Errorf("special files are not allowed: %q", itemPath)
Expand Down

0 comments on commit 58cb9db

Please sign in to comment.