Skip to content

Commit

Permalink
resolve generic parser fixme (DefectDojo#9854)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-sommer authored and hblankenship committed Apr 26, 2024
1 parent a369354 commit 12bae64
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions dojo/tools/generic/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _get_findings_csv(self, filename):
title=row["Title"],
description=row["Description"],
date=parse(row["Date"]).date(),
severity=row["Severity"],
severity=self.get_severity(row["Severity"]),
duplicate=self._convert_bool(
row.get("Duplicate", "FALSE")
), # bool False by default
Expand Down Expand Up @@ -213,9 +213,6 @@ def _get_findings_csv(self, filename):
# manage CWE
if "CweId" in row:
finding.cwe = int(row["CweId"])
# FIXME remove this severity hack
if finding.severity == "Unknown":
finding.severity = "Info"

if "CVSSV3" in row:
cvss_objects = cvss_parser.parse_cvss_from_text(row["CVSSV3"])
Expand Down Expand Up @@ -253,3 +250,9 @@ def _get_findings_csv(self, filename):

def _convert_bool(self, val):
return val.lower()[0:1] == "t" # bool False by default

def get_severity(self, input):
if input in ["Info", "Low", "Medium", "High", "Critical"]:
return input
else:
return "Info"

0 comments on commit 12bae64

Please sign in to comment.