-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11322 from DefectDojo/release/2.40.3
Release: Merge release into master from: release/2.40.3
- Loading branch information
Showing
25 changed files
with
521 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
f85484f23e59aabe591b30db10e0de05aaeeb9d8979d236d565dc8279e03e116 | ||
93f0a72eaae484814b5b38dba8dc57d529ea3c414b7fa4da8b2e347851dba46e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from dojo.models import Finding | ||
|
||
TRIVY_SEVERITIES = { | ||
"CRITICAL": "Critical", | ||
"HIGH": "High", | ||
"MEDIUM": "Medium", | ||
"LOW": "Low", | ||
"UNKNOWN": "Info", | ||
} | ||
|
||
|
||
class TrivyClusterComplianceHandler: | ||
def handle_clustercompliance(self, controls, clustercompliance, test): | ||
findings = [] | ||
for result in clustercompliance.get("controlCheck"): | ||
if int(result.get("totalFail", 0)) > 0: | ||
description = "" | ||
result_id = result.get("id", "") | ||
vulnerabilityids = [] | ||
for control in controls: | ||
if control.get("id") == result_id: | ||
vulnids = control.get("checks", []) | ||
for vulnid in vulnids: | ||
vulnerabilityids.append(vulnid.get("id")) | ||
description += "**description:** " + control.get("description") + "\n" | ||
result_name = result.get("name", "") | ||
result_severity = result.get("severity", "") | ||
result_totalfail = str(result.get("totalFail", "")) | ||
severity = TRIVY_SEVERITIES[result_severity] | ||
description += "**id:** " + result_id + "\n" | ||
description += "**name:** " + result_name + "\n" | ||
description += "**totalfail:** " + result_totalfail + "\n" | ||
title = "TrivyClusterCompliance " + result_id + " totalFail: " + result_totalfail | ||
finding = Finding( | ||
test=test, | ||
title=title, | ||
description=description, | ||
severity=severity, | ||
static_finding=False, | ||
dynamic_finding=True, | ||
) | ||
if vulnerabilityids != []: | ||
finding.unsaved_vulnerability_ids = vulnerabilityids | ||
findings.append(finding) | ||
return findings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
unittests/scans/anchorectl_policies/one_violation_description_severity.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[ | ||
{ | ||
"detail": [ | ||
{ | ||
"description": "CRITICAL User root found as effective user, which is not on the allowed list", | ||
"gate": "dockerfile", | ||
"imageId": "d26f0119b9634091a541b081dd8bdca435ab52e114e4b4328575c0bc2c69768b", | ||
"policyId": "RootUser", | ||
"status": "warn", | ||
"tag": "test/testimage:testtag", | ||
"triggerId": "b2605c2ddbdb02b8e2365c9248dada5a", | ||
"triggerName": "effective_user" | ||
} | ||
], | ||
"digest": "sha256:8htz0bf942cfcd6hg8cf6435afd318b65d23e4c1a80044304c6e3ed20", | ||
"finalAction": "stop", | ||
"finalActionReason": "policy_evaluation", | ||
"lastEvaluation": "2022-09-20T08:25:52Z", | ||
"policyId": "9e104ade-7b57-4cdc-93fb-4949bf3b36b6", | ||
"status": "fail", | ||
"tag": "test/testimage:testtag" | ||
} | ||
] |
Oops, something went wrong.