SlHelpers
SlCVEs::CVEHashMap Class Reference

A map between CVE numbers and upstream SHAs. More...

#include <CVEHashMap.h>

Public Types

enum  ShaSize { Long, Short }
 Store Long or Short SHAs.
 
using CVEHashMapTy = std::unordered_multimap< std::string, std::string >
 CVE -> upstream SHA mapping.
 
using SHAHashMapTy = std::unordered_map< std::string, std::string >
 Upstream SHA -> CVE mapping.
 

Public Member Functions

std::string get_cve (const std::string &sha_commit) const
 Get CVE number for sha_commit. More...
 
std::vector< std::string > get_shas (const std::string &cve_number) const
 Get SHAs for cve_number. More...
 
std::set< std::string > get_all_cves () const
 Get all stored CVE numbers. More...
 

Static Public Member Functions

static std::optional< CVEHashMapcreate (const std::filesystem::path &vsource, ShaSize shaSize, const std::string &branch, unsigned year, bool rejected)
 Create a new CVEHashMap. More...
 

Detailed Description

A map between CVE numbers and upstream SHAs.

Member Function Documentation

◆ create()

static std::optional<CVEHashMap> SlCVEs::CVEHashMap::create ( const std::filesystem::path &  vsource,
ShaSize  shaSize,
const std::string &  branch,
unsigned  year,
bool  rejected 
)
static

Create a new CVEHashMap.

Parameters
vsourcePath to the vulns git repository
shaSizeLong or Short
branchBranch of vsource to walk
yearA specific year to walk or zero
rejectedWalk published/ or rejected/
Returns
CVEHashMap or nullopt on failure

◆ get_all_cves()

std::set<std::string> SlCVEs::CVEHashMap::get_all_cves ( ) const
inline

Get all stored CVE numbers.

Returns
Set of CVE numbers

◆ get_cve()

std::string SlCVEs::CVEHashMap::get_cve ( const std::string &  sha_commit) const
inline

Get CVE number for sha_commit.

Parameters
sha_commitUpstream SHA
Returns
CVE number

◆ get_shas()

std::vector<std::string> SlCVEs::CVEHashMap::get_shas ( const std::string &  cve_number) const
inline

Get SHAs for cve_number.

Parameters
cve_numberCVE number
Returns
Vector of upstream SHAs (possibly empty)

The documentation for this class was generated from the following file: