Skip to content

Commit 36326ec

Browse files
Checkov report parsing enhanced (#12398)
* Introduced needed dependencies * Added info injection from guideline into finding * Adding BeautifulSoup to requirements Let's debate if this version is the best to use. * Add benchmark guidelines to mitigation section * Revert "Adding BeautifulSoup to requirements" This reverts commit d4d86f7. * Revert "Added info injection from guideline into finding" This reverts commit 08f68d9. * Revert "Introduced needed dependencies" This reverts commit f9de48f. * Maintaining benchmark refs in finding * Implemented future proofed description inclusion * Fixes problems raised by Ruff Linter Specifically, this fixes Q000, F821 and F541 identified previously on lines 126, 128 and 130 * Removed whitespace reported by linter Co-authored-by: valentijnscholten <valentijnscholten@gmail.com> --------- Co-authored-by: valentijnscholten <valentijnscholten@gmail.com>
1 parent c446ca6 commit 36326ec

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

dojo/tools/checkov/parser.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ def get_item(vuln, test, check_type):
119119
if "check_name" in vuln:
120120
description += f"{vuln['check_name']}\n"
121121

122+
if "description" in vuln:
123+
description += f"\n{vuln['description']}\n"
124+
mitigation = ""
125+
if "benchmarks" in vuln:
126+
bms = vuln["benchmarks"].keys()
127+
if len(bms) > 0:
128+
mitigation += "\nBenchmarks:\n"
129+
for bm in bms:
130+
for gl in vuln["benchmarks"][bm]:
131+
mitigation += f"- {bm} # {gl['name']} : {gl['description']}\n"
132+
122133
file_path = vuln.get("file_path", None)
123134
source_line = None
124135
if "file_line_range" in vuln:
@@ -133,8 +144,6 @@ def get_item(vuln, test, check_type):
133144
if "severity" in vuln and vuln["severity"] is not None:
134145
severity = vuln["severity"].capitalize()
135146

136-
mitigation = ""
137-
138147
references = vuln.get("guideline", "")
139148
return Finding(
140149
title=title,

0 commit comments

Comments
 (0)