-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat: add --severity-src
flag
#8269
base: main
Are you sure you want to change the base?
Conversation
} | ||
} | ||
if len(severitySrc) != 1 || severitySrc[0] != "auto" { | ||
log.Warn("No severity found in specified sources", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know these logs may be noise, but warnings should be rare occurrences and we should draw the user's attention to each vulnerability.
But we can also show the warning once and use debug logs for each vulnerability:
2025-01-22T15:47:14+06:00 WARN For one or more vulnerabilities, the severity level is not found in the specified sources
2025-01-22T15:47:14+06:00 DEBUG No severity found in specified sources vulnID="CVE-2016-2781" severity sources="alpine,alma"
2025-01-22T15:47:14+06:00 DEBUG No severity found in specified sources vulnID="CVE-2022-3219" severity sources="alpine,alma"
2025-01-22T15:47:14+06:00 DEBUG No severity found in specified sources vulnID="CVE-2016-20013" severity sources="alpine,alma"
2025-01-22T15:47:14+06:00 DEBUG No severity found in specified sources vulnID="CVE-2016-20013" severity sources="alpine,alma"
2025-01-22T15:47:14+06:00 DEBUG No severity found in specified sources vulnID="CVE-2024-41996" severity sources="alpine,alma"
2025-01-22T15:47:14+06:00 DEBUG No severity found in specified sources vulnID="CVE-2024-56433" severity sources="alpine,alma"
2025-01-22T15:47:14+06:00 DEBUG No severity found in specified sources vulnID="CVE-2024-56433" severity sources="alpine,alma"
@@ -105,6 +105,7 @@ trivy image [flags] IMAGE_NAME | |||
--secret-config string specify a path to config file for secret scanning (default "trivy-secret.yaml") | |||
--server string server address in client mode | |||
-s, --severity strings severities of security issues to be displayed (UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL) (default [UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL]) | |||
--severity-src strings order of data sources for selecting vulnerability severity level (nvd,redhat,redhat-oval,debian,ubuntu,alpine,amazon,oracle-oval,suse-cvrf,photon,arch-linux,alma,rocky,cbl-mariner,azure,ruby-advisory-db,php-security-advisories,nodejs-security-wg,ghsa,glad,aqua,osv,k8s,wolfi,chainguard,bitnami,govulndb,auto) (default [auto]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is very long, but I wanted to immediately stop Trivy for the incorrect sourceID.
@knqyf263 I think this PR is ready for review. If you don't have comments about trivy-db changes - we can merge aquasecurity/trivy-db#485. |
Description
Add
--severity-src
flag to set db sources order for vulnerability severity.If severities didn't found in this list - use UNKNOWN severity + show Warning about that.
Examples:
auto
(default) mode:severity from another source (nvd):
severity didn't found:
Related issues
--severity-src
flag to customize vulnerability severity selection #8180Related PRs
AllSourceIDs
trivy-db#485Checklist