From 0e449cf90deadd8b2f5ab7182f8dbfa3e6680325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Str=C3=B6mberg?= Date: Thu, 7 Nov 2024 12:24:27 -0500 Subject: [PATCH] scan: fix missing newline, make less noisy (#601) * scan: fix missing newline, make less noisy * improve comment wording --- pkg/render/terminal_brief.go | 4 +++- pkg/report/report.go | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/render/terminal_brief.go b/pkg/render/terminal_brief.go index f8d8f9b12..49466409c 100644 --- a/pkg/render/terminal_brief.go +++ b/pkg/render/terminal_brief.go @@ -42,14 +42,16 @@ func (r TerminalBrief) File(_ context.Context, fr *malcontent.FileReport) error for _, b := range fr.Behaviors { content := fmt.Sprintf("│ %s %s — %s", riskColor(fr.RiskLevel, "•"), riskColor(fr.RiskLevel, b.ID), b.Description) + fmt.Fprint(r.w, content) + e := evidenceString(b.MatchStrings, b.Description) // no evidence to give if e == "" { + fmt.Println(r.w, "") continue } - fmt.Fprint(r.w, content) color.New(color.FgHiBlack).Fprint(r.w, ":") e = color.RGB(255, 255, 255).Sprint(e) diff --git a/pkg/report/report.go b/pkg/report/report.go index 83349382e..71ec7a6dc 100644 --- a/pkg/report/report.go +++ b/pkg/report/report.go @@ -342,7 +342,7 @@ func mungeDescription(s string) string { } //nolint:cyclop // ignore complexity of 44 -func Generate(ctx context.Context, path string, mrs yara.MatchRules, c malcontent.Config, expath string, logger *clog.Logger) (malcontent.FileReport, error) { +func Generate(ctx context.Context, path string, mrs yara.MatchRules, c malcontent.Config, expath string, _ *clog.Logger) (malcontent.FileReport, error) { ignoreTags := c.IgnoreTags minScore := c.MinRisk ignoreSelf := c.IgnoreSelf @@ -464,7 +464,7 @@ func Generate(ctx context.Context, path string, mrs yara.MatchRules, c malconten b.Override = append(b.Override, k) fr.Overrides = append(fr.Overrides, b) case !exists && override: - logger.Errorf("Override %s matched with no overridden rule\n", m.Rule) + // TODO: return error if override references an unknown rule name continue }