Skip to content

Commit

Permalink
Merge pull request #215 from r0075h3ll/main
Browse files Browse the repository at this point in the history
Add 'advices' field to the generated json report file
  • Loading branch information
abhisek authored May 17, 2024
2 parents 4eab409 + 926837e commit 14cde55
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/reporter/json_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ func (j *jsonReportGenerator) buildJsonPackageReportFromPackage(p *models.Packag
Aliases: utils.SafelyGetValue(vuln.Aliases),
Severities: severties,
})

}

for _, license := range licenses {
Expand All @@ -265,5 +266,12 @@ func (j *jsonReportGenerator) buildJsonPackageReportFromPackage(p *models.Packag
})
}

if len(pkg.Vulnerabilities) > 0 {
pkg.Advices = append(pkg.Advices, &schema.RemediationAdvice{
Type: schema.RemediationAdviceType_UpgradePackage,
TargetAlternatePackageVersion: utils.SafelyGetValue(insights.PackageCurrentVersion),
})
}

return pkg
}

0 comments on commit 14cde55

Please sign in to comment.