diff --git a/PowerShell/ScubaGear/Modules/Providers/ExportAADProvider.psm1 b/PowerShell/ScubaGear/Modules/Providers/ExportAADProvider.psm1 index 2f8d6a3bc..f18f35d42 100644 --- a/PowerShell/ScubaGear/Modules/Providers/ExportAADProvider.psm1 +++ b/PowerShell/ScubaGear/Modules/Providers/ExportAADProvider.psm1 @@ -191,11 +191,11 @@ function Export-AADProvider { if ($RiskyApps -and $RiskySPs) { $AggregateRiskyApps = ConvertTo-Json -Depth 3 $Tracker.TryCommand("Format-RiskyApplications", @{"RiskyApps"=$RiskyApps; "RiskySPs"=$RiskySPs}) - $ThirdPartySPs = ConvertTo-Json -Depth 3 $Tracker.TryCommand("Get-ThirdPartyRiskyServicePrincipals", @{"RiskyApps"=$RiskyApps; "RiskySPs"=$RiskySPs}) + $RiskyThirdPartySPs = ConvertTo-Json -Depth 3 $Tracker.TryCommand("Format-RiskyThirdPartyServicePrincipals", @{"RiskyApps"=$RiskyApps; "RiskySPs"=$RiskySPs}) } else { $AggregateRiskyApps = "{}" - $ThirdPartySPs = "{}" + $RiskyThirdPartySPs = "{}" } ##### End block @@ -216,7 +216,7 @@ function Export-AADProvider { "license_information": $LicenseInfo, "total_user_count": $UserCount, "risky_applications": $AggregateRiskyApps, - "third_party_risky_service_principals": $ThirdPartySPs, + "risky_third_party_service_principals": $RiskyThirdPartySPs, "aad_successful_commands": $SuccessfulCommands, "aad_unsuccessful_commands": $UnSuccessfulCommands, "@ diff --git a/PowerShell/ScubaGear/Modules/Providers/ProviderHelpers/AADRiskyPermissionsHelper.psm1 b/PowerShell/ScubaGear/Modules/Providers/ProviderHelpers/AADRiskyPermissionsHelper.psm1 index 04aa69339..7147f76f1 100644 --- a/PowerShell/ScubaGear/Modules/Providers/ProviderHelpers/AADRiskyPermissionsHelper.psm1 +++ b/PowerShell/ScubaGear/Modules/Providers/ProviderHelpers/AADRiskyPermissionsHelper.psm1 @@ -416,7 +416,7 @@ function Format-RiskyApplications { } } -function Get-ThirdPartyRiskyServicePrincipals { +function Format-RiskyThirdPartyServicePrincipals { <# .Description Returns a JSON dataset of service principal objects owned by external organizations. @@ -446,7 +446,7 @@ function Get-ThirdPartyRiskyServicePrincipals { } } catch { - Write-Warning "An error occurred in Get-ThirdPartyRiskyServicePrincipals: $($_.Exception.Message)" + Write-Warning "An error occurred in Format-RiskyThirdPartyServicePrincipals: $($_.Exception.Message)" Write-Warning "Stack trace: $($_.ScriptStackTrace)" throw $_ } @@ -458,5 +458,5 @@ Export-ModuleMember -Function @( "Get-ApplicationsWithRiskyPermissions", "Get-ServicePrincipalsWithRiskyPermissions", "Format-RiskyApplications", - "Get-ThirdPartyRiskyServicePrincipals" + "Format-RiskyThirdPartyServicePrincipals" ) \ No newline at end of file diff --git a/PowerShell/ScubaGear/Modules/Providers/ProviderHelpers/CommandTracker.psm1 b/PowerShell/ScubaGear/Modules/Providers/ProviderHelpers/CommandTracker.psm1 index c538fc5d2..8221477f0 100644 --- a/PowerShell/ScubaGear/Modules/Providers/ProviderHelpers/CommandTracker.psm1 +++ b/PowerShell/ScubaGear/Modules/Providers/ProviderHelpers/CommandTracker.psm1 @@ -1,6 +1,6 @@ Import-Module -Name $PSScriptRoot/../ExportEXOProvider.psm1 -Function Get-ScubaSpfRecord, Get-ScubaDkimRecord, Get-ScubaDmarcRecord Import-Module -Name $PSScriptRoot/../ExportAADProvider.psm1 -Function Get-PrivilegedRole, Get-PrivilegedUser -Import-Module -Name $PSScriptRoot/AADRiskyPermissionsHelper.psm1 -Function Get-ApplicationsWithRiskyPermissions, Get-ServicePrincipalsWithRiskyPermissions, Format-RiskyApplications, Get-ThirdPartyRiskyServicePrincipals +Import-Module -Name $PSScriptRoot/AADRiskyPermissionsHelper.psm1 -Function Get-ApplicationsWithRiskyPermissions, Get-ServicePrincipalsWithRiskyPermissions, Format-RiskyApplications, Format-RiskyThirdPartyServicePrincipals class CommandTracker { [string[]]$SuccessfulCommands = @() diff --git a/PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/AADRiskyPermissionsHelper/Get-ThirdPartyRiskyServicePrincipals.Tests.ps1 b/PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/AADRiskyPermissionsHelper/Format-ThirdPartyRiskyServicePrincipals.Tests.ps1 similarity index 96% rename from PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/AADRiskyPermissionsHelper/Get-ThirdPartyRiskyServicePrincipals.Tests.ps1 rename to PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/AADRiskyPermissionsHelper/Format-ThirdPartyRiskyServicePrincipals.Tests.ps1 index 173d61c19..a4251b4d7 100644 --- a/PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/AADRiskyPermissionsHelper/Get-ThirdPartyRiskyServicePrincipals.Tests.ps1 +++ b/PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/AADRiskyPermissionsHelper/Format-ThirdPartyRiskyServicePrincipals.Tests.ps1 @@ -3,7 +3,7 @@ $AADRiskyPermissionsHelper = "$($ModulesPath)/Providers/ProviderHelpers/AADRisky Import-Module (Join-Path -Path $PSScriptRoot -ChildPath $AADRiskyPermissionsHelper) InModuleScope AADRiskyPermissionsHelper { - Describe "Get-ThirdPartyRiskyServicePrincipals" { + Describe "Format-RiskyThirdPartyServicePrincipals" { BeforeAll { # Import mock data $MockApplications = Get-Content (Join-Path -Path $PSScriptRoot -ChildPath "../RiskyPermissionsSnippets/MockApplications.json") | ConvertFrom-Json @@ -49,7 +49,7 @@ InModuleScope AADRiskyPermissionsHelper { $RiskyApps = Get-ApplicationsWithRiskyPermissions $RiskySPs = Get-ServicePrincipalsWithRiskyPermissions [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'ThirdPartySPs')] - $ThirdPartySPs = Get-ThirdPartyRiskyServicePrincipals -RiskyApps $RiskyApps -RiskySPs $RiskySPs + $ThirdPartySPs = Format-RiskyThirdPartyServicePrincipals -RiskyApps $RiskyApps -RiskySPs $RiskySPs } It "returns a list of third-party risky service principals with valid properties" { diff --git a/PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/Export-AADProvider.Tests.ps1 b/PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/Export-AADProvider.Tests.ps1 index 8bcd2ccb9..fb9710083 100644 --- a/PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/Export-AADProvider.Tests.ps1 +++ b/PowerShell/ScubaGear/Testing/Unit/PowerShell/Providers/AADProvider/Export-AADProvider.Tests.ps1 @@ -83,7 +83,7 @@ InModuleScope -ModuleName ExportAADProvider { $this.SuccessfulCommands += $Command return [pscustomobject]@{} } - "Get-ThirdPartyRiskyServicePrincipals" { + "Format-RiskyThirdPartyServicePrincipals" { $this.SuccessfulCommands += $Command return [pscustomobject]@{} }