From ef102bb5ab4d8926c58d21b8003d051777d5fd7c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Sep 2024 02:40:44 +0000 Subject: [PATCH] solve gosec issue --- upgradetest.go | 2 +- version_helper.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/upgradetest.go b/upgradetest.go index 5c3a313..2574765 100644 --- a/upgradetest.go +++ b/upgradetest.go @@ -199,7 +199,7 @@ func rewriteHcl(moduleDir, newModuleSource string) error { if err != nil { return err } - err = os.WriteFile(filePath, []byte(tfCode), os.ModePerm) + err = os.WriteFile(filePath, []byte(tfCode), 0600) if err != nil { return err } diff --git a/version_helper.go b/version_helper.go index 22d68c3..c27e84a 100644 --- a/version_helper.go +++ b/version_helper.go @@ -109,7 +109,7 @@ func copyFile(src, dst string) error { } dstDir := filepath.Dir(cleanedDst) - if _, err := os.Stat(dstDir); os.IsNotExist(err) && os.MkdirAll(dstDir, os.ModePerm) != nil { + if _, err := os.Stat(dstDir); os.IsNotExist(err) && os.MkdirAll(dstDir, 0750) != nil { return fmt.Errorf("failed to create destination folder: %s", dstDir) } if _, err := os.Stat(cleanedDst); !os.IsNotExist(err) && os.Remove(cleanedDst) != nil {