From 1e4196b539f223d50fe5cdf554790ddf46edbbd5 Mon Sep 17 00:00:00 2001 From: Alden Hilton Date: Thu, 26 Sep 2024 16:31:56 -0700 Subject: [PATCH] add uuid to scuba output --- PowerShell/ScubaGear/Modules/Orchestrator.psm1 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/PowerShell/ScubaGear/Modules/Orchestrator.psm1 b/PowerShell/ScubaGear/Modules/Orchestrator.psm1 index e47ce9f21..4ea9a820b 100644 --- a/PowerShell/ScubaGear/Modules/Orchestrator.psm1 +++ b/PowerShell/ScubaGear/Modules/Orchestrator.psm1 @@ -623,7 +623,7 @@ function Invoke-ProviderList { "timestamp_zulu": "$($TimestampZulu)", "tenant_details": $($TenantDetails), "scuba_config": $($ConfigDetails), - + "report_uuid": "$(New-Guid)", $ProviderJSON } "@ @@ -961,7 +961,9 @@ function Merge-JsonOutput { $SettingsExportPath = Join-Path $OutFolderPath -ChildPath "$($OutProviderFileName).json" $DeletionList += $SettingsExportPath $SettingsExport = Get-Content $SettingsExportPath -Raw - $TimestampZulu = $(ConvertFrom-Json $SettingsExport).timestamp_zulu + $SettingsExportObject = $(ConvertFrom-Json $SettingsExport) + $TimestampZulu = $SettingsExportObject.timestamp_zulu + $ReportUuid = $SettingsExportObject.report_uuid # Get a list and abbreviation mapping of the products assessed $FullNames = @() @@ -985,6 +987,7 @@ function Merge-JsonOutput { "Tool" = "ScubaGear"; "ToolVersion" = $ModuleVersion; "TimestampZulu" = $TimestampZulu; + "ReportGuid" = $ReportUuid; } @@ -1749,6 +1752,14 @@ function Invoke-SCuBACached { Write-Debug $ActualSavedLocation } $SettingsExport = Get-Content $ProviderJSONFilePath | ConvertFrom-Json + + # Generate a new UUID for this new run of ScubaGear + $SettingsExport | Add-Member -Name 'report_uuid' -Value "$(New-Guid)" -Type NoteProperty -Force + $ProviderContent = $SettingsExport | ConvertTo-Json -Depth 20 + $ActualSavedLocation = Set-Utf8NoBom -Content $ProviderContent ` + -Location $OutPath -FileName "$OutProviderFileName.json" + Write-Debug $ActualSavedLocation + $TenantDetails = $SettingsExport.tenant_details $RegoParams = @{ 'ProductNames' = $ProductNames;