From 54cc241c21342e05ffc26a2caaef8ed4b4045f8b Mon Sep 17 00:00:00 2001 From: sbwml Date: Thu, 28 Apr 2022 15:16:34 +0800 Subject: [PATCH] alist: deny unsafe operations * When the user cache is not set properly, Clear the cache directory operation will be very dangerous --- ...ert-feat-clear-temp-file-while-start.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 alist/patches/0001-Revert-feat-clear-temp-file-while-start.patch diff --git a/alist/patches/0001-Revert-feat-clear-temp-file-while-start.patch b/alist/patches/0001-Revert-feat-clear-temp-file-while-start.patch new file mode 100644 index 0000000..7aaf37d --- /dev/null +++ b/alist/patches/0001-Revert-feat-clear-temp-file-while-start.patch @@ -0,0 +1,38 @@ +From fdcb81f6ba8b8d7546a6742e9566487e12815499 Mon Sep 17 00:00:00 2001 +From: sbwml +Date: Thu, 28 Apr 2022 11:10:53 +0800 +Subject: [PATCH] Revert "feat: clear temp file while start" + +This reverts commit 24d031d57875d3c6a9624fa7334c6eac1c9111fb. +--- + bootstrap/conf.go | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/bootstrap/conf.go b/bootstrap/conf.go +index 5c9a1b3..f4d87d4 100644 +--- a/bootstrap/conf.go ++++ b/bootstrap/conf.go +@@ -7,7 +7,6 @@ import ( + log "github.com/sirupsen/logrus" + "io/ioutil" + "os" +- "path/filepath" + ) + + // InitConf init config +@@ -47,11 +46,7 @@ func InitConf() { + if !conf.Conf.Force { + confFromEnv() + } +- err := os.RemoveAll(filepath.Join(conf.Conf.TempDir)) +- if err != nil { +- log.Errorln("failed delete temp file:", err) +- } +- err = os.MkdirAll(conf.Conf.TempDir, 0700) ++ err := os.MkdirAll(conf.Conf.TempDir, 0700) + if err != nil { + log.Fatalf("create temp dir error: %s", err.Error()) + } +-- +2.34.1 +