fix: 2.1.1 simplified output and added object comment
This commit is contained in:
@@ -161,12 +161,41 @@ function Get-CISExoOutput {
|
|||||||
if (Get-Command Get-SafeLinksPolicy -ErrorAction SilentlyContinue) {
|
if (Get-Command Get-SafeLinksPolicy -ErrorAction SilentlyContinue) {
|
||||||
# 2.1.1 (L2) Ensure Safe Links for Office Applications is Enabled
|
# 2.1.1 (L2) Ensure Safe Links for Office Applications is Enabled
|
||||||
# Retrieve all Safe Links policies
|
# Retrieve all Safe Links policies
|
||||||
|
# $policies Mock Object:
|
||||||
|
<#
|
||||||
|
$policies = @(
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Name = "PolicyOne"
|
||||||
|
EnableSafeLinksForEmail = $true
|
||||||
|
EnableSafeLinksForTeams = $true
|
||||||
|
EnableSafeLinksForOffice = $true
|
||||||
|
TrackClicks = $true
|
||||||
|
AllowClickThrough = $false
|
||||||
|
},
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Name = "PolicyTwo"
|
||||||
|
EnableSafeLinksForEmail = $true
|
||||||
|
EnableSafeLinksForTeams = $true
|
||||||
|
EnableSafeLinksForOffice = $true
|
||||||
|
TrackClicks = $true
|
||||||
|
AllowClickThrough = $true
|
||||||
|
},
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Name = "PolicyThree"
|
||||||
|
EnableSafeLinksForEmail = $true
|
||||||
|
EnableSafeLinksForTeams = $true
|
||||||
|
EnableSafeLinksForOffice = $true
|
||||||
|
TrackClicks = $true
|
||||||
|
AllowClickThrough = $false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
#>
|
||||||
$policies = Get-SafeLinksPolicy
|
$policies = Get-SafeLinksPolicy
|
||||||
# Initialize the details collection
|
# Initialize the details collection
|
||||||
$misconfiguredDetails = @()
|
$misconfiguredDetails = @()
|
||||||
foreach ($policy in $policies) {
|
foreach ($policy in $policies) {
|
||||||
# Get the detailed configuration of each policy
|
# Get the detailed configuration of each policy
|
||||||
$policyDetails = Get-SafeLinksPolicy -Identity $policy.Name
|
$policyDetails = $policy #Get-SafeLinksPolicy -Identity $policy.Name
|
||||||
# Check each required property and record failures
|
# Check each required property and record failures
|
||||||
# Condition A: Checking policy settings
|
# Condition A: Checking policy settings
|
||||||
$failures = @()
|
$failures = @()
|
||||||
|
@@ -11,7 +11,7 @@ function Test-SafeLinksOfficeApps {
|
|||||||
#. .\source\Classes\CISAuditResult.ps1
|
#. .\source\Classes\CISAuditResult.ps1
|
||||||
# Initialization code, if needed
|
# Initialization code, if needed
|
||||||
$recnum = "2.1.1"
|
$recnum = "2.1.1"
|
||||||
|
Write-Verbose "Running Test-SafeLinksOfficeApps for $recnum..."
|
||||||
<#
|
<#
|
||||||
Conditions for 2.1.1 (L2) Ensure Safe Links for Office Applications is Enabled
|
Conditions for 2.1.1 (L2) Ensure Safe Links for Office Applications is Enabled
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ function Test-SafeLinksOfficeApps {
|
|||||||
# Prepare the final result
|
# Prepare the final result
|
||||||
# Condition B: Ensuring no misconfigurations
|
# Condition B: Ensuring no misconfigurations
|
||||||
$result = $misconfiguredDetails.Count -eq 0
|
$result = $misconfiguredDetails.Count -eq 0
|
||||||
$details = if ($result) { "All Safe Links policies are correctly configured." } else { $misconfiguredDetails -join ' | ' }
|
$details = if ($result) { "All Safe Links policies are correctly configured." } else { $misconfiguredDetails -join '`n' }
|
||||||
$failureReasons = if ($result) { "N/A" } else { "The following Safe Links policies settings do not meet the recommended configuration: $($misconfiguredDetails -join ' | ')" }
|
$failureReasons = if ($result) { "N/A" } else { "The following Safe Links policies settings do not meet the recommended configuration: $($misconfiguredDetails -join ' | ')" }
|
||||||
|
|
||||||
# Create and populate the CISAuditResult object
|
# Create and populate the CISAuditResult object
|
||||||
|
Reference in New Issue
Block a user