File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
internal/testing/testdata
pkg/ingestor/parser/cyclonedx Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,12 @@ var (
126126 //go:embed exampledata/cyclonedx-vex-false-positive.json
127127 CycloneDXVEXFalsePositive []byte
128128
129+ //go:embed exampledata/cyclonedx-vex-resolved-with-pedigree-no-detail.json
130+ CycloneDXVEXResolvedWithPedigreeNoDetail []byte
131+
132+ //go:embed exampledata/cyclonedx-vex-false-positive-no-detail.json
133+ CycloneDXVEXFalsePositiveNoDetail []byte
134+
129135 //go:embed exampledata/cyclonedx-vex.xml
130136 CyloneDXVEXExampleXML []byte
131137
Original file line number Diff line number Diff line change @@ -579,6 +579,8 @@ func (c *cyclonedxParser) getVulnerabilities(ctx context.Context) error {
579579 vd .KnownSince = publishedTime
580580 vd .Statement = vulnerability .Description
581581
582+ // Extract StatusNotes from analysis detail field.
583+ // This applies to all analysis states including resolved_with_pedigree and false_positive.
582584 if vulnerability .Analysis .Detail != "" {
583585 vd .StatusNotes = vulnerability .Analysis .Detail
584586 } else if vulnerability .Analysis .Response != nil {
@@ -587,8 +589,12 @@ func (c *cyclonedxParser) getVulnerabilities(ctx context.Context) error {
587589 response = append (response , string (res ))
588590 }
589591 vd .StatusNotes = strings .Join (response , "," )
590- } else {
592+ } else if vulnerability . Detail != "" {
591593 vd .StatusNotes = vulnerability .Detail
594+ } else {
595+ // If all detail fields are empty, preserve the CDX state enum information
596+ // to avoid losing this metadata (e.g., "CDX state: resolved_with_pedigree")
597+ vd .StatusNotes = fmt .Sprintf ("CDX state: %s" , string (vulnerability .Analysis .State ))
592598 }
593599 } else {
594600 vd = model.VexStatementInputSpec {
You can’t perform that action at this time.
0 commit comments