Skip to content

Commit

Permalink
License Violation - Show IssueId If LicenseKey is Empty (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas authored Nov 27, 2024
1 parent 8dbf035 commit 714e273
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit 714e273

Please sign in to comment.