fix: Add plurality to approved storage providers parameter for 8.1.1

This commit is contained in:
DrIOS
2024-06-30 10:17:10 -05:00
parent fc9ff57576
commit 20124cdbb5
3 changed files with 12 additions and 12 deletions

View File

@@ -6,7 +6,7 @@ function Invoke-TestFunction {
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[string]$DomainName, [string]$DomainName,
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[string[]]$ApprovedCloudStorageProvider [string[]]$ApprovedCloudStorageProviders
) )
$functionName = $FunctionFile.BaseName $functionName = $FunctionFile.BaseName
@@ -17,8 +17,8 @@ function Invoke-TestFunction {
if ('DomainName' -in $functionCmd.Parameters.Keys) { if ('DomainName' -in $functionCmd.Parameters.Keys) {
$paramList.DomainName = $DomainName $paramList.DomainName = $DomainName
} }
if ('ApprovedCloudStorageProvider' -in $functionCmd.Parameters.Keys) { if ('ApprovedCloudStorageProviders' -in $functionCmd.Parameters.Keys) {
$paramList.ApprovedCloudStorageProvider = $ApprovedCloudStorageProvider $paramList.ApprovedCloudStorageProviders = $ApprovedCloudStorageProviders
} }
# Use splatting to pass parameters # Use splatting to pass parameters
Write-Verbose "Running $functionName..." Write-Verbose "Running $functionName..."

View File

@@ -21,7 +21,7 @@
Specifies specific recommendations to include in the audit. Accepts an array of recommendation numbers. Specifies specific recommendations to include in the audit. Accepts an array of recommendation numbers.
.PARAMETER SkipRecommendation .PARAMETER SkipRecommendation
Specifies specific recommendations to exclude from the audit. Accepts an array of recommendation numbers. Specifies specific recommendations to exclude from the audit. Accepts an array of recommendation numbers.
.PARAMETER ApprovedCloudStorageProvider .PARAMETER ApprovedCloudStorageProviders
Specifies the approved cloud storage providers for the audit. Accepts an array of cloud storage provider names. Specifies the approved cloud storage providers for the audit. Accepts an array of cloud storage provider names.
.PARAMETER DoNotConnect .PARAMETER DoNotConnect
If specified, the cmdlet will not establish a connection to Microsoft 365 services. If specified, the cmdlet will not establish a connection to Microsoft 365 services.
@@ -185,7 +185,7 @@ function Invoke-M365SecurityAudit {
[ValidateSet( [ValidateSet(
'GoogleDrive', 'ShareFile', 'Box', 'DropBox', 'Egnyte' 'GoogleDrive', 'ShareFile', 'Box', 'DropBox', 'Egnyte'
)] )]
[string[]]$ApprovedCloudStorageProvider = @(), [string[]]$ApprovedCloudStorageProviders = @(),
[Parameter(Mandatory = $false, HelpMessage = "Specifies that the cmdlet will not establish a connection to Microsoft 365 services.")] [Parameter(Mandatory = $false, HelpMessage = "Specifies that the cmdlet will not establish a connection to Microsoft 365 services.")]
[switch]$DoNotConnect, [switch]$DoNotConnect,
@@ -300,7 +300,7 @@ function Invoke-M365SecurityAudit {
Write-Progress -Activity "Executing Tests" -Status "Executing $($currentTestIndex) of $($totalTests): $($testFunction.Name)" -PercentComplete (($currentTestIndex / $totalTests) * 100) Write-Progress -Activity "Executing Tests" -Status "Executing $($currentTestIndex) of $($totalTests): $($testFunction.Name)" -PercentComplete (($currentTestIndex / $totalTests) * 100)
$functionName = $testFunction.BaseName $functionName = $testFunction.BaseName
if ($PSCmdlet.ShouldProcess($functionName, "Execute test")) { if ($PSCmdlet.ShouldProcess($functionName, "Execute test")) {
$auditResult = Invoke-TestFunction -FunctionFile $testFunction -DomainName $DomainName -ApprovedCloudStorageProvider $ApprovedCloudStorageProvider $auditResult = Invoke-TestFunction -FunctionFile $testFunction -DomainName $DomainName -ApprovedCloudStorageProviders $ApprovedCloudStorageProviders
# Add the result to the collection # Add the result to the collection
[void]$allAuditResults.Add($auditResult) [void]$allAuditResults.Add($auditResult)
} }

View File

@@ -3,7 +3,7 @@ function Test-TeamsExternalFileSharing {
[OutputType([CISAuditResult])] [OutputType([CISAuditResult])]
param ( param (
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[string[]]$ApprovedCloudStorageProvider [string[]]$ApprovedCloudStorageProviders
) )
begin { begin {
# Dot source the class script if necessary # Dot source the class script if necessary
@@ -34,10 +34,10 @@ function Test-TeamsExternalFileSharing {
#$clientconfig.AllowDropBox = $false #$clientconfig.AllowDropBox = $false
# Define all possible cloud storage providers # Define all possible cloud storage providers
$allProviders = @("AllowDropBox", "AllowBox", "AllowGoogleDrive", "AllowShareFile", "AllowEgnyte") $allProviders = @("AllowDropBox", "AllowBox", "AllowGoogleDrive", "AllowShareFile", "AllowEgnyte")
# If ApprovedCloudStorageProvider is provided, map it to the corresponding settings # If ApprovedCloudStorageProviders is provided, map it to the corresponding settings
if ($PSBoundParameters.ContainsKey('ApprovedCloudStorageProvider')) { if ($PSBoundParameters.ContainsKey('ApprovedCloudStorageProviders')) {
$approvedProviders = @() $approvedProviders = @()
foreach ($provider in $ApprovedCloudStorageProvider) { foreach ($provider in $ApprovedCloudStorageProviders) {
$approvedProviders += "Allow$provider" $approvedProviders += "Allow$provider"
} }
} else { } else {
@@ -53,8 +53,8 @@ function Test-TeamsExternalFileSharing {
} }
} }
$basePassDetails = "All cloud storage services are approved providers" $basePassDetails = "All cloud storage services are approved providers"
if ($ApprovedCloudStorageProvider) { if ($ApprovedCloudStorageProviders) {
$basePassDetails = "Approved cloud storage services: $($ApprovedCloudStorageProvider -join ', ')" $basePassDetails = "Approved cloud storage services: $($ApprovedCloudStorageProviders -join ', ')"
} }
# Create an instance of CISAuditResult and populate it # Create an instance of CISAuditResult and populate it
$params = @{ $params = @{