Skip to content

Commit 6586ce5

Browse files
ForestEckhardtryanmoran
authored andcommitted
Removes functionality to symlink to something with and absolute path. This is a avoid zip slipping
1 parent 532340d commit 6586ce5

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

vacation/vacation.go

+2-14
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,8 @@ func (ta TarArchive) Decompress(destination string) error {
206206
})
207207

208208
for _, h := range symlinkHeaders {
209-
evalPath := linknameFullPath(h.path, h.linkname)
210-
// Don't use constucted link if the link is absolute
211-
if filepath.IsAbs(h.linkname) {
212-
evalPath = h.linkname
213-
}
214-
215209
// Check to see if the file that will be linked to is valid for symlinking
216-
_, err := filepath.EvalSymlinks(evalPath)
210+
_, err := filepath.EvalSymlinks(linknameFullPath(h.path, h.linkname))
217211
if err != nil {
218212
return fmt.Errorf("failed to evaluate symlink %s: %w", h.path, err)
219213
}
@@ -481,14 +475,8 @@ func (z ZipArchive) Decompress(destination string) error {
481475
})
482476

483477
for _, h := range symlinkHeaders {
484-
evalPath := linknameFullPath(h.path, h.linkname)
485-
// Don't use constucted link if the link is absolute
486-
if filepath.IsAbs(h.linkname) {
487-
evalPath = h.linkname
488-
}
489-
490478
// Check to see if the file that will be linked to is valid for symlinking
491-
_, err := filepath.EvalSymlinks(evalPath)
479+
_, err := filepath.EvalSymlinks(linknameFullPath(h.path, h.linkname))
492480
if err != nil {
493481
return fmt.Errorf("failed to evaluate symlink %s: %w", h.path, err)
494482
}

0 commit comments

Comments
 (0)