1717import requests
1818import saneyaml
1919from fetchcode import fetch
20+ from packageurl import PackageURL
2021
2122from vulntotal .validator import DataSource
2223from vulntotal .validator import VendorData
@@ -39,7 +40,7 @@ def datasource_advisory(self, purl) -> Iterable[VendorData]:
3940 location = download_subtree (casesensitive_package_slug )
4041 if location :
4142 interesting_advisories = parse_interesting_advisories (
42- location , purl . version , delete_download = True
43+ location , purl , delete_download = True
4344 )
4445 return interesting_advisories
4546 clear_download (location )
@@ -151,7 +152,8 @@ def get_casesensitive_slug(path, package_slug):
151152 hasnext = paginated_tree ["pageInfo" ]["hasNextPage" ]
152153
153154
154- def parse_interesting_advisories (location , version , delete_download = False ) -> Iterable [VendorData ]:
155+ def parse_interesting_advisories (location , purl , delete_download = False ) -> Iterable [VendorData ]:
156+ version = purl .version
155157 path = Path (location )
156158 glob = "**/*.yml"
157159 files = (p for p in path .glob (glob ) if p .is_file ())
@@ -161,6 +163,7 @@ def parse_interesting_advisories(location, version, delete_download=False) -> It
161163 affected_range = gitlab_advisory ["affected_range" ]
162164 if gitlab_constraints_satisfied (affected_range , version ):
163165 yield VendorData (
166+ purl = PackageURL (purl .type , purl .namespace , purl .name ),
164167 aliases = gitlab_advisory ["identifiers" ],
165168 affected_versions = [affected_range ],
166169 fixed_versions = gitlab_advisory ["fixed_versions" ],
0 commit comments