Skip to content

Commit

Permalink
Checkmarx one parser support API exported files (#9917)
Browse files Browse the repository at this point in the history
* Checkmarx one parser support API exported files

* fix fileName path

* minor fixes
  • Loading branch information
FelixHernandez authored Apr 12, 2024
1 parent 3cb060c commit c2059e8
Show file tree
Hide file tree
Showing 3 changed files with 601 additions and 2 deletions.
31 changes: 29 additions & 2 deletions dojo/tools/checkmarx_one/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def get_findings(self, file, test):
vulnerability.get("similarityId")
)
findings.append(finding)
if result_type == "kics":
elif result_type == "kics":
description = vulnerability.get("description")
file_path = vulnerability.get("data").get("filename")
file_path = vulnerability.get("data").get("filename", vulnerability.get("data").get("fileName"))
finding = Finding(
title=f'{description}',
description=description,
Expand All @@ -107,4 +107,31 @@ def get_findings(self, file, test):
vulnerability.get("similarityId")
)
findings.append(finding)
elif result_type in ["sca", "sca-container"]:
description = vulnerability.get("description")
finding = Finding(
title=description,
description=description,
date=date,
severity=vulnerability.get("severity").title(),
verified=vulnerability.get("state") != "TO_VERIFY",
test=test,
cwe=cwe,
static_finding=True,
)
if vulnerability.get("cveId"):
finding.unsaved_vulnerability_ids = [
vulnerability.get("cveId")
]
if vulnerability.get("id"):
finding.unique_id_from_tool = vulnerability.get(
"id"
)
else:
finding.unique_id_from_tool = str(
vulnerability.get("similarityId")
)
finding.unsaved_tags = [result_type]
findings.append(finding)

return findings
Loading

0 comments on commit c2059e8

Please sign in to comment.