From 01f3c66250ae4a9cad62e6d8156bbf42d74295d1 Mon Sep 17 00:00:00 2001 From: jcj Date: Mon, 9 Sep 2024 14:57:23 +0900 Subject: [PATCH] fix: modify yaml file for metric Signed-off-by: jcj --- src/plugin/manager/prowler_manager.py | 8 +++---- src/plugin/metadata/prowler.yaml | 24 +++++++++---------- .../Prowler/Compliance/findings_count.yaml | 5 ++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/plugin/manager/prowler_manager.py b/src/plugin/manager/prowler_manager.py index eebb01d..44395be 100644 --- a/src/plugin/manager/prowler_manager.py +++ b/src/plugin/manager/prowler_manager.py @@ -346,8 +346,8 @@ def _make_base_compliance_result( self, compliance_id: str, requirement_id: str, requirement_seq: int, check_id: str, severity: str, check_result: dict ) -> dict: - requirement_name, automation, requirement_skip = next( - ((requirement['Description'], requirement['Automation'], requirement['Skip']) + requirement_name, automation, requirement_unsupported = next( + ((requirement['Description'], requirement['Automation'], requirement['Unsupported']) for requirement in self.requirement_info[self.cloud_service_type]['Requirements'] if requirement['Requirement_Seq'] == requirement_seq ), @@ -365,7 +365,7 @@ def _make_base_compliance_result( "requirement_seq": requirement_seq, "automation": automation, "description": check_result["finding_info"]["desc"] if check_id else "", - "status": "SKIP" if requirement_skip else ("PASS" if check_id else "UNKNOWN"), + "status": "UNSUPPORTED" if requirement_unsupported else ("PASS" if check_id else "UNKNOWN"), "severity": severity if check_id else "", "service": check_result["resources"][0]["group"]["name"] if check_id else "", "checks": {}, @@ -447,7 +447,7 @@ def _load_requirement_info(self): requirement_checks = requirement_json.get('Checks', []) requirement_json['Requirement_Seq'] = i + 1 requirement_json['Automation'] = bool(requirement_checks) - requirement_json['Skip'] = not requirement_checks or ( + requirement_json['Unsupported'] = not requirement_checks or ( bool(self.checklist) and not bool(set(self.checklist) & set(requirement_checks))) frameworks[self.cloud_service_type]['Requirements'].append(requirement_json) diff --git a/src/plugin/metadata/prowler.yaml b/src/plugin/metadata/prowler.yaml index 9c242a0..ddad2ac 100644 --- a/src/plugin/metadata/prowler.yaml +++ b/src/plugin/metadata/prowler.yaml @@ -7,7 +7,7 @@ search: - PASS: "PASS" - FAIL: "FAIL" - INFO: "INFO" - - SKIP: "SKIP" + - UNSUPPORTED: "UNSUPPORTED" - UNKNOWN: "UNKNOWN" - Compliance Score: data.stats.score.percent type: float @@ -34,6 +34,7 @@ table: is_optional: true - Automation: data.automation data_type: boolean + is_optional: true - Status: data.status type: enum enums: @@ -43,7 +44,7 @@ table: type: badge - PASS: indigo.500 type: badge - - SKIP: peacock.500 + - UNSUPPORTED: peacock.500 type: badge - UNKNOWN: gray.500 type: badge @@ -63,10 +64,11 @@ tabs.0: sort: key: data.checks.status desc: false + root_path: data.checks + unwind: data.checks fields: - - Requirement ID: data.requirement_id - - Check Title: data.checks.check_title - - Status: data.checks.status + - Check Title: check_title + - Status: status type: enum enums: - FAIL: coral.500 @@ -81,15 +83,13 @@ tabs.0: - MANUAL: peacock.500 label: MANUAL type: badge - - Findings: data.checks.display.findings + - Findings: display.findings sortable: false - - Severity: data.checks.severity - - Service: data.checks.service - - Risk: data.checks.risk - - Remediation: data.checks.remediation.description + - Severity: severity + - Service: service + - Risk: risk + - Remediation: remediation.description search: - - key: data.requirement_id - name: Requirement ID - key: data.checks.check_title name: Check Title - key: data.checks.status diff --git a/src/plugin/metrics/Prowler/Compliance/findings_count.yaml b/src/plugin/metrics/Prowler/Compliance/findings_count.yaml index ea45c3f..9b5300a 100644 --- a/src/plugin/metrics/Prowler/Compliance/findings_count.yaml +++ b/src/plugin/metrics/Prowler/Compliance/findings_count.yaml @@ -19,8 +19,9 @@ query_options: - key: data.findings.resource_type name: Resource Type filter: - - key: cloud_service_group - value: Prowler + - k: cloud_service_group + v: "Prowler" + o: match unit: Count namespace_id: ns-prowler-compliance version: '1.0' \ No newline at end of file