Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exceptions for false alarms for gosec #44

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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