From 921cbb14d6feb934c8dff55eb4ae10d815887e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Mart=C3=ADn?= Date: Tue, 21 May 2024 11:01:40 +0200 Subject: [PATCH] feat(dashboard): Multiple changes in compliance page (#4051) --- dashboard/common_methods.py | 8 +++++-- .../aws_foundational_technical_review_aws.py | 23 +++++++++++++++++++ dashboard/compliance/mitre_attack_aws.py | 10 ++++---- dashboard/compliance/mitre_attack_azure.py | 10 ++++---- dashboard/compliance/pci_3_2_1_aws.py | 4 ++-- dashboard/pages/compliance.py | 2 +- 6 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 dashboard/compliance/aws_foundational_technical_review_aws.py diff --git a/dashboard/common_methods.py b/dashboard/common_methods.py index eedc5936ea..89ce89ebe4 100644 --- a/dashboard/common_methods.py +++ b/dashboard/common_methods.py @@ -1535,7 +1535,7 @@ def get_section_container_iso(data, section_1, section_2): return html.Div(section_containers, className="compliance-data-layout") -def get_section_containers_pci(data, section_1): +def get_section_containers_format4(data, section_1): data["STATUS"] = data["STATUS"].apply(map_status_to_icon) data[section_1] = data[section_1].astype(str) @@ -1654,9 +1654,13 @@ def get_section_containers_pci(data, section_1): ) graph_div_service = html.Div(graph_service, className="graph-section-req") + if "REQUIREMENTS_NAME" not in specific_data.columns: + title_internal = f"{service}" + else: + title_internal = f"{service} - {specific_data['REQUIREMENTS_NAME'].iloc[0]}" internal_accordion_item = dbc.AccordionItem( - title=service, + title=title_internal, children=[html.Div([data_table], className="inner-accordion-content")], ) diff --git a/dashboard/compliance/aws_foundational_technical_review_aws.py b/dashboard/compliance/aws_foundational_technical_review_aws.py new file mode 100644 index 0000000000..7cf02407c3 --- /dev/null +++ b/dashboard/compliance/aws_foundational_technical_review_aws.py @@ -0,0 +1,23 @@ +import warnings + +from dashboard.common_methods import get_section_containers_format1 + +warnings.filterwarnings("ignore") + + +def get_table(data): + aux = data[ + [ + "REQUIREMENTS_ID", + "REQUIREMENTS_ATTRIBUTES_SECTION", + "CHECKID", + "STATUS", + "REGION", + "ACCOUNTID", + "RESOURCEID", + ] + ].copy() + + return get_section_containers_format1( + aux, "REQUIREMENTS_ATTRIBUTES_SECTION", "REQUIREMENTS_ID" + ) diff --git a/dashboard/compliance/mitre_attack_aws.py b/dashboard/compliance/mitre_attack_aws.py index 3bbc186bc4..f97ccffd4c 100644 --- a/dashboard/compliance/mitre_attack_aws.py +++ b/dashboard/compliance/mitre_attack_aws.py @@ -1,6 +1,6 @@ import warnings -from dashboard.common_methods import get_section_containers_format2 +from dashboard.common_methods import get_section_containers_format4 warnings.filterwarnings("ignore") @@ -9,15 +9,13 @@ def get_table(data): aux = data[ [ "REQUIREMENTS_ID", - "REQUIREMENTS_SUBTECHNIQUES", + "REQUIREMENTS_NAME", "CHECKID", "STATUS", "REGION", "ACCOUNTID", "RESOURCEID", ] - ].copy() + ] - return get_section_containers_format2( - aux, "REQUIREMENTS_ID", "REQUIREMENTS_SUBTECHNIQUES" - ) + return get_section_containers_format4(aux, "REQUIREMENTS_ID") diff --git a/dashboard/compliance/mitre_attack_azure.py b/dashboard/compliance/mitre_attack_azure.py index 3bbc186bc4..f97ccffd4c 100644 --- a/dashboard/compliance/mitre_attack_azure.py +++ b/dashboard/compliance/mitre_attack_azure.py @@ -1,6 +1,6 @@ import warnings -from dashboard.common_methods import get_section_containers_format2 +from dashboard.common_methods import get_section_containers_format4 warnings.filterwarnings("ignore") @@ -9,15 +9,13 @@ def get_table(data): aux = data[ [ "REQUIREMENTS_ID", - "REQUIREMENTS_SUBTECHNIQUES", + "REQUIREMENTS_NAME", "CHECKID", "STATUS", "REGION", "ACCOUNTID", "RESOURCEID", ] - ].copy() + ] - return get_section_containers_format2( - aux, "REQUIREMENTS_ID", "REQUIREMENTS_SUBTECHNIQUES" - ) + return get_section_containers_format4(aux, "REQUIREMENTS_ID") diff --git a/dashboard/compliance/pci_3_2_1_aws.py b/dashboard/compliance/pci_3_2_1_aws.py index 3813e79fb5..6a77787177 100644 --- a/dashboard/compliance/pci_3_2_1_aws.py +++ b/dashboard/compliance/pci_3_2_1_aws.py @@ -1,6 +1,6 @@ import warnings -from dashboard.common_methods import get_section_containers_pci +from dashboard.common_methods import get_section_containers_format4 warnings.filterwarnings("ignore") @@ -17,4 +17,4 @@ def get_table(data): ] ] - return get_section_containers_pci(aux, "REQUIREMENTS_ID") + return get_section_containers_format4(aux, "REQUIREMENTS_ID") diff --git a/dashboard/pages/compliance.py b/dashboard/pages/compliance.py index 7ed8b7d94c..911bbd9704 100644 --- a/dashboard/pages/compliance.py +++ b/dashboard/pages/compliance.py @@ -474,7 +474,7 @@ def display_data( overall_status_result_graph = get_graph(pie_1, "Overall Status Result") security_level_graph = get_graph( - pie_2, f"Top 5 failed {current_filter} by findings" + pie_2, f"Top 5 failed {current_filter} by requirements" ) return (