@@ -53,6 +53,8 @@ func ProcessProblemForVuln(
53
53
return processCveProblem (vuln , prob )
54
54
case string (testapi .Cwe ):
55
55
return processCweProblem (vuln , prob )
56
+ case string (testapi .Ghsa ):
57
+ return processGhsaProblem (vuln , prob )
56
58
case string (testapi .SnykLicense ):
57
59
return processSnykLicenseProblem (vuln , prob , logger )
58
60
default :
@@ -386,6 +388,19 @@ func processCweProblem(v *definitions.Vulnerability, prob *testapi.Problem) erro
386
388
return nil
387
389
}
388
390
391
+ func processGhsaProblem (v * definitions.Vulnerability , prob * testapi.Problem ) error {
392
+ ensureVulnHasIdentifiers (v )
393
+ ghsa , err := prob .AsGithubSecurityAdvisoryProblem ()
394
+ if err != nil {
395
+ return fmt .Errorf ("converting problem to github security advisory: %w" , err )
396
+ }
397
+ if v .Identifiers .GHSA == nil {
398
+ v .Identifiers .GHSA = & []string {}
399
+ }
400
+ * v .Identifiers .GHSA = append (* v .Identifiers .GHSA , ghsa .Id )
401
+ return nil
402
+ }
403
+
389
404
// processSnykLicenseProblem processes a Snyk license problem by extracting its data and populating the vulnerability.
390
405
func processSnykLicenseProblem (v * definitions.Vulnerability , prob * testapi.Problem , logger * zerolog.Logger ) error {
391
406
license , err := prob .AsSnykLicenseProblem ()
0 commit comments