Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change of the compute severity for Aqua JSON parser #4465

Merged
merged 11 commits into from
May 10, 2021
59 changes: 39 additions & 20 deletions dojo/tools/aqua/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,32 @@ def get_item(resource, vuln, test):
score = 0
severity_justification = ""
used_for_classification = ""
if 'aqua_score' in vuln:
score = vuln.get('aqua_score')
used_for_classification = "Aqua score ({}) used for classification.\n".format(score)
if 'vendor_score' in vuln:
score = vuln.get('vendor_score')
used_for_classification = "Vendor score ({}) used for classification.\n".format(score)
if 'nvd_score' in vuln:
score = vuln.get('nvd_score')
used_for_classification = "NVD score v2 ({}) used for classification.\n".format(score)
severity_justification += "\nNVD v2 vectors: {}".format(vuln.get('nvd_vectors'))
if 'nvd_score_v3' in vuln:
score = vuln.get('nvd_score_v3')
used_for_classification = "NVD score v3 ({}) used for classification.\n".format(score)
severity_justification += "\nNVD v3 vectors: {}".format(vuln.get('nvd_vectors_v3'))
# Add the CVSS3 to Finding
cvssv3 = vuln.get('nvd_vectors_v3')

severity_justification += "\n{}".format(used_for_classification)

severity = severity_of(score)
if 'aqua_severity' in vuln:
score = vuln.get('aqua_severity')
severity = aqua_severity_of(score)
used_for_classification = "Aqua security score ({}) used for classification.\n".format(score)
severity_justification = vuln.get('aqua_severity_classification')
if 'nvd_score_v3' in vuln:
cvssv3 = vuln.get('nvd_vectors_v3')
else:
if 'aqua_score' in vuln:
score = vuln.get('aqua_score')
used_for_classification = "Aqua score ({}) used for classification.\n".format(score)
elif 'vendor_score' in vuln:
score = vuln.get('vendor_score')
used_for_classification = "Vendor score ({}) used for classification.\n".format(score)
elif 'nvd_score_v3' in vuln:
score = vuln.get('nvd_score_v3')
used_for_classification = "NVD score v3 ({}) used for classification.\n".format(score)
severity_justification += "\nNVD v3 vectors: {}".format(vuln.get('nvd_vectors_v3'))
# Add the CVSS3 to Finding
cvssv3 = vuln.get('nvd_vectors_v3')
elif 'nvd_score' in vuln:
score = vuln.get('nvd_score')
used_for_classification = "NVD score v2 ({}) used for classification.\n".format(score)
severity_justification += "\nNVD v2 vectors: {}".format(vuln.get('nvd_vectors'))
severity = severity_of(score)
severity_justification += "\n{}".format(used_for_classification)

return Finding(
title=cve + " - " + resource_name + " (" + resource_version + ") ",
Expand Down Expand Up @@ -120,6 +126,19 @@ def get_item_v2(item, test):
mitigation=mitigation)


def aqua_severity_of(score):
if score == 'high':
return "High"
if score == 'medium':
return "Medium"
elif score == 'low':
return "Low"
elif score == "negligible":
return "Info"
else:
return "Critical"


def severity_of(score):
if score == 0:
return "Info"
Expand Down
Loading