Skip to content

Commit 7054a34

Browse files
authored
add exceptions for gosec (dell#44)
1 parent 9cedba6 commit 7054a34

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

gofsutil_mount_linux.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ func (fs *FS) formatAndMount(
189189
log.Printf("mkfs args: %v", args)
190190

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

336-
buf, _ := exec.Command("bash", "-c", cmd).Output()
336+
buf, _ := exec.Command("bash", "-c", cmd).Output() // #nosec G204
337337
output := string(buf)
338338
mpathDeviceRegx := regexp.MustCompile(`NAME="\S+"`)
339339
mpath := mpathDeviceRegx.FindString(output)
@@ -355,7 +355,7 @@ func (fs *FS) getNativeDevicesFromPpath(
355355
cmd := fmt.Sprintf("%s/%s", "/noderoot/sbin", ppinqtool)
356356
log.Debug("pp_inq cmd:", cmd)
357357
args := []string{"-wwn", "-dev", deviceName}
358-
out, err := exec.Command(cmd, args...).CombinedOutput()
358+
out, err := exec.Command(cmd, args...).CombinedOutput() // #nosec G204
359359
if err != nil {
360360
log.Errorf("Error powermt display %s: %v", deviceName, err)
361361
return devices, err
@@ -574,7 +574,7 @@ func reReadPartitionTable(_ context.Context, devicePath string) error {
574574
return fmt.Errorf("Failed to validate path: %s error %v", devicePath, err)
575575
}
576576
args := []string{path}
577-
_, err := exec.Command("partprobe", args...).CombinedOutput()
577+
_, err := exec.Command("partprobe", args...).CombinedOutput() // #nosec G204
578578
if err != nil {
579579
log.Errorf("Failed to execute partprobe on %s: %s", devicePath, err.Error())
580580
return err

0 commit comments

Comments
 (0)