Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,11 @@ func unzip(src string, dest string) error {
// Build the path for each file in the destination directory
fpath := filepath.Join(dest, f.Name)

// Validate the file path to prevent directory traversal
if strings.Contains(f.Name, "..") {
return fmt.Errorf("invalid file path: %s", f.Name)
}

// Check if the file is a directory
if f.FileInfo().IsDir() {
// Create directory if it doesn't exist
Expand Down
Loading