Skip to content

Commit

Permalink
remove G304 exclusions (#51)
Browse files Browse the repository at this point in the history
* remove G304 exclusion
  • Loading branch information
randeepdell authored Feb 8, 2022
1 parent 11c0953 commit b793203
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ jobs:
- name: Run Go Security
uses: securego/gosec@master
with:
# added additional exclude arguments after gosec v2.9.4 came out
args: -exclude=G304 ./...
args: ./...
malware_security_scan:
name: Malware Scanner
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions core/semver/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func main() {
format = "ver"
} else {
if fileExists(filepath.Clean(format)) {
buf, err := ioutil.ReadFile(format)
buf, err := ioutil.ReadFile(filepath.Clean(format))
if err != nil {
fmt.Fprintf(os.Stderr, "error: read tpl failed: %v\n", err)
os.Exit(1)
Expand All @@ -87,7 +87,7 @@ func main() {

var w io.Writer = os.Stdout
if len(output) > 0 {
fout, err := os.Create(output)
fout, err := os.Create(filepath.Clean(output))
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
Expand Down
5 changes: 3 additions & 2 deletions service/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -201,7 +202,7 @@ func (s *service) NodeUnpublishVolume(

if _, err := os.Stat(lockFile); err == nil {
isEphemeralVolume = true
data, err = ioutil.ReadFile(lockFile)
data, err = ioutil.ReadFile(filepath.Clean(lockFile))
if err != nil {
return nil, errors.New("unable to get volume id for ephemeral volume")
}
Expand Down Expand Up @@ -621,7 +622,7 @@ func (s *service) ephemeralNodePublish(ctx context.Context, req *csi.NodePublish
}
log.Infof("Created dir in target path %s", filePath)

f, err := os.Create(filePath + "/id")
f, err := os.Create(filepath.Clean(filePath) + "/id")
if err != nil {
log.Error("Create id file in target path for ephemeral vol failed with error :" + err.Error())
if rollbackError := s.ephemeralNodeUnpublish(ctx, nodeUnpublishRequest); rollbackError != nil {
Expand Down
2 changes: 1 addition & 1 deletion service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ func (s *service) syncIsilonConfigs(ctx context.Context) error {
syncMutex.Lock()
defer syncMutex.Unlock()

configBytes, err := ioutil.ReadFile(isilonConfigFile)
configBytes, err := ioutil.ReadFile(filepath.Clean(isilonConfigFile))
if err != nil {
return fmt.Errorf("file ('%s') error: %v", isilonConfigFile, err)
}
Expand Down

0 comments on commit b793203

Please sign in to comment.