Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it so that the scubagoggles reports link to the baselines #323

Merged
11 changes: 10 additions & 1 deletion scubagoggles/reporter/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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({
Expand All @@ -317,11 +319,18 @@ def rego_json_to_ind_reports(test_results_data : str, product : list, out_path :
'Result': result,
'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/'\
f'{full_name} Minimum Viable Secure Configuration Baseline v0.2.md#'\
f'{baseline_group["GroupNumber"]}-{markdown_group_name}'
markdown_link = fr'<a href="{group_reference_url}" target="_blank"\>'\
f'{baseline_group["GroupName"]}</a>'
fragments.append(f"<h2>{product_upper}-{baseline_group['GroupNumber']} \
{baseline_group['GroupName']}</h2>")
{markdown_link}</h2>")
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)
Expand Down
23 changes: 23 additions & 0 deletions scubagoggles/reporter/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading