Exemple #1
0
def get_vulnerability(filter_by):
    if not isinstance(filter_by, dict):
        current_app.logger.error("Received invalid filter.")
        return None

    if "cve_id" in filter_by:
        vulnerability = Vulnerability.get_by_cve_id(filter_by["cve_id"])
    elif "commit_hash" in filter_by:
        vulnerability = Vulnerability.get_by_commit_hash(
            filter_by["commit_hash"])
    else:
        current_app.logger.error("Invalid filter option received.")
        return None
    return vulnerability
def getVulnerability(filter_by):
    if not isinstance(filter_by, dict):
        current_app.logger.error('Received invalid filter.')
        return None

    if 'cve_id' in filter_by:
        vulnerability = Vulnerability.get_by_cve_id(filter_by['cve_id'])
    elif 'commit_hash' in filter_by:
        vulnerability = Vulnerability.get_by_commit_hash(
            filter_by['commit_hash'])
    else:
        current_app.logger.error('Invalid filter option received.')
        return None
    return vulnerability
Exemple #3
0
 def _fetch_by_commit_hash(self):
     if self._vulnerability or not self.commit_hash:
         return
     self._vulnerability = Vulnerability.get_by_commit_hash(
         self.commit_hash)