Skip to content

Commit 714e273

Browse files
authored
License Violation - Show IssueId If LicenseKey is Empty (#238)
1 parent 8dbf035 commit 714e273

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

utils/results/conversion/simplejsonparser/simplejsonparser.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func addSimpleJsonLicenseViolation(licenseViolationsRows *[]formats.LicenseRow,
232232
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 {
233233
*licenseViolationsRows = append(*licenseViolationsRows,
234234
formats.LicenseRow{
235-
LicenseKey: violation.LicenseKey,
235+
LicenseKey: getLicenseKey(violation.LicenseKey, violation.IssueId),
236236
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
237237
SeverityDetails: severityutils.GetAsDetails(severity, applicabilityStatus, pretty),
238238
ImpactedDependencyName: impactedPackagesName,
@@ -246,6 +246,13 @@ func addSimpleJsonLicenseViolation(licenseViolationsRows *[]formats.LicenseRow,
246246
}
247247
}
248248

249+
func getLicenseKey(licenseKey, issueId string) string {
250+
if licenseKey == "" {
251+
return issueId
252+
}
253+
return licenseKey
254+
}
255+
249256
func addSimpleJsonOperationalRiskViolation(operationalRiskViolationsRows *[]formats.OperationalRiskViolationRow, pretty bool) results.ParseScaViolationFunc {
250257
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 {
251258
violationOpRiskData := getOperationalRiskViolationReadableData(violation)

0 commit comments

Comments
 (0)