From 1fecebc9063d200f5e64427485be4a4d12730667 Mon Sep 17 00:00:00 2001 From: dcRUSTy <40319304+dcRUSTy@users.noreply.github.com> Date: Sat, 15 Aug 2020 05:37:50 +0530 Subject: [PATCH] Fix Case of Arbitrary File Overwrite while scanning malicious repo (#225) --- report/report.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/report/report.go b/report/report.go index cb105a05..d2d61771 100644 --- a/report/report.go +++ b/report/report.go @@ -39,7 +39,9 @@ func GenerateReport(r *helpers.DetectionResults, directory string) (path string, return "", fmt.Errorf("error copying reports: %v", err) } } else { - path = filepath.Join(directory, "talisman_reports", "/data") + path = filepath.Join(directory, "talisman_reports") + _ = os.RemoveAll(path) + path = filepath.Join(path, "data") jsonFilePath = filepath.Join(path, jsonFileName) }