trivy
trivy copied to clipboard
fix(report): hide empty tables if all vulns has been filtered
Description
We added --show-suppressed flag to show suppressed vulns.
But when all vulnerabilities for language package was filtered out - we still show empty table.
before:
➜ trivy -q rootfs ./log4j-core-2.17.0.jar --ignorefile ./.trivyignore.yaml
Java (jar)
Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
after:
➜ trivy -q rootfs ./log4j-core-2.17.0.jar --ignorefile ./.trivyignore.yaml
If --show-suppressed is used - we still show table (only target and Total: 0...):
➜ trivy -q rootfs ./log4j-core-2.17.0.jar --ignorefile ./.trivyignore.yaml --show-suppressed
Java (jar)
Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
Suppressed Vulnerabilities (Total: 1)
┌─────────────────────────────────────┬────────────────┬──────────┬─────────┬───────────┬───────────────────┐
│ Library │ Vulnerability │ Severity │ Status │ Statement │ Source │
├─────────────────────────────────────┼────────────────┼──────────┼─────────┼───────────┼───────────────────┤
│ org.apache.logging.log4j:log4j-core │ CVE-2021-44832 │ MEDIUM │ ignored │ N/A │ .trivyignore.yaml │
└─────────────────────────────────────┴────────────────┴──────────┴─────────┴───────────┴───────────────────┘
Related issues
- Close #6351
Checklist
- [x] I've read the guidelines for contributing to this repository.
- [x] I've followed the conventions in the PR title.
- [x] I've added tests that prove my fix is effective or that my feature works.
- [ ] I've updated the documentation with the relevant information (if needed).
- [ ] I've added usage information (if the PR introduces new options)
- [ ] I've included a "before" and "after" example to the description (if the PR is a user interface change).