diff --git a/utils/results/conversion/simplejsonparser/simplejsonparser.go b/utils/results/conversion/simplejsonparser/simplejsonparser.go index e390f924..311caeb3 100644 --- a/utils/results/conversion/simplejsonparser/simplejsonparser.go +++ b/utils/results/conversion/simplejsonparser/simplejsonparser.go @@ -232,7 +232,7 @@ func addSimpleJsonLicenseViolation(licenseViolationsRows *[]formats.LicenseRow, return func(violation services.Violation, cves []formats.CveRow, applicabilityStatus jasutils.ApplicabilityStatus, severity severityutils.Severity, impactedPackagesName, impactedPackagesVersion, impactedPackagesType string, fixedVersion []string, directComponents []formats.ComponentRow, impactPaths [][]formats.ComponentRow) error { *licenseViolationsRows = append(*licenseViolationsRows, formats.LicenseRow{ - LicenseKey: violation.LicenseKey, + LicenseKey: getLicenseKey(violation.LicenseKey, violation.IssueId), ImpactedDependencyDetails: formats.ImpactedDependencyDetails{ SeverityDetails: severityutils.GetAsDetails(severity, applicabilityStatus, pretty), ImpactedDependencyName: impactedPackagesName, @@ -246,6 +246,13 @@ func addSimpleJsonLicenseViolation(licenseViolationsRows *[]formats.LicenseRow, } } +func getLicenseKey(licenseKey, issueId string) string { + if licenseKey == "" { + return issueId + } + return licenseKey +} + func addSimpleJsonOperationalRiskViolation(operationalRiskViolationsRows *[]formats.OperationalRiskViolationRow, pretty bool) results.ParseScaViolationFunc { return func(violation services.Violation, cves []formats.CveRow, applicabilityStatus jasutils.ApplicabilityStatus, severity severityutils.Severity, impactedPackagesName, impactedPackagesVersion, impactedPackagesType string, fixedVersion []string, directComponents []formats.ComponentRow, impactPaths [][]formats.ComponentRow) error { violationOpRiskData := getOperationalRiskViolationReadableData(violation)