Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion cve_bin_tool/data_sources/rsd_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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...")

Expand Down Expand Up @@ -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 = []

Expand Down Expand Up @@ -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()
Expand Down