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

Turn osv critical and high severity findings into errors #299

Merged
merged 1 commit into from
Jan 9, 2025
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
42 changes: 34 additions & 8 deletions pkg/analysis/passes/osvscanner/osvscanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,34 @@ import (
)

var (
scanningFailure = &analysis.Rule{Name: "osv-scanner-failed", Severity: analysis.Warning}
scanningParseFailure = &analysis.Rule{Name: "osv-scanner-parse-failed", Severity: analysis.Warning}
scanningSucceeded = &analysis.Rule{Name: "osv-scanner-succeeded", Severity: analysis.Warning}
osvScannerCriticalSeverityDetected = &analysis.Rule{Name: "osv-scanner-critical-severity-vulnerabilities-detected", Severity: analysis.Warning} // This will be set to Error once stable
osvScannerHighSeverityDetected = &analysis.Rule{Name: "osv-scanner-high-severity-vulnerabilities-detected", Severity: analysis.Warning}
osvScannerModerateSeverityDetected = &analysis.Rule{Name: "osv-scanner-moderate-severity-vulnerabilities-detected", Severity: analysis.Warning}
osvScannerLowSeverityDetected = &analysis.Rule{Name: "osv-scanner-low-severity-vulnerabilities-detected", Severity: analysis.Warning}
scanningFailure = &analysis.Rule{
Name: "osv-scanner-failed",
Severity: analysis.Warning,
}
scanningParseFailure = &analysis.Rule{
Name: "osv-scanner-parse-failed",
Severity: analysis.Warning,
}
scanningSucceeded = &analysis.Rule{
Name: "osv-scanner-succeeded",
Severity: analysis.Warning,
}
osvScannerCriticalSeverityDetected = &analysis.Rule{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ran gofmt in this file. the only changes are this and the next rule are now errors

Name: "osv-scanner-critical-severity-vulnerabilities-detected",
Severity: analysis.Error,
}
osvScannerHighSeverityDetected = &analysis.Rule{
Name: "osv-scanner-high-severity-vulnerabilities-detected",
Severity: analysis.Error,
}
osvScannerModerateSeverityDetected = &analysis.Rule{
Name: "osv-scanner-moderate-severity-vulnerabilities-detected",
Severity: analysis.Warning,
}
osvScannerLowSeverityDetected = &analysis.Rule{
Name: "osv-scanner-low-severity-vulnerabilities-detected",
Severity: analysis.Warning,
}
)

var Analyzer = &analysis.Analyzer{
Expand Down Expand Up @@ -201,7 +222,12 @@ func run(pass *analysis.Pass) (interface{}, error) {
// nothing to do...
scanningSucceeded.Severity = analysis.OK
if scanningSucceeded.ReportAll {
pass.ReportResult(pass.AnalyzerName, scanningSucceeded, "osv-scanner skipped", "Scanning skipped: No lock files detected")
pass.ReportResult(
pass.AnalyzerName,
scanningSucceeded,
"osv-scanner skipped",
"Scanning skipped: No lock files detected",
)
}
}

Expand Down
Loading