@@ -53,7 +53,7 @@ def datasource_advisory(self, purl) -> Iterable[VendorData]:
5353 for advisory in metadata_advisories [0 ]["affected_by_vulnerabilities" ]:
5454 fetched_advisory = self .fetch_get_json (advisory ["url" ])
5555 self ._raw_dump .append (fetched_advisory )
56- yield parse_advisory (fetched_advisory )
56+ yield parse_advisory (fetched_advisory , purl )
5757
5858 @classmethod
5959 def supported_ecosystem (cls ):
@@ -74,14 +74,18 @@ def supported_ecosystem(cls):
7474 }
7575
7676
77- def parse_advisory (fetched_advisory ) -> VendorData :
77+ def parse_advisory (fetched_advisory , purl ) -> VendorData :
7878 aliases = [aliase ["alias" ] for aliase in fetched_advisory ["aliases" ]]
7979 affected_versions = []
8080 fixed_versions = []
8181 for instance in fetched_advisory ["affected_packages" ]:
82- affected_versions .append (PackageURL .from_string (instance ["purl" ]).version )
82+ affected_purl = PackageURL .from_string (instance ["purl" ])
83+ if affected_purl .type == purl .type :
84+ affected_versions .append (affected_purl .version )
8385 for instance in fetched_advisory ["fixed_packages" ]:
84- fixed_versions .append (PackageURL .from_string (instance ["purl" ]).version )
86+ fixed_purl = PackageURL .from_string (instance ["purl" ])
87+ if fixed_purl .type == purl .type :
88+ fixed_versions .append (fixed_purl .version )
8589 return VendorData (
8690 aliases = aliases , affected_versions = affected_versions , fixed_versions = fixed_versions
8791 )
0 commit comments