From fb1a87125fec5a0e537173be218b7e319478259a Mon Sep 17 00:00:00 2001 From: Evangelista Date: Thu, 20 Jun 2024 22:07:11 -0700 Subject: [PATCH 01/10] #200 added reports link to baselines --- scubagoggles/reporter/reporter.py | 5 ++++- scubagoggles/reporter/styles/main.css | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/scubagoggles/reporter/reporter.py b/scubagoggles/reporter/reporter.py index 3fdb4804..ca70a696 100644 --- a/scubagoggles/reporter/reporter.py +++ b/scubagoggles/reporter/reporter.py @@ -317,8 +317,11 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : 'Result': result, 'Criticality': test['Criticality'], 'Details': details}) + full_name = prod_to_fullname[product] + markdownGroupName = "-".join(baseline_group['GroupName'].split()) + groupReferenceURL = f'{baseline_group['GroupName']}' fragments.append(f"

{product_upper}-{baseline_group['GroupNumber']} \ - {baseline_group['GroupName']}

") + {groupReferenceURL}") fragments.append(create_html_table(table_data)) results_data.update({"GroupName": baseline_group['GroupName']}) results_data.update({"GroupNumber": baseline_group['GroupNumber']}) diff --git a/scubagoggles/reporter/styles/main.css b/scubagoggles/reporter/styles/main.css index 7d3bc620..45ab7ef3 100644 --- a/scubagoggles/reporter/styles/main.css +++ b/scubagoggles/reporter/styles/main.css @@ -125,4 +125,27 @@ img { .setting { font-style: italic; color: rgba(0, 0, 0, 0.8); +} + +a.control_group:link { + font-family: Arial, Helvetica, sans-serif; + color: var(--unvisited-link-color); + text-decoration: underline; +} + +a.control_group:visited { + font-family: Arial, Helvetica, sans-serif; + color: var(--link-color); +} + +a.control_group:hover { + font-family: Arial, Helvetica, sans-serif; + color: var(--link-color); + text-decoration: none; +} + +a.control_group:active { + font-family: Arial, Helvetica, sans-serif; + color: var(--link-color); + text-decoration: none; } \ No newline at end of file From 5d479de17ddd51cb02965e1a8d6bf950f6bd851f Mon Sep 17 00:00:00 2001 From: Evangelista Date: Thu, 20 Jun 2024 22:29:21 -0700 Subject: [PATCH 02/10] #200 fixing pylint error with f-string --- scubagoggles/reporter/reporter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scubagoggles/reporter/reporter.py b/scubagoggles/reporter/reporter.py index ca70a696..faaddf4b 100644 --- a/scubagoggles/reporter/reporter.py +++ b/scubagoggles/reporter/reporter.py @@ -319,7 +319,7 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : 'Details': details}) full_name = prod_to_fullname[product] markdownGroupName = "-".join(baseline_group['GroupName'].split()) - groupReferenceURL = f'{baseline_group['GroupName']}' + groupReferenceURL = f'{baseline_group["GroupName"]}' fragments.append(f"

{product_upper}-{baseline_group['GroupNumber']} \ {groupReferenceURL}

") fragments.append(create_html_table(table_data)) From 0979ddbd3fc13e0ab4451c462edcdba56ae2fc99 Mon Sep 17 00:00:00 2001 From: Evangelista Date: Thu, 20 Jun 2024 22:41:38 -0700 Subject: [PATCH 03/10] #200 fixing pylint errors --- scubagoggles/reporter/reporter.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scubagoggles/reporter/reporter.py b/scubagoggles/reporter/reporter.py index faaddf4b..26e099b7 100644 --- a/scubagoggles/reporter/reporter.py +++ b/scubagoggles/reporter/reporter.py @@ -318,10 +318,13 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : 'Criticality': test['Criticality'], 'Details': details}) full_name = prod_to_fullname[product] - markdownGroupName = "-".join(baseline_group['GroupName'].split()) - groupReferenceURL = f'{baseline_group["GroupName"]}' + markdown_group_name = "-".join(baseline_group['GroupName'].split()) + group_reference_url = f''\ + f'{baseline_group["GroupName"]}' fragments.append(f"

{product_upper}-{baseline_group['GroupNumber']} \ - {groupReferenceURL}

") + {group_reference_url}") fragments.append(create_html_table(table_data)) results_data.update({"GroupName": baseline_group['GroupName']}) results_data.update({"GroupNumber": baseline_group['GroupNumber']}) From e398fc8b569ba12864b02af6e15cf1ecabfef014 Mon Sep 17 00:00:00 2001 From: Evangelista Date: Thu, 20 Jun 2024 22:56:47 -0700 Subject: [PATCH 04/10] #200 fixing pylint errors --- scubagoggles/reporter/reporter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scubagoggles/reporter/reporter.py b/scubagoggles/reporter/reporter.py index 26e099b7..7c79a4e6 100644 --- a/scubagoggles/reporter/reporter.py +++ b/scubagoggles/reporter/reporter.py @@ -318,10 +318,12 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : 'Criticality': test['Criticality'], 'Details': details}) full_name = prod_to_fullname[product] + if full_name == 'Rules': + full_name = 'Common Controls' markdown_group_name = "-".join(baseline_group['GroupName'].split()) group_reference_url = f''\ + fr'{baseline_group["GroupNumber"]}-{markdown_group_name}" target="_blank"\>'\ f'{baseline_group["GroupName"]}' fragments.append(f"

{product_upper}-{baseline_group['GroupNumber']} \ {group_reference_url}

") From 7e655bb337ddca0b8a2441a0bd59ca5222511a1b Mon Sep 17 00:00:00 2001 From: Evangelista Date: Thu, 20 Jun 2024 23:06:48 -0700 Subject: [PATCH 05/10] #200 fixing pylint errors --- scubagoggles/reporter/reporter.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scubagoggles/reporter/reporter.py b/scubagoggles/reporter/reporter.py index 7c79a4e6..4ff0fab7 100644 --- a/scubagoggles/reporter/reporter.py +++ b/scubagoggles/reporter/reporter.py @@ -246,6 +246,7 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : for baseline_group in product_policies: table_data = [] results_data ={} + full_name = prod_to_fullname[product] for control in baseline_group['Controls']: tests = [test for test in test_results_data if test['PolicyId'] == control['Id']] if len(tests) == 0: @@ -293,6 +294,7 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : # results that belong to the Common Controls report is they're # marked as Not-Implemented. This if excludes them from the # rules report. + full_name = "Common Controls" continue report_stats[get_summary_category(result)] += 1 table_data.append({ @@ -317,9 +319,6 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : 'Result': result, 'Criticality': test['Criticality'], 'Details': details}) - full_name = prod_to_fullname[product] - if full_name == 'Rules': - full_name = 'Common Controls' markdown_group_name = "-".join(baseline_group['GroupName'].split()) group_reference_url = f''\ f'{baseline_group["GroupName"]}' From ec6789818b0b9ed005eacf17c7002765924a531e Mon Sep 17 00:00:00 2001 From: Evangelista Date: Fri, 21 Jun 2024 22:10:43 -0700 Subject: [PATCH 07/10] #312 updated group_reference_url variable to add to ScubaResults.json file, similar to ScubaGear --- scubagoggles/reporter/reporter.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scubagoggles/reporter/reporter.py b/scubagoggles/reporter/reporter.py index 78d30242..1dedce6d 100644 --- a/scubagoggles/reporter/reporter.py +++ b/scubagoggles/reporter/reporter.py @@ -320,15 +320,17 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : 'Criticality': test['Criticality'], 'Details': details}) markdown_group_name = "-".join(baseline_group['GroupName'].split()) - group_reference_url = f''\ + fr'{baseline_group["GroupNumber"]}-{markdown_group_name}' + markdown_link = f''\ f'{baseline_group["GroupName"]}' fragments.append(f"

{product_upper}-{baseline_group['GroupNumber']} \ - {group_reference_url}

") + {markdown_link}") fragments.append(create_html_table(table_data)) results_data.update({"GroupName": baseline_group['GroupName']}) results_data.update({"GroupNumber": baseline_group['GroupNumber']}) + results_data.update({"GroupReferenceURL":group_reference_url}) results_data.update({"Controls": table_data}) json_data.append(results_data) html = build_report_html(fragments, prod_to_fullname[product], tenant_domain, main_report_name) From 9b5fb7eea96bb357d5f2910a2af3c56b6ccf7c4f Mon Sep 17 00:00:00 2001 From: Evangelista Date: Fri, 21 Jun 2024 22:12:29 -0700 Subject: [PATCH 08/10] #312 fixing pylint error --- scubagoggles/reporter/reporter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scubagoggles/reporter/reporter.py b/scubagoggles/reporter/reporter.py index 1dedce6d..16c69682 100644 --- a/scubagoggles/reporter/reporter.py +++ b/scubagoggles/reporter/reporter.py @@ -322,8 +322,8 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : markdown_group_name = "-".join(baseline_group['GroupName'].split()) group_reference_url = f'{SCUBA_GITHUB_URL}/tree/v0.2.0/baselines/'\ f'{full_name} Minimum Viable Secure Configuration Baseline v0.2.md#'\ - fr'{baseline_group["GroupNumber"]}-{markdown_group_name}' - markdown_link = f''\ + f'{baseline_group["GroupNumber"]}-{markdown_group_name}' + markdown_link = fr''\ f'{baseline_group["GroupName"]}' fragments.append(f"

{product_upper}-{baseline_group['GroupNumber']} \ {markdown_link}

") From dab2ea6a3027d943d87dbada8aef4b2c2e214f5c Mon Sep 17 00:00:00 2001 From: Evangelista Date: Mon, 24 Jun 2024 22:02:00 -0700 Subject: [PATCH 09/10] #312 fixed spacing encoding in URL --- scubagoggles/reporter/reporter.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scubagoggles/reporter/reporter.py b/scubagoggles/reporter/reporter.py index 16c69682..8a103e2b 100644 --- a/scubagoggles/reporter/reporter.py +++ b/scubagoggles/reporter/reporter.py @@ -320,17 +320,18 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : 'Criticality': test['Criticality'], 'Details': details}) markdown_group_name = "-".join(baseline_group['GroupName'].split()) - group_reference_url = f'{SCUBA_GITHUB_URL}/tree/v0.2.0/baselines/'\ + group_reference_url = f'{SCUBA_GITHUB_URL}/blob/v0.2.0/baselines/'\ f'{full_name} Minimum Viable Secure Configuration Baseline v0.2.md#'\ f'{baseline_group["GroupNumber"]}-{markdown_group_name}' - markdown_link = fr''\ + group_reference_url_spacing = "%20".join(group_reference_url.split()) + markdown_link = fr''\ f'{baseline_group["GroupName"]}' fragments.append(f"

{product_upper}-{baseline_group['GroupNumber']} \ {markdown_link}

") fragments.append(create_html_table(table_data)) results_data.update({"GroupName": baseline_group['GroupName']}) results_data.update({"GroupNumber": baseline_group['GroupNumber']}) - results_data.update({"GroupReferenceURL":group_reference_url}) + results_data.update({"GroupReferenceURL":group_reference_url_spacing}) results_data.update({"Controls": table_data}) json_data.append(results_data) html = build_report_html(fragments, prod_to_fullname[product], tenant_domain, main_report_name) From 2bb5e2c18687737fd0a14a4f193422eaa44fffc6 Mon Sep 17 00:00:00 2001 From: Evangelista Date: Tue, 2 Jul 2024 21:59:47 -0700 Subject: [PATCH 10/10] #312 added variables for baseline version and tool version --- scubagoggles/reporter/reporter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scubagoggles/reporter/reporter.py b/scubagoggles/reporter/reporter.py index 8a103e2b..e30238ec 100644 --- a/scubagoggles/reporter/reporter.py +++ b/scubagoggles/reporter/reporter.py @@ -235,6 +235,8 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : ind_report_name = product_capitalized + "Report" fragments = [] json_data = [] + baseline_version = '0.2' + tool_version = '0.2.0' report_stats = { "Manual": 0, "Passes": 0, @@ -320,8 +322,8 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path : 'Criticality': test['Criticality'], 'Details': details}) markdown_group_name = "-".join(baseline_group['GroupName'].split()) - group_reference_url = f'{SCUBA_GITHUB_URL}/blob/v0.2.0/baselines/'\ - f'{full_name} Minimum Viable Secure Configuration Baseline v0.2.md#'\ + group_reference_url = f'{SCUBA_GITHUB_URL}/blob/v{tool_version}/baselines/'\ + f'{full_name} Minimum Viable Secure Configuration Baseline v{baseline_version}.md#'\ f'{baseline_group["GroupNumber"]}-{markdown_group_name}' group_reference_url_spacing = "%20".join(group_reference_url.split()) markdown_link = fr''\