From 011d36b32e889abd33ea5f1df433b8825a9abfa0 Mon Sep 17 00:00:00 2001 From: Shivam Kumar <127589548+shivam200446@users.noreply.github.com> Date: Mon, 30 Oct 2023 23:48:00 +0530 Subject: [PATCH 1/4] Update curl_source.py --- cve_bin_tool/data_sources/curl_source.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cve_bin_tool/data_sources/curl_source.py b/cve_bin_tool/data_sources/curl_source.py index 41fe409426..3e4326149e 100644 --- a/cve_bin_tool/data_sources/curl_source.py +++ b/cve_bin_tool/data_sources/curl_source.py @@ -23,6 +23,7 @@ class Curl_Source(Data_Source): + """Represents a data source for retrieving information about vulnerabilities in cURL.""" SOURCE = "Curl" CACHEDIR = DISK_LOCATION_DEFAULT BACKUPCACHEDIR = DISK_LOCATION_BACKUP @@ -30,6 +31,7 @@ class Curl_Source(Data_Source): DATA_SOURCE_LINK = "https://curl.se/docs/vuln.json" def __init__(self, error_mode=ErrorMode.TruncTrace): + """Initialize a Curl_Source instance. Args: error_mode (ErrorMode): The error mode to be used.""" self.cve_list = None self.cachedir = self.CACHEDIR self.backup_cachedir = self.BACKUPCACHEDIR @@ -40,12 +42,14 @@ def __init__(self, error_mode=ErrorMode.TruncTrace): self.vulnerability_data = [] async def get_cve_data(self): + """Get cURL vulnerability data. Fetches the cURL vulnerability data and retrieves a list of affected data. Returns: Tuple[Union[None, Any], str]: A tuple containing the affected data and the source name.""" await self.fetch_cves() self.get_cve_list() return (None, self.affected_data), self.source_name async def fetch_cves(self): + """Fetch cURL vulnerabilities data.""" if not self.session: connector = aiohttp.TCPConnector(limit_per_host=19) self.session = RateLimiter( @@ -57,6 +61,7 @@ async def fetch_cves(self): await self.session.close() async def download_curl_vulnerabilities(self, session: RateLimiter) -> None: + """Download cURL vulnerability data and save it to a file. Args: session (RateLimiter): The session to use for the HTTP request.""" async with await session.get(self.DATA_SOURCE_LINK) as response: response.raise_for_status() self.vulnerability_data = await response.json() @@ -66,6 +71,7 @@ async def download_curl_vulnerabilities(self, session: RateLimiter) -> None: await f.write(json.dumps(self.vulnerability_data, indent=4)) def get_cve_list(self): + """Get a list of affected cURL vulnerabilities.""" self.affected_data = [] for cve in self.vulnerability_data: From 85bcfbfb00cb286a1a4a3099878ce5447099a2f3 Mon Sep 17 00:00:00 2001 From: Shivam Kumar <127589548+shivam200446@users.noreply.github.com> Date: Tue, 31 Oct 2023 00:26:07 +0530 Subject: [PATCH 2/4] Update curl_source.py --- cve_bin_tool/data_sources/curl_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cve_bin_tool/data_sources/curl_source.py b/cve_bin_tool/data_sources/curl_source.py index 3e4326149e..c5c9081570 100644 --- a/cve_bin_tool/data_sources/curl_source.py +++ b/cve_bin_tool/data_sources/curl_source.py @@ -42,7 +42,7 @@ def __init__(self, error_mode=ErrorMode.TruncTrace): self.vulnerability_data = [] async def get_cve_data(self): - """Get cURL vulnerability data. Fetches the cURL vulnerability data and retrieves a list of affected data. Returns: Tuple[Union[None, Any], str]: A tuple containing the affected data and the source name.""" + """Get cURL vulnerability data. Fetches the cURL vulnerability data and retrieves a list of affected data. await self.fetch_cves() self.get_cve_list() From 13dbbbcd8eaf41ff0d63ff7749f2b0b78b9ab8f9 Mon Sep 17 00:00:00 2001 From: Shivam Kumar <127589548+shivam200446@users.noreply.github.com> Date: Tue, 31 Oct 2023 02:08:27 +0530 Subject: [PATCH 3/4] Update curl_source.py --- cve_bin_tool/data_sources/curl_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cve_bin_tool/data_sources/curl_source.py b/cve_bin_tool/data_sources/curl_source.py index c5c9081570..52dca3b54f 100644 --- a/cve_bin_tool/data_sources/curl_source.py +++ b/cve_bin_tool/data_sources/curl_source.py @@ -42,7 +42,7 @@ def __init__(self, error_mode=ErrorMode.TruncTrace): self.vulnerability_data = [] async def get_cve_data(self): - """Get cURL vulnerability data. Fetches the cURL vulnerability data and retrieves a list of affected data. + """Get cURL vulnerability data. Fetches the cURL vulnerability data and retrieves a list of affected data.""" await self.fetch_cves() self.get_cve_list() From 3e2c3550663b0c3c3a3682db6a8c8e5d8c55d39a Mon Sep 17 00:00:00 2001 From: Terri Oda Date: Thu, 2 Nov 2023 09:28:13 -0700 Subject: [PATCH 4/4] chore: blacken cve_bin_tool/data_sources/curl_source.py --- cve_bin_tool/data_sources/curl_source.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cve_bin_tool/data_sources/curl_source.py b/cve_bin_tool/data_sources/curl_source.py index 52dca3b54f..819dd2f9aa 100644 --- a/cve_bin_tool/data_sources/curl_source.py +++ b/cve_bin_tool/data_sources/curl_source.py @@ -24,6 +24,7 @@ class Curl_Source(Data_Source): """Represents a data source for retrieving information about vulnerabilities in cURL.""" + SOURCE = "Curl" CACHEDIR = DISK_LOCATION_DEFAULT BACKUPCACHEDIR = DISK_LOCATION_BACKUP