From fd8b4c61c31623bd84517322ed1b8c2c07cd6330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Fabianski?= Date: Thu, 31 Oct 2024 11:45:40 +0100 Subject: [PATCH] add errors to jsonv2 security report --- pkg/report/output/security/formatter.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/report/output/security/formatter.go b/pkg/report/output/security/formatter.go index 7d9e7afa4..fd6088cac 100644 --- a/pkg/report/output/security/formatter.go +++ b/pkg/report/output/security/formatter.go @@ -10,6 +10,7 @@ import ( "github.com/bearer/bearer/pkg/commands/process/settings" "github.com/bearer/bearer/pkg/engine" "github.com/bearer/bearer/pkg/flag" + dataflowtypes "github.com/bearer/bearer/pkg/report/output/dataflow/types" "github.com/bearer/bearer/pkg/report/output/gitlab" "github.com/bearer/bearer/pkg/report/output/html" "github.com/bearer/bearer/pkg/report/output/reviewdog" @@ -28,10 +29,11 @@ type Formatter struct { } type JsonV2Output struct { - Source string `json:"source" yaml:"source"` - Version string `json:"version" yaml:"version"` - Findings RawFindings `json:"findings" yaml:"findings"` - Expected ExpectedDetections `json:"expected_findings,omitempty" yaml:"expected_findings,omitempty"` + Source string `json:"source" yaml:"source"` + Version string `json:"version" yaml:"version"` + Findings RawFindings `json:"findings" yaml:"findings"` + Expected ExpectedDetections `json:"expected_findings,omitempty" yaml:"expected_findings,omitempty"` + Errors []dataflowtypes.Error `json:"errors" yaml:"errors"` } func NewFormatter( @@ -82,6 +84,7 @@ func (f Formatter) Format(format string) (output string, err error) { Version: build.Version, Findings: f.ReportData.RawFindings, Expected: f.ReportData.ExpectedDetections, + Errors: f.ReportData.Dataflow.Errors, }) case flag.FormatYAML: return outputhandler.ReportYAML(f.ReportData.FindingsBySeverity)