-
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 #11325 from DefectDojo/master-into-dev/2.40.3-2.41…
….0-dev Release: Merge back 2.40.3 into dev from: master-into-dev/2.40.3-2.41.0-dev
- Loading branch information
Showing
22 changed files
with
515 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
563b0e84cee202927fbaeb939ac52fbe6e6b2e3ea153e00eda7a10267bec60c2 | ||
5172af16b842adfccbedc14bea15ff1da2ee45c10e129e905f156dcdffd27396 |
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.