From c730a9ded9d3f92a6ac5e023ee6ee7bcc4ecbc79 Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 26 Oct 2020 13:16:02 -0400 Subject: [PATCH] reports 0 vulnerabilies in case the check is successful (#312) * reports 0 vulnerabilies in case the check is successful * updates docs --- README.md | 6 ++++++ printer.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index a719b28e..e189139d 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,12 @@ $ kubeaudit all -f "internal/test/fixtures/all_resources/deployment-apps-v1.yml" ... ``` +If no errors with a given minimum severity are found, the following is returned: + +```shell +All checks completed. 0 high-risk vulnerabilities found +``` + #### Autofix Manifest mode also supports autofixing all security issues using the `autofix` command: diff --git a/printer.go b/printer.go index 3c17a9e4..e5a4a5ce 100644 --- a/printer.go +++ b/printer.go @@ -65,6 +65,10 @@ func (p *Printer) PrintReport(report *Report) { } func (p *Printer) prettyPrintReport(report *Report) { + if len(report.ResultsWithMinSeverity(p.minSeverity)) < 1 { + p.printColor(color.GreenColor, "All checks completed. 0 high-risk vulnerabilities found\n") + } + for _, workloadResult := range report.ResultsWithMinSeverity(p.minSeverity) { resource := workloadResult.GetResource().Object() objectMeta := k8s.GetObjectMeta(resource)