Skip to content

Commit a4073d5

Browse files
committed
address issue raised by CodeQL by checking for invalid paths in tarball
1 parent 60d84a0 commit a4073d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/util/util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ func ExtractTGZ(tarballPath, destDir string, stripComponent bool) error {
355355
if err != nil {
356356
return err
357357
}
358+
// Check for invalid paths, there should never be a ".." in the path
359+
if strings.Contains(header.Name, "..") {
360+
return fmt.Errorf("tarball contains invalid path: %s", header.Name)
361+
}
358362

359363
target := filepath.Join(destDir, header.Name)
360364

0 commit comments

Comments
 (0)