Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Reject unsafe live photo ZIP paths

Manav Rathifd5b13b306dd
diff --git a/cli/pkg/download.go b/cli/pkg/download.go
index a33ff445a4..fdb2629d7e 100644
--- a/cli/pkg/download.go
+++ b/cli/pkg/download.go
@@ -54,6 +54,10 @@ func UnpackLive(src string) (imagePath, videoPath string, retErr error) {
dest := filepath.Dir(src)
for _, file := range reader.File {
+ if !filepath.IsLocal(file.Name) {
+ retErr = fmt.Errorf("invalid file path in live photo zip %s: %w", file.Name, zip.ErrInsecurePath)
+ return
+ }
destFilePath := filepath.Join(dest, file.Name)
filenames = append(filenames, destFilePath)
diff --git a/cli/pkg/remote_to_disk_file.go b/cli/pkg/remote_to_disk_file.go
index 9230d17a5f..6a0b010f32 100644
--- a/cli/pkg/remote_to_disk_file.go
+++ b/cli/pkg/remote_to_disk_file.go
@@ -84,7 +84,7 @@ func (c *ClICtrl) syncFiles(ctx context.Context, account model.Account) error {
if err != nil {
if errors.Is(err, model.ErrDecryption) {
continue
- } else if existingEntry.IsLivePhoto() && errors.Is(err, zip.ErrFormat) {
+ } else if existingEntry.IsLivePhoto() && (errors.Is(err, zip.ErrFormat) || errors.Is(err, zip.ErrInsecurePath)) {
log.Printf("err processing live photo %s (%d), %s", existingEntry.GetTitle(), existingEntry.ID, err.Error())
continue
} else if existingEntry.IsLivePhoto() && errors.Is(err, model.ErrLiveZip) {