Implement GOSec for security scanning Fix vulnerabilities (#227)
* Implement GOSec for security scanning Fix vulnerabilities * Fix lint failure * address PR comments and fix build break * Fix test break in mqsc
This commit is contained in:
@@ -90,6 +90,7 @@ func configureQueueManager() error {
|
||||
for _, file := range files {
|
||||
if strings.HasSuffix(file.Name(), ".mqsc") {
|
||||
abs := filepath.Join(configDir, file.Name())
|
||||
// #nosec G204
|
||||
cmd := exec.Command("runmqsc")
|
||||
stdin, err := cmd.StdinPipe()
|
||||
if err != nil {
|
||||
@@ -97,6 +98,7 @@ func configureQueueManager() error {
|
||||
return err
|
||||
}
|
||||
// Open the MQSC file for reading
|
||||
// #nosec G304
|
||||
f, err := os.Open(abs)
|
||||
if err != nil {
|
||||
log.Printf("Error opening %v: %v", abs, err)
|
||||
@@ -104,10 +106,16 @@ func configureQueueManager() error {
|
||||
// Copy the contents to stdin of the runmqsc process
|
||||
_, err = io.Copy(stdin, f)
|
||||
if err != nil {
|
||||
log.Printf("Error reading %v: %v", abs, err)
|
||||
log.Errorf("Error reading %v: %v", abs, err)
|
||||
}
|
||||
err = f.Close()
|
||||
if err != nil {
|
||||
log.Errorf("Failed to close MQSC file handle: %v", err)
|
||||
}
|
||||
err = stdin.Close()
|
||||
if err != nil {
|
||||
log.Errorf("Failed to close MQSC stdin: %v", err)
|
||||
}
|
||||
f.Close()
|
||||
stdin.Close()
|
||||
// Run the command and wait for completion
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user