Skip to content

Commit

Permalink
add exceptions for gosec (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
chimanjain authored Jul 19, 2024
1 parent 9cedba6 commit 7054a34
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gofsutil_mount_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ func (fs *FS) formatAndMount(
log.Printf("mkfs args: %v", args)

mkfsCmd := fmt.Sprintf("mkfs.%s", fsType)
/* #nosec G204 */
if err := exec.Command(mkfsCmd, args...).Run(); err != nil {
err := exec.Command(mkfsCmd, args...).Run() // #nosec G204
if err != nil {
log.WithFields(f).WithError(err).Error(
"format of disk failed")
} else {
Expand Down Expand Up @@ -333,7 +333,7 @@ func (fs *FS) getMpathNameFromDevice(
}
fmt.Println(cmd)

buf, _ := exec.Command("bash", "-c", cmd).Output()
buf, _ := exec.Command("bash", "-c", cmd).Output() // #nosec G204
output := string(buf)
mpathDeviceRegx := regexp.MustCompile(`NAME="\S+"`)
mpath := mpathDeviceRegx.FindString(output)
Expand All @@ -355,7 +355,7 @@ func (fs *FS) getNativeDevicesFromPpath(
cmd := fmt.Sprintf("%s/%s", "/noderoot/sbin", ppinqtool)
log.Debug("pp_inq cmd:", cmd)
args := []string{"-wwn", "-dev", deviceName}
out, err := exec.Command(cmd, args...).CombinedOutput()
out, err := exec.Command(cmd, args...).CombinedOutput() // #nosec G204
if err != nil {
log.Errorf("Error powermt display %s: %v", deviceName, err)
return devices, err
Expand Down Expand Up @@ -574,7 +574,7 @@ func reReadPartitionTable(_ context.Context, devicePath string) error {
return fmt.Errorf("Failed to validate path: %s error %v", devicePath, err)
}
args := []string{path}
_, err := exec.Command("partprobe", args...).CombinedOutput()
_, err := exec.Command("partprobe", args...).CombinedOutput() // #nosec G204
if err != nil {
log.Errorf("Failed to execute partprobe on %s: %s", devicePath, err.Error())
return err
Expand Down

0 comments on commit 7054a34

Please sign in to comment.