Skip to content

Commit 14c53af

Browse files
authored
#10732 Prowler v4 importer ignores muted findings (#10750)
* #10732 Prowler v4 importer ignores muted findings * Modify test with new and suppressed findings * Fix typo * Fix one_vuln.ocsf.json
1 parent df1cd51 commit 14c53af

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

dojo/tools/aws_prowler_v3plus/prowler_v4.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ def process_ocsf_json(self, file, test):
1515
# https://docs.prowler.com/projects/prowler-open-source/en/latest/tutorials/reporting/#json
1616
for deserialized in data:
1717

18+
mute_status = deserialized.get("status")
1819
status = deserialized.get("status_code")
19-
if status.upper() != "FAIL":
20+
if (status.upper() != "FAIL") or (status.upper() == "FAIL" and mute_status == "Suppressed"):
2021
continue
2122

2223
account_id = deserialized.get("cloud", {}).get("account", {}).get("uid", "")

unittests/scans/aws_prowler_v3plus/many_vuln.ocsf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"severity_id": 4,
1212
"severity": "High",
13-
"status": "Suppressed",
13+
"status": "New",
1414
"status_code": "FAIL",
1515
"status_detail": "IAM Role myAdministratorExecutionRole has AdministratorAccess policy attached that has too permissive trust relationship.",
1616
"status_id": 3,
@@ -89,7 +89,7 @@
8989
},
9090
"severity_id": 4,
9191
"severity": "High",
92-
"status": "Suppressed",
92+
"status": "New",
9393
"status_code": "FAIL",
9494
"status_detail": "IAM Role AuditRole gives cross account read-only access.",
9595
"status_id": 3,

unittests/scans/aws_prowler_v3plus/one_vuln.ocsf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"severity_id": 4,
1212
"severity": "High",
13-
"status": "Suppressed",
13+
"status": "New",
1414
"status_code": "FAIL",
1515
"status_detail": "IAM Role myAdministratorExecutionRole has AdministratorAccess policy attached that has too permissive trust relationship.",
1616
"status_id": 3,

unittests/tools/test_aws_prowler_v3plus_parser.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,10 @@ def test_aws_prowler_parser_with_critical_vuln_has_one_findings_ocsf_json(self):
5555
def test_aws_prowler_parser_with_many_vuln_has_many_findings_ocsf_json(self):
5656
findings = self.setup(
5757
open("unittests/scans/aws_prowler_v3plus/many_vuln.ocsf.json", encoding="utf-8"))
58-
self.assertEqual(3, len(findings))
58+
self.assertEqual(2, len(findings))
5959
with self.subTest(i=0):
6060
self.assertEqual("prowler-aws-iam_role_administratoraccess_policy_permissive_trust_relationship-123456789012-us-east-1-myAdministratorExecutionRole", findings[0].unique_id_from_tool)
6161
self.assertIn("Ensure IAM Roles with attached AdministratorAccess policy have a well defined trust relationship", findings[0].description)
6262
with self.subTest(i=1):
6363
self.assertEqual("prowler-aws-iam_role_cross_account_readonlyaccess_policy-123456789012-us-east-1-AuditRole", findings[1].unique_id_from_tool)
6464
self.assertIn("Ensure IAM Roles do not have ReadOnlyAccess access for external AWS accounts", findings[1].description)
65-
with self.subTest(i=3):
66-
self.assertEqual("prowler-aws-iam_role_permissive_trust_relationship-123456789012-us-east-1-CrossAccountResourceAccessRole", findings[2].unique_id_from_tool)
67-
self.assertIn("Ensure IAM Roles do not allow assume role from any role of a cross account", findings[2].description)

0 commit comments

Comments
 (0)