Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
Signed-off-by: Lixia (Sylvia) Lei <[email protected]>
  • Loading branch information
Wwwsylvia committed Jan 9, 2025
1 parent bacc6ef commit 9fb9f9e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion content/file/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func tarDirectory(ctx context.Context, root, prefix string, w io.Writer, removeT
name = filepath.ToSlash(name)

// Generate header
// NOTE: We don't support hard links and treat it as regular files
var link string
mode := info.Mode()
if mode&os.ModeSymlink != 0 {
Expand Down Expand Up @@ -190,7 +191,8 @@ func extractTarDirectory(dir, prefix string, r io.Reader, buf []byte) error {
}
case tar.TypeSymlink:
var target string
if target, err = ensureLinkPath(dir, prefix, path, header.Linkname); err != nil {
target, err = ensureLinkPath(dir, prefix, path, header.Linkname)

Check failure

Code scanning / CodeQL

Arbitrary file write extracting an archive containing symbolic links High

Unresolved path from an archive header, which may point outside the archive root, is used in
symlink creation
.
if err != nil {
return err
}
if _, err := os.Lstat(path); err == nil {
Expand Down

0 comments on commit 9fb9f9e

Please sign in to comment.