From 540bde2755d025e762782e2a2c84eb66cab8d4d8 Mon Sep 17 00:00:00 2001 From: Christian Zunker Date: Thu, 9 Mar 2023 08:59:38 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Fix=20progress=20for=20unsco?= =?UTF-8?q?red=20assets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian Zunker --- policy/scan/local_scanner.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/policy/scan/local_scanner.go b/policy/scan/local_scanner.go index b4c53344..2362ed83 100644 --- a/policy/scan/local_scanner.go +++ b/policy/scan/local_scanner.go @@ -595,7 +595,11 @@ func (s *localAssetScanner) run() (*AssetReport, error) { return ar, err } s.ProgressReporter.Score(report.Score.Rating().Letter()) - s.ProgressReporter.Completed() + if report.Score.Rating().Letter() == "U" { + s.ProgressReporter.NotApplicable() + } else { + s.ProgressReporter.Completed() + } log.Debug().Str("asset", s.job.Asset.Mrn).Msg("scan complete") ar.Report = report From d3c0cbb7b63ba2047316e4f33e99a8d41a40f8a1 Mon Sep 17 00:00:00 2001 From: Christian Zunker Date: Thu, 9 Mar 2023 11:09:01 +0100 Subject: [PATCH 2/2] Show 'Controls:' on when there are controls present Signed-off-by: Christian Zunker --- cli/reporter/print_compact.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/cli/reporter/print_compact.go b/cli/reporter/print_compact.go index 31f8d033..25248732 100644 --- a/cli/reporter/print_compact.go +++ b/cli/reporter/print_compact.go @@ -373,20 +373,22 @@ func (r *defaultReporter) printAssetQueries(resolved *policy.ResolvedPolicy, rep r.out.Write([]byte(NewLineCharacter)) } - r.out.Write([]byte("Controls:" + NewLineCharacter)) - for id, score := range report.Scores { - _, ok := resolved.CollectorJob.ReportingQueries[id] - if !ok { - continue - } + if len(report.Scores) > 0 { + r.out.Write([]byte("Controls:" + NewLineCharacter)) + for id, score := range report.Scores { + _, ok := resolved.CollectorJob.ReportingQueries[id] + if !ok { + continue + } - query, ok := queries[id] - if !ok { - r.out.Write([]byte("Couldn't find any queries for incoming value for " + id)) - continue - } + query, ok := queries[id] + if !ok { + r.out.Write([]byte("Couldn't find any queries for incoming value for " + id)) + continue + } - r.printControl(score, query, asset, resolved, report, results) + r.printControl(score, query, asset, resolved, report, results) + } } }