diff --git a/utils/resultwriter_test.go b/utils/resultwriter_test.go index 0c9a5a62..5f8652b0 100644 --- a/utils/resultwriter_test.go +++ b/utils/resultwriter_test.go @@ -242,7 +242,7 @@ func TestConvertXrayScanToSimpleJson(t *testing.T) { Summary: "summary-1", IssueId: "XRAY-1", ImpactedDependencyDetails: formats.ImpactedDependencyDetails{ - SeverityDetails: formats.SeverityDetails{Severity: "High"}, + SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15}, ImpactedDependencyName: "component-A", }, }, @@ -250,7 +250,7 @@ func TestConvertXrayScanToSimpleJson(t *testing.T) { Summary: "summary-1", IssueId: "XRAY-1", ImpactedDependencyDetails: formats.ImpactedDependencyDetails{ - SeverityDetails: formats.SeverityDetails{Severity: "High"}, + SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15}, ImpactedDependencyName: "component-B", }, }, @@ -258,7 +258,7 @@ func TestConvertXrayScanToSimpleJson(t *testing.T) { Summary: "summary-2", IssueId: "XRAY-2", ImpactedDependencyDetails: formats.ImpactedDependencyDetails{ - SeverityDetails: formats.SeverityDetails{Severity: "Low"}, + SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 9}, ImpactedDependencyName: "component-B", }, }, @@ -288,7 +288,7 @@ func TestConvertXrayScanToSimpleJson(t *testing.T) { Summary: "summary-1", IssueId: "XRAY-1", ImpactedDependencyDetails: formats.ImpactedDependencyDetails{ - SeverityDetails: formats.SeverityDetails{Severity: "High"}, + SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15}, ImpactedDependencyName: "component-A", }, }, @@ -296,7 +296,7 @@ func TestConvertXrayScanToSimpleJson(t *testing.T) { Summary: "summary-1", IssueId: "XRAY-1", ImpactedDependencyDetails: formats.ImpactedDependencyDetails{ - SeverityDetails: formats.SeverityDetails{Severity: "High"}, + SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15}, ImpactedDependencyName: "component-B", }, }, @@ -305,7 +305,7 @@ func TestConvertXrayScanToSimpleJson(t *testing.T) { { LicenseKey: "license-1", ImpactedDependencyDetails: formats.ImpactedDependencyDetails{ - SeverityDetails: formats.SeverityDetails{Severity: "Low"}, + SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 9}, ImpactedDependencyName: "component-B", }, }, diff --git a/utils/severityutils/severity.go b/utils/severityutils/severity.go index 33e72f7e..436279ab 100644 --- a/utils/severityutils/severity.go +++ b/utils/severityutils/severity.go @@ -234,6 +234,10 @@ func ParseToSeverityDetails(severity string, sarifSeverity, pretty bool, applica // -- Getters functions (With default values) -- func GetAsDetails(severity Severity, applicabilityStatus jasutils.ApplicabilityStatus, pretty bool) formats.SeverityDetails { + if applicabilityStatus == jasutils.NotScanned { + // Pass 'NotCovered' as default value to get priority, since 'NotScanned' returns 0 priority for all severities + applicabilityStatus = jasutils.NotCovered + } return GetSeverityDetails(severity, applicabilityStatus).ToDetails(severity, pretty) }