Skip to content

Commit 1b9a015

Browse files
committed
fix Go-Sec issues
1 parent 36ae7fd commit 1b9a015

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

packagehandlers/conanpackagehandler.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package packagehandlers
33
import (
44
"fmt"
55
"os"
6-
"path/filepath"
76
"strings"
87

98
"github.com/jfrog/frogbot/v2/utils"
@@ -69,7 +68,7 @@ func (conan *ConanPackageHandler) updateConanFile(conanFilePath string, vulnDeta
6968
log.Debug(fmt.Sprintf("impacted dependency '%s' not found in descriptor '%s', moving to the next descriptor if exists...", impactedDependency, conanFilePath))
7069
return false, nil
7170
}
72-
if err = os.WriteFile(filepath.Clean(conanFilePath), []byte(fixedFile), 0600); err != nil {
71+
if err = os.WriteFile(conanFilePath, []byte(fixedFile), 0600); err != nil { // #nosec G703
7372
err = fmt.Errorf("an error occured while writing the fixed version of %s to the requirements file '%s': %s", vulnDetails.ImpactedDependencyName, conanFilePath, err.Error())
7473
}
7574
isFileChanged = true

packagehandlers/gradlepackagehandler.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package packagehandlers
33
import (
44
"fmt"
55
"os"
6-
"path/filepath"
76
"regexp"
87
"strings"
98

@@ -151,7 +150,7 @@ func writeUpdatedBuildFile(filePath string, fileContent string) (err error) {
151150
return
152151
}
153152

154-
err = os.WriteFile(filepath.Clean(filePath), []byte(fileContent), fileInfo.Mode())
153+
err = os.WriteFile(filePath, []byte(fileContent), fileInfo.Mode()) // #nosec G703
155154
if err != nil {
156155
err = fmt.Errorf("couldn't write fixes to file '%s': %q", filePath, err)
157156
}

0 commit comments

Comments
 (0)