diff --git a/cve_bin_tool/data_sources/rsd_source.py b/cve_bin_tool/data_sources/rsd_source.py index 00266f4cfa..413ea1486a 100644 --- a/cve_bin_tool/data_sources/rsd_source.py +++ b/cve_bin_tool/data_sources/rsd_source.py @@ -21,6 +21,8 @@ class RSD_Source(Data_Source): + """Data source for fetching CVE data from RedHat Security Database.""" + SOURCE = "RSD" CACHEDIR = DISK_LOCATION_DEFAULT LOGGER = LOGGER.getChild("CVEDB") @@ -60,7 +62,7 @@ async def get_req(self, url, session, mode="json"): return content async def fetch_cves(self): - """Fetches CVEs from RSD and places them in rsd_path.""" + """Fetches CVEs from RedHat Security Database and places them in rsd_path.""" LOGGER.info("Getting RedHat Security Database CVEs...") @@ -152,6 +154,16 @@ async def update_cve_entries(self): self.all_cve_entries.append(data) def format_data(self, all_cve_entries): + """ + Reformats RedHat Security Database CVE data + + Parameters: + all_cve_entries (any): An iterable of CVE entries from RedHat Security Database + + Returns: + severity_data (list): CVE entries with associated severity data + affected_data (list): CVE entries with associated affected package data + """ severity_data = [] affected_data = [] @@ -258,6 +270,14 @@ def format_data(self, all_cve_entries): return severity_data, affected_data async def get_cve_data(self): + """ + Fetches RedHat Security Database CVEs, updates entries, and returns formatted data + along with the source name. + + Returns: + self.format_data(self.cve_entries) (tuple[list, list]): Formatted CVE data + self.source_name (str): Name of CVE source + """ # skip RSD if connection fails try: await self.fetch_cves()