Skip to content

Commit ae4d9b4

Browse files
Log audit errors when fail_upon_any_scanner_error is disabled (#1352)
* Log underlying scanner errors when partial results are allowed. When fail_upon_any_scanner_error is disabled, frogbot continued without failing but only logged a generic warning, hiding the audit error that support needs to diagnose failures. Co-authored-by: Cursor <cursoragent@cursor.com> * Use %v when logging scanner errors in partial-results path. Co-authored-by: Cursor <cursoragent@cursor.com> * Avoid logging fix errors twice in partial-results path. The fix-vulnerabilities call site already embedded err in messageForLog; CreateErrorIfFailUponScannerErrorEnabled now appends the error separately. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 956ef69 commit ae4d9b4

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

scanrepository/scanrepository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (sr *ScanRepositoryCmd) fixVulnerablePackages(repository *utils.Repository,
248248
}
249249
}
250250
if err != nil {
251-
return utils.CreateErrorIfFailUponScannerErrorEnabled(repository.GeneralConfig.FailUponAnyScannerError, fmt.Sprintf("failed to fix vulnerable dependencies: %s", err.Error()), err)
251+
return utils.CreateErrorIfFailUponScannerErrorEnabled(repository.GeneralConfig.FailUponAnyScannerError, "failed to fix vulnerable dependencies", err)
252252
}
253253
return nil
254254
}

utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ func isUrlAccessible(url string) bool {
466466
// If not - instead of returning an error we log the error and continue as if we didn't have an error
467467
func CreateErrorIfFailUponScannerErrorEnabled(fail bool, messageForLog string, err error) error {
468468
if !fail {
469-
log.Warn(messageForLog)
469+
log.Warn(fmt.Sprintf("%s: %v", messageForLog, err))
470470
return nil
471471
}
472472
return err

0 commit comments

Comments
 (0)