Skip to content

Commit 89238a4

Browse files
committed
Test all importers for advisory ID
Signed-off-by: Tushar Goel <[email protected]>
1 parent 084aa81 commit 89238a4

36 files changed

+157
-73
lines changed

vulnerabilities/importers/apache_httpd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ class ApacheHTTPDImporter(Importer):
3838
license_url = "https://www.apache.org/licenses/LICENSE-2.0"
3939
importer_name = "Apache HTTPD Importer"
4040

41-
def get_advisory_id(self, aliases: list[str]) -> str:
41+
@classmethod
42+
def get_advisory_id(cls, aliases: list[str]) -> str:
4243
"""
4344
Return the Advisory ID for the given aliases.
4445
"""
45-
return self.get_cve_id(aliases)
46+
return cls.get_cve_id(aliases)
4647

4748
def advisory_data(self):
4849
links = fetch_links(self.base_url)

vulnerabilities/importers/apache_kafka.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ def fetch_advisory_page(self):
102102
page = requests.get(self.GH_PAGE_URL)
103103
return page.content
104104

105-
def get_advisory_id(self, aliases: list[str]) -> str:
105+
@classmethod
106+
def get_advisory_id(cls, aliases: list[str]) -> str:
106107
"""
107108
Return the Advisory ID for the given aliases.
108109
"""
109-
return self.get_cve_id(aliases)
110+
return cls.get_cve_id(aliases)
110111

111112
def advisory_data(self):
112113
advisory_page = self.fetch_advisory_page(self)

vulnerabilities/importers/apache_tomcat.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,12 @@ class ApacheTomcatImporter(Importer):
120120
license_url = "https://www.apache.org/licenses/LICENSE-2.0"
121121
importer_name = "Apache Tomcat Importer"
122122

123-
def get_advisory_id(self, aliases: list[str]) -> str:
123+
@classmethod
124+
def get_advisory_id(cls, aliases: list[str]) -> str:
124125
"""
125126
Return the Advisory ID for the given aliases.
126127
"""
127-
return self.get_cve_id(aliases)
128+
return cls.get_cve_id(aliases)
128129

129130
def fetch_advisory_pages(self):
130131
"""

vulnerabilities/importers/archlinux.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ class ArchlinuxImporter(Importer):
3030
license_url = "https://github.com/archlinux/arch-security-tracker/blob/master/LICENSE"
3131
importer_name = "Arch Linux Importer"
3232

33-
def get_advisory_id(self, aliases: list[str]) -> str:
33+
@classmethod
34+
def get_advisory_id(cls, aliases: list[str]) -> str:
3435
"""
3536
Return the Advisory ID for the given aliases.
3637
"""
37-
return self.get_cve_id(aliases)
38+
return cls.get_cve_id(aliases)
3839

3940
def fetch(self) -> Iterable[Mapping]:
4041
response = fetch_response(self.url)

vulnerabilities/importers/curl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ class CurlImporter(Importer):
3939
importer_name = "Curl Importer"
4040
api_url = "https://curl.se/docs/vuln.json"
4141

42-
def get_advisory_id(self, aliases: list[str]) -> str:
42+
@classmethod
43+
def get_advisory_id(cls, aliases: list[str]) -> str:
4344
"""
4445
Return the Advisory ID for the given aliases.
4546
"""
46-
return self.get_cve_id(aliases)
47+
return cls.get_cve_id(aliases)
4748

4849
def fetch(self) -> Iterable[Mapping]:
4950
response = fetch_response(self.api_url)

vulnerabilities/importers/debian.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ class DebianImporter(Importer):
8282
api_url = "https://security-tracker.debian.org/tracker/data/json"
8383
importer_name = "Debian Importer"
8484

85-
def get_advisory_id(self, aliases: list[str]) -> str:
85+
@classmethod
86+
def get_advisory_id(cls, aliases: list[str]) -> str:
8687
"""
8788
Return the Advisory ID for the given aliases.
8889
"""
89-
return self.get_cve_id(aliases)
90+
return cls.get_cve_id(aliases)
9091

9192
def get_response(self):
9293
response = requests.get(self.api_url)

vulnerabilities/importers/debian_oval.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ class DebianOvalImporter(OvalImporter):
5656
"""
5757
importer_name = "Debian Oval Importer"
5858

59-
def get_advisory_id(self, aliases: list[str]) -> str:
59+
@classmethod
60+
def get_advisory_id(cls, aliases: list[str]) -> str:
6061
"""
6162
Return the Advisory ID for the given aliases.
6263
"""
63-
return self.get_cve_id(aliases)
64+
return cls.get_cve_id(aliases)
6465

6566
def __init__(self, *args, **kwargs):
6667
super().__init__(*args, **kwargs)

vulnerabilities/importers/elixir_security.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ def advisory_data(self) -> Set[AdvisoryData]:
4141
if self.vcs_response:
4242
self.vcs_response.delete()
4343

44-
def get_advisory_id(self, aliases: list[str]) -> str:
44+
@classmethod
45+
def get_advisory_id(cls, aliases: list[str]) -> str:
4546
"""
4647
Return the Advisory ID for the given aliases.
4748
"""
48-
return self.get_cve_id(aliases)
49+
return cls.get_cve_id(aliases)
4950

5051
def process_file(self, file, base_path):
5152
relative_path = str(file.relative_to(base_path)).strip("/")

vulnerabilities/importers/epss.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ class EPSSImporter(Importer):
2929
spdx_license_expression = "unknown"
3030
importer_name = "EPSS Importer"
3131

32-
def get_advisory_id(self, aliases: list[str]) -> str:
32+
@classmethod
33+
def get_advisory_id(cls, aliases: list[str]) -> str:
3334
"""
3435
Return the Advisory ID for the given aliases.
3536
"""
36-
return self.get_cve_id(aliases)
37+
return cls.get_cve_id(aliases)
3738

3839
def advisory_data(self) -> Iterable[AdvisoryData]:
3940
response = urllib.request.urlopen(self.advisory_url)

vulnerabilities/importers/fireeye.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ class FireyeImporter(Importer):
3535
repo_url = "git+https://github.com/mandiant/Vulnerability-Disclosures"
3636
importer_name = "FireEye Importer"
3737

38-
def get_advisory_id(self, aliases: list[str]) -> str:
38+
@classmethod
39+
def get_advisory_id(cls, aliases: list[str]) -> str:
3940
"""
4041
Return the Advisory ID for the given aliases.
4142
"""
42-
return self.get_cve_id(aliases)
43+
return cls.get_cve_id(aliases)
4344

4445
def advisory_data(self) -> Iterable[AdvisoryData]:
4546
try:

0 commit comments

Comments
 (0)