SlHelpers
SlCVEs::CveShaMap Class Reference

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

#include <CveShaMap.h>

Public Types

enum  ShaSize { Long, Short }
 Store Long or Short SHAs.
 
using CveShaMapTy = std::unordered_multimap< std::string, std::string, SlHelpers::String::Hash, SlHelpers::String::Eq >
 CVE -> upstream SHA mapping.
 
using ShaCveMapTy = std::unordered_map< std::string, std::string, SlHelpers::String::Hash, SlHelpers::String::Eq >
 Upstream SHA -> CVE mapping.
 

Public Member Functions

 CveShaMap (const CveShaMap &)=delete
 
CveShaMapoperator= (const CveShaMap &)=delete
 
 CveShaMap (CveShaMap &&)=default
 Move constructor.
 
CveShaMapoperator= (CveShaMap &&)=default
 Move assignment operator.
 
 CveShaMap (const std::filesystem::path &vsource={}, ShaSize shaSize=ShaSize::Long, const std::string &branch="origin/master", unsigned year=0, bool rejected=false)
 Create a new CveShaMap. More...
 
std::string_view getCve (std::string_view shaCommit) const
 Get CVE number for shaCommit. More...
 
std::vector< std::string > getShas (std::string_view cveNumber) const
 Get SHAs for cveNumber. More...
 
std::set< std::string > getAllCves () const
 Get all stored CVE numbers. More...
 

Detailed Description

A map between CVE numbers and upstream SHAs.

Constructor & Destructor Documentation

◆ CveShaMap()

SlCVEs::CveShaMap::CveShaMap ( const std::filesystem::path &  vsource = {},
ShaSize  shaSize = ShaSize::Long,
const std::string &  branch = "origin/master",
unsigned  year = 0,
bool  rejected = false 
)

Create a new CveShaMap.

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/

Member Function Documentation

◆ getAllCves()

std::set<std::string> SlCVEs::CveShaMap::getAllCves ( ) const
inline

Get all stored CVE numbers.

Returns
Set of CVE numbers

◆ getCve()

std::string_view SlCVEs::CveShaMap::getCve ( std::string_view  shaCommit) const
inline

Get CVE number for shaCommit.

Parameters
shaCommitUpstream SHA
Returns
CVE number

◆ getShas()

std::vector<std::string> SlCVEs::CveShaMap::getShas ( std::string_view  cveNumber) const
inline

Get SHAs for cveNumber.

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

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