@@ -49,9 +49,7 @@ def datasource_advisory(self, purl) -> Iterable[VendorData]:
4949
5050 yml_files = [file for file in directory_files if file ["name" ].endswith (".yml" )]
5151
52- interesting_advisories = parse_interesting_advisories (
53- yml_files , purl
54- )
52+ interesting_advisories = parse_interesting_advisories (yml_files , purl )
5553 return interesting_advisories
5654
5755 @classmethod
@@ -67,24 +65,28 @@ def supported_ecosystem(cls):
6765 "pypi" : "pypi" ,
6866 }
6967
68+
7069def fetch_directory_contents (package_slug ):
7170 project_id = "12006272"
7271 url = f"https://gitlab.com/api/v4/projects/{ project_id } /repository/tree?path={ package_slug } "
7372 response = requests .get (url )
7473 if response .status_code == 200 :
7574 return response .json ()
76-
75+
76+
7777def construct_yml_url (file_path ):
7878 namespace = "gitlab-org"
7979 project = "security-products/gemnasium-db"
8080 branch = "master"
8181 return f"https://gitlab.com/{ namespace } /{ project } /-/raw/{ branch } /{ file_path } "
8282
83+
8384def fetch_yaml (url ):
8485 response = requests .get (url )
8586 if response .status_code == 200 :
8687 return response .text
8788
89+
8890def get_package_slug (purl ):
8991 """
9092 Constructs a package slug from a given purl.
@@ -109,7 +111,6 @@ def get_package_slug(purl):
109111 return f"{ ecosystem } /{ package_name } "
110112
111113
112-
113114def get_casesensitive_slug (path , package_slug ):
114115 payload = [
115116 {
@@ -193,4 +194,4 @@ def parse_interesting_advisories(yml_files, purl) -> Iterable[VendorData]:
193194 aliases = gitlab_advisory ["identifiers" ],
194195 affected_versions = [affected_range ],
195196 fixed_versions = gitlab_advisory ["fixed_versions" ],
196- )
197+ )
0 commit comments