Skip to content

Commit

Permalink
Merge 4e2c93d into 1b478bb
Browse files Browse the repository at this point in the history
  • Loading branch information
olegbespalov committed Feb 9, 2024
2 parents 1b478bb + 4e2c93d commit 00f789b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/testutils/untar.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ func Untar(t *testing.T, fileSystem fsext.Fs, fileName string, destination strin
continue
}

// as long as this code in a test helper, we can safely
// omit G305: File traversal when extracting zip/tar archive
target := filepath.Join(destination, header.Name) //nolint:gosec
fileName := header.Name
if !filepath.IsLocal(fileName) {
return errors.New("tar file contains non-local file names")
}

target := filepath.Join(destination, filepath.Clean(fileName))

switch header.Typeflag {
case tar.TypeDir:
Expand Down

0 comments on commit 00f789b

Please sign in to comment.