Merge pull request #215 from r0075h3ll/main

Add 'advices' field to the generated json report file
This commit is contained in:
Abhisek Datta 2024-05-17 17:20:23 +05:30 committed by GitHub
commit 14cde55629
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -257,6 +257,7 @@ func (j *jsonReportGenerator) buildJsonPackageReportFromPackage(p *models.Packag
Aliases: utils.SafelyGetValue(vuln.Aliases),
Severities: severties,
})
}
for _, license := range licenses {
@ -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
}