From f44b20ff4c5222969c0a5e3c4dec66db4918af3e Mon Sep 17 00:00:00 2001 From: Prowler Bot Date: Mon, 28 Jul 2025 16:04:12 +0200 Subject: [PATCH] fix(kisa): change the way of counting the PASS/FAILED reqs (#8383) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Pedro Martín --- prowler/CHANGELOG.md | 1 + .../compliance/kisa_ismsp/kisa_ismsp.py | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/prowler/CHANGELOG.md b/prowler/CHANGELOG.md index 3dd3ec614a..f1bc4b595d 100644 --- a/prowler/CHANGELOG.md +++ b/prowler/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to the **Prowler SDK** are documented in this file. ### Fixed - Add more validations to Azure Storage models when some values are None to avoid serialization issues [(#8325)](https://github.com/prowler-cloud/prowler/pull/8325) - `sns_topics_not_publicly_accessible` false positive with `aws:SourceArn` conditions [(#8326)](https://github.com/prowler-cloud/prowler/issues/8326) +- Way of counting FAILED/PASS reqs from `kisa_isms_p_2023_aws` table [(#8382)](https://github.com/prowler-cloud/prowler/pull/8382) --- diff --git a/prowler/lib/outputs/compliance/kisa_ismsp/kisa_ismsp.py b/prowler/lib/outputs/compliance/kisa_ismsp/kisa_ismsp.py index bf0a1b6e6f..93b925a5ff 100644 --- a/prowler/lib/outputs/compliance/kisa_ismsp/kisa_ismsp.py +++ b/prowler/lib/outputs/compliance/kisa_ismsp/kisa_ismsp.py @@ -13,6 +13,7 @@ def get_kisa_ismsp_table( compliance_overview: bool, ): sections = {} + sections_status = {} kisa_ismsp_compliance_table = { "Provider": [], "Section": [], @@ -36,7 +37,10 @@ def get_kisa_ismsp_table( # Check if Section exists if section not in sections: sections[section] = { - "Status": f"{Fore.GREEN}PASS{Style.RESET_ALL}", + "Status": { + "PASS": 0, + "FAIL": 0, + }, "Muted": 0, } if finding.muted: @@ -46,14 +50,29 @@ def get_kisa_ismsp_table( else: if finding.status == "FAIL" and index not in fail_count: fail_count.append(index) + sections[section]["Status"]["FAIL"] += 1 elif finding.status == "PASS" and index not in pass_count: pass_count.append(index) + sections[section]["Status"]["PASS"] += 1 # Add results to table sections = dict(sorted(sections.items())) + for section in sections: + if sections[section]["Status"]["FAIL"] > 0: + sections_status[section] = ( + f"{Fore.RED}FAIL({sections[section]['Status']['FAIL']}){Style.RESET_ALL}" + ) + else: + if sections[section]["Status"]["PASS"] > 0: + sections_status[section] = ( + f"{Fore.GREEN}PASS({sections[section]['Status']['PASS']}){Style.RESET_ALL}" + ) + else: + sections_status[section] = f"{Fore.GREEN}PASS{Style.RESET_ALL}" for section in sections: kisa_ismsp_compliance_table["Provider"].append(compliance.Provider) kisa_ismsp_compliance_table["Section"].append(section) + kisa_ismsp_compliance_table["Status"].append(sections_status[section]) kisa_ismsp_compliance_table["Muted"].append( f"{orange_color}{sections[section]['Muted']}{Style.RESET_ALL}" )