Skip to content

Commit

Permalink
Add report id to front page
Browse files Browse the repository at this point in the history
  • Loading branch information
adhilto committed Sep 30, 2024
1 parent 3fd0e7b commit ca5ac67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h1>SCuBA M365 Security Baseline Conformance Reports</h1>
{TENANT_DETAILS}
{TABLES}
<footer>
Report generated with <a class="individual_reports" href="https://github.com/cisagov/ScubaGear">CISA's ScubaGear</a> tool {MODULE_VERSION}
Report UUID: {REPORT_UUID}. Report generated with <a class="individual_reports" href="https://github.com/cisagov/ScubaGear">CISA's ScubaGear</a> tool {MODULE_VERSION}
</footer>
</main>
</body>
Expand Down
4 changes: 4 additions & 0 deletions PowerShell/ScubaGear/Modules/Orchestrator.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1209,10 +1209,14 @@ function Invoke-ReportCreation {
$TenantMetaData = $TenantMetaData -replace '^(.*?)<table>','<table class ="tenantdata" style = "text-align:center;">'
$Fragment = $Fragment | ConvertTo-Html -Fragment -ErrorAction 'Stop'

$FileName = Join-Path -Path $OutFolderPath -ChildPath "$($OutProviderFileName).json" -Resolve
$ReportUuid = $(Get-Utf8NoBom -FilePath $FileName | ConvertFrom-Json).report_uuid

$ReportHtmlPath = Join-Path -Path $ReporterPath -ChildPath "ParentReport" -ErrorAction 'Stop'
$ReportHTML = (Get-Content $(Join-Path -Path $ReportHtmlPath -ChildPath "ParentReport.html") -ErrorAction 'Stop') -Join "`n"
$ReportHTML = $ReportHTML.Replace("{TENANT_DETAILS}", $TenantMetaData)
$ReportHTML = $ReportHTML.Replace("{TABLES}", $Fragment)
$ReportHTML = $ReportHTML.Replace("{REPORT_UUID}", $ReportUuid)
$ReportHTML = $ReportHTML.Replace("{MODULE_VERSION}", "v$ModuleVersion")
$ReportHTML = $ReportHTML.Replace("{BASELINE_URL}", $BaselineURL)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
$OrchestratorPath = '../../../../Modules/Orchestrator.psm1'
$CreateReportPath = '../../../../Modules/CreateReport/CreateReport.psm1'
$UtilityPath = '../../../../Modules/Utility/Utility.psm1'
Import-Module (Join-Path -Path $PSScriptRoot -ChildPath $OrchestratorPath) -Function Invoke-ReportCreation -Force
Import-Module (Join-Path -Path $PSScriptRoot -ChildPath $CreateReportPath) -Function New-Report, Import-SecureBaseline -Force

Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $UtilityPath) -Function Get-Utf8NoBom -Force
InModuleScope Orchestrator {
Describe -Tag 'Orchestrator' -Name 'Invoke-ReportCreation' {
BeforeAll {
Expand All @@ -19,7 +20,8 @@ InModuleScope Orchestrator {
Mock -CommandName Get-Content {}
Mock -CommandName Add-Type {}
Mock -CommandName Invoke-Item {}

Mock -CommandName Get-Utf8NoBom {}
Mock -CommandName ConvertFrom-Json { @{ "report_uuid"="" } }
}
Context 'When creating the reports from Provider and OPA results JSON' {
BeforeAll {
Expand Down

0 comments on commit ca5ac67

Please sign in to comment.