Skip to content

Commit

Permalink
vuln thresholds dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Long committed Feb 21, 2024
1 parent 022ef9d commit d9d479d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions scripts/present_findings.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,20 @@ def main():
findings_json = json.load(f)
parse_inspector_findings(findings_json)

if critical_threshold > 0:
output["critical_threshold"] = critical_threshold

if high_threshold > 0:
output["high_threshold"] = critical_threshold

if medium_threshold > 0:
output["medium_threshold"] = critical_threshold

if low_threshold > 0:
output["low_threshold"] = critical_threshold

# display output to the user
print(json.dumps(output, indent=4))
logging.info(f"\n{json.dumps(output, indent=4)}")

thresholds_enabled = thresholds_enabled.lower().strip()
if thresholds_enabled != "true":
Expand All @@ -123,9 +135,7 @@ def main():
# check if the vuln threshold is exceeded for each severity
for threshold, num_vulns in severity_mapping.items():
if is_threshold_exceeded(threshold, num_vulns):
logging.warning(f"vulnerability count threshold exceeded; expected fewer than {threshold} vulnerabilities "
f"but found {num_vulns}")
logging.warning("exiting with code 1")
logging.warning(f"vulnerability count threshold exceeded - exiting with code 1")
sys.exit(1)


Expand Down

0 comments on commit d9d479d

Please sign in to comment.