Skip to content

Commit 310c881

Browse files
🎉 All Trivy Operator findings in one json (#11252)
* 🎉 All Trivy Operator findings in one json * ruff * sboms are not covered here * if only sboms are present, skip all
1 parent 11cefb2 commit 310c881

3 files changed

Lines changed: 685 additions & 1 deletion

File tree

dojo/tools/trivy_operator/parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def get_description_for_scan_types(self, scan_type):
2020

2121
def get_findings(self, scan_file, test):
2222
scan_data = scan_file.read()
23-
2423
try:
2524
data = json.loads(str(scan_data, "utf-8"))
2625
except Exception:
@@ -29,6 +28,11 @@ def get_findings(self, scan_file, test):
2928
if type(data) is list:
3029
for listitems in data:
3130
findings += self.output_findings(listitems, test)
31+
elif type(data) is dict and bool(set(data.keys()) & {"clustercompliancereports.aquasecurity.github.io", "clusterconfigauditreports.aquasecurity.github.io", "clusterinfraassessmentreports.aquasecurity.github.io", "clusterrbacassessmentreports.aquasecurity.github.io", "configauditreports.aquasecurity.github.io", "exposedsecretreports.aquasecurity.github.io", "infraassessmentreports.aquasecurity.github.io", "rbacassessmentreports.aquasecurity.github.io", "vulnerabilityreports.aquasecurity.github.io"}):
32+
for datakey in list(data.keys()):
33+
if datakey not in ["clustersbomreports.aquasecurity.github.io", "sbomreports.aquasecurity.github.io"]:
34+
for listitems in (data[datakey]):
35+
findings += self.output_findings(listitems, test)
3236
else:
3337
findings += self.output_findings(data, test)
3438
return findings

0 commit comments

Comments
 (0)