From 3cf604f2eaf65f6ae014019d3fcb2bb013c40452 Mon Sep 17 00:00:00 2001 From: Jeremy Finney Date: Tue, 10 Nov 2026 10:59:40 +1300 Subject: [PATCH 01/12] fix(cisa): align checks with SCuBA guidance Align SPF and SharePoint checks with current CISA behavior, and deprecate withdrawn Exchange checks. Add focused regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Test-MtCisaDeprecatedExchange.Tests.ps1 | 34 ++++++++ .../Test-MtCisaSpfDirective.Tests.ps1 | 86 +++++++++++++++++++ ...-MtCisaSpoVerificationCodeReauth.Tests.ps1 | 47 ++++++++++ tests/cisa/exchange/Test.CISA.MS.EXO.11.3.md | 20 +---- tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 | 66 ++------------ tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md | 10 +-- tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 | 50 +++++------ tests/cisa/exchange/Test.CISA.MS.EXO.8.3.md | 12 +-- tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 | 7 +- tests/cisa/exchange/Test.CISA.MS.EXO.9.2.md | 20 +---- tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 | 12 +-- tests/cisa/exchange/Test.CISA.MS.EXO.9.4.md | 21 +---- tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 | 16 ++-- .../sharepoint/Test.CISA.MS.SHAREPOINT.3.3.md | 3 +- .../Test.CISA.MS.SHAREPOINT.3.3.ps1 | 10 ++- 15 files changed, 238 insertions(+), 176 deletions(-) create mode 100644 powershell/tests/functions/Test-MtCisaDeprecatedExchange.Tests.ps1 create mode 100644 powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 create mode 100644 powershell/tests/functions/Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 diff --git a/powershell/tests/functions/Test-MtCisaDeprecatedExchange.Tests.ps1 b/powershell/tests/functions/Test-MtCisaDeprecatedExchange.Tests.ps1 new file mode 100644 index 0000000000..49e54e6e49 --- /dev/null +++ b/powershell/tests/functions/Test-MtCisaDeprecatedExchange.Tests.ps1 @@ -0,0 +1,34 @@ +BeforeAll { + . "$PSScriptRoot/../helpers/Use-MtModuleFunction.ps1" + Use-MtModuleFunction -Name @( + 'Test-MtCisaDlpAlternate', + 'Test-MtCheckCISAMSEXO92', + 'Test-MtCisaEmailFilterAlternative', + 'Test-MtCisaMailboxIntelligence' + ) +} + +Describe 'Deprecated CISA Exchange checks' { + BeforeEach { + $script:SkippedBecause = $null + $script:SkippedCustomReason = $null + + Mock -ModuleName Maester Add-MtTestResultDetail { + param($SkippedBecause, $SkippedCustomReason) + + $script:SkippedBecause = $SkippedBecause + $script:SkippedCustomReason = $SkippedCustomReason + } + } + + It ' skips the retired control' -ForEach @( + @{ CheckName = 'Test-MtCisaDlpAlternate' } + @{ CheckName = 'Test-MtCheckCISAMSEXO92' } + @{ CheckName = 'Test-MtCisaEmailFilterAlternative' } + @{ CheckName = 'Test-MtCisaMailboxIntelligence' } + ) { + & $CheckName | Should -BeNull + $script:SkippedBecause | Should -Be 'Custom' + $script:SkippedCustomReason | Should -Match 'removed' + } +} diff --git a/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 b/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 new file mode 100644 index 0000000000..ebe80a829b --- /dev/null +++ b/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 @@ -0,0 +1,86 @@ +BeforeAll { + . "$PSScriptRoot/../helpers/Use-MtModuleFunction.ps1" + Use-MtModuleFunction -Name Test-MtCisaSpfDirective + + function New-TestSpfRecord { + param( + [string] $Mechanism, + [string] $Qualifier = '?', + [string] $Modifier = '' + ) + + return [pscustomobject]@{ + spfRecord = [pscustomobject]@{ + terms = @( + [pscustomobject]@{ + mechanism = $Mechanism + qualifier = $Qualifier + modifier = $Modifier + mechanismTarget = '' + directive = '' + } + ) + } + spfLookups = @() + } + } +} + +Describe 'Test-MtCisaSpfDirective' { + BeforeEach { + $script:TestSpfRecord = $null + $script:TestResultMarkdown = $null + $script:SkippedBecause = $null + $script:IsCoexistenceDomain = $false + + Mock -ModuleName Maester Get-MtExo { + return @([pscustomobject]@{ + DomainName = 'example.gov' + SendingFromDomainDisabled = $false + IsCoexistenceDomain = $script:IsCoexistenceDomain + }) + } + Mock -ModuleName Maester Get-MailAuthenticationRecord { return $script:TestSpfRecord } + Mock -ModuleName Maester Add-MtTestResultDetail { + param($Result, $SkippedBecause) + + $script:TestResultMarkdown = $Result + $script:SkippedBecause = $SkippedBecause + } + } + + It 'passes hard-fail and soft-fail mechanisms without requiring an Exchange Online include' -ForEach @( + @{ Qualifier = '-' } + @{ Qualifier = '~' } + ) { + $script:TestSpfRecord = New-TestSpfRecord -Mechanism 'all' -Qualifier $Qualifier + + Test-MtCisaSpfDirective | Should -BeTrue + $script:TestResultMarkdown | Should -Match 'Fail-all mechanism' + } + + It 'fails when the SPF all mechanism does not fail unapproved senders' -ForEach @( + @{ Qualifier = '+' } + @{ Qualifier = '?' } + ) { + $script:TestSpfRecord = New-TestSpfRecord -Mechanism 'all' -Qualifier $Qualifier + + Test-MtCisaSpfDirective | Should -BeFalse + $script:TestResultMarkdown | Should -Match 'No -all, ~all, or redirect mechanism' + } + + It 'accepts a redirect modifier' { + $script:TestSpfRecord = New-TestSpfRecord -Mechanism '' -Modifier 'redirect' + + Test-MtCisaSpfDirective | Should -BeTrue + $script:TestResultMarkdown | Should -Match 'Redirect modifier' + } + + It 'skips coexistence domains even when the SPF record would otherwise pass' { + $script:IsCoexistenceDomain = $true + $script:TestSpfRecord = New-TestSpfRecord -Mechanism 'all' -Qualifier '-' + + Test-MtCisaSpfDirective | Should -BeNull + $script:SkippedBecause | Should -Be 'NotSupported' + } +} diff --git a/powershell/tests/functions/Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 b/powershell/tests/functions/Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 new file mode 100644 index 0000000000..36bc8378c7 --- /dev/null +++ b/powershell/tests/functions/Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 @@ -0,0 +1,47 @@ +BeforeAll { + . "$PSScriptRoot/../helpers/Use-MtModuleFunction.ps1" + Use-MtModuleFunction -Name Test-MtCisaSpoVerificationCodeReauth +} + +Describe 'Test-MtCisaSpoVerificationCodeReauth' { + BeforeEach { + $script:SpoTenant = $null + $script:TestResultMarkdown = $null + $script:SkippedBecause = $null + + Mock -ModuleName Maester Get-MtSpo { return $script:SpoTenant } + Mock -ModuleName Maester Add-MtTestResultDetail { + param($Result, $SkippedBecause) + + $script:TestResultMarkdown = $Result + $script:SkippedBecause = $SkippedBecause + } + } + + It 'evaluates reauthentication for sharing' -ForEach @( + @{ SharingCapability = 'ExternalUserAndGuestSharing' } + @{ SharingCapability = 'ExternalUserSharingOnly' } + @{ SharingCapability = 'ExistingExternalUserSharingOnly' } + ) { + $script:SpoTenant = [pscustomobject]@{ + SharingCapability = $SharingCapability + EmailAttestationRequired = $false + EmailAttestationReAuthDays = 45 + } + + Test-MtCisaSpoVerificationCodeReauth | Should -BeFalse + $script:SkippedBecause | Should -BeNullOrEmpty + $script:TestResultMarkdown | Should -Match 'not properly configured' + } + + It 'marks organization-only sharing as not applicable' { + $script:SpoTenant = [pscustomobject]@{ + SharingCapability = 'Disabled' + EmailAttestationRequired = $false + EmailAttestationReAuthDays = 90 + } + + Test-MtCisaSpoVerificationCodeReauth | Should -BeNull + $script:SkippedBecause | Should -Be 'NotApplicable' + } +} diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.md b/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.md index 33146c0d51..6b5e2528c3 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.md +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.md @@ -1,24 +1,8 @@ -The phishing protection solution SHOULD include an AI-based phishing detection tool comparable to EOP Mailbox Intelligence. - -Rationale: Phishing attacks can result in unauthorized data disclosure and unauthorized access. Using AI-based phishing detection tools to improve the detection rate of phishing attempts helps reduce the risk of successful phishing attacks. - -#### Remediation action - -1. Sign in to **Microsoft 365 Defender**. -2. In the left-hand menu, go to **Email & Collaboration** > **Policies & Rules**. -3. Select **Threat Policies**. -4. From the **Templated policies** section, select **Preset Security Policies**. -5. Under **Standard protection**, slide the toggle switch to the right so the text next to the toggle reads **Standard protection is on**. -6. Under **Strict protection**, slide the toggle switch to the right so the text next to the toggle reads **Strict protection is on**. - -Note: If the toggle slider in step 5 is grayed out, click on **Manage protection settings** instead and configure the policy settings according to [Use the Microsoft 365 Defender portal to assign Standard and Strict preset security policies to users | Microsoft Learn](https://learn.microsoft.com/microsoft-365/security/office-365-security/preset-security-policies?view=o365-worldwide#use-the-microsoft-365-defender-portal-to-assign-standard-and-strict-preset-security-policies-to-users). +This legacy check is retained for compatibility with existing result history. CISA removed `MS.EXO.11.3` from the SCuBA baseline in April 2026 as part of the Security Suite baseline consolidation. Maester marks it deprecated and skips it; it does not assess a current CISA requirement. #### Related links -* [Defender admin center - Preset security policies](https://security.microsoft.com/presetSecurityPolicies) -* [CISA 11 Phishing Protections - MS.EXO.11.3v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/exo.md#msexo113v1) -* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/EXOConfig.rego#L647) -* [Microsoft Learn - Mailbox intelligence impersonation protection](https://learn.microsoft.com/defender-office-365/anti-phishing-policies-about#mailbox-intelligence-impersonation-protection) +* [ScubaGear removed policies - MS.EXO.11.3v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/removedpolicies.md#msexo113v1) %TestResult% diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 index 95ef399eb7..be0b41498f 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 @@ -1,10 +1,10 @@ function Test-MtCisaMailboxIntelligence { <# .SYNOPSIS - Checks state of preset security policies + This retired CISA requirement is no longer assessed. .DESCRIPTION - The phishing protection solution SHOULD include an AI-based phishing detection tool comparable to EOP Mailbox Intelligence. + CISA removed this requirement from the SCuBA baseline in April 2026. .EXAMPLE Test-MtCisaMailboxIntelligence @@ -27,68 +27,14 @@ ImplementationCost = 'Low', Mitre = 'T1566', Control = 'cisa-scuba:MS.EXO.11.3', - Service = ('ExchangeOnline', 'Graph'), - License = 'ATP_ENTERPRISE', + Service = 'None', + Lifecycle = 'Deprecated', Author = 'soulemike' )] [CmdletBinding()] [OutputType([bool])] param() - $policies = Get-MtExo -Request AntiPhishPolicy - - $resultPolicies = $policies | Where-Object { ` - $_.Enabled -and ` - $_.EnableMailboxIntelligence -and ` - $_.EnableMailboxIntelligenceProtection - } - - $standard = $policies | Where-Object { ` - $_.RecommendedPolicyType -eq "Standard" - } - - $strict = $policies | Where-Object { ` - $_.RecommendedPolicyType -eq "Strict" - } - - $testResult = $standard -and $strict -and (($resultPolicies|Measure-Object).Count -ge 1) - - $portalLink = "https://security.microsoft.com/presetSecurityPolicies" - $passResult = "✅ Pass" - $failResult = "❌ Fail" - - if ($testResult) { - $testResultMarkdown = "Well done. Your tenant has [standard and strict preset security policies for the common file filter]($portalLink).`n`n%TestResult%" - } else { - $testResultMarkdown = "Your tenant does not have [standard and strict preset security policies enabled]($portalLink).`n`n%TestResult%" - } - - $result = "| Policy | Status |`n" - $result += "| --- | --- |`n" - if ($standard) { - $result += "| Standard | $passResult |`n" - } else { - $result += "| Standard | $failResult |`n" - } - if ($strict) { - $result += "| Strict | $passResult |`n`n" - } else { - $result += "| Strict | $failResult |`n`n" - } - - $result += "| Policy Name | Result |`n" - $result += "| --- | --- |`n" - foreach($item in $policies | Sort-Object -Property Identity){ - if($item.Guid -in $resultPolicies.Guid){ - $result += "| $($item.Identity) | $($passResult) |`n" - }else{ - $result += "| $($item.Identity) | $($failResult) |`n" - } - } - - $testResultMarkdown = $testResultMarkdown -replace "%TestResult%", $result - - Add-MtTestResultDetail -Result $testResultMarkdown - - return $testResult + Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "CISA removed MS.EXO.11.3 from the SCuBA baseline in April 2026. This legacy check is no longer assessed." + return $null } diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md index e93baa91f2..dac8053976 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md @@ -1,6 +1,6 @@ -An SPF policy SHALL be published for each domain, designating only these addresses as approved senders. +An SPF policy SHALL be published for each sending domain that fails non-approved senders. -Rationale: An adversary may modify the `FROM` field of an email such that it appears to be a legitimate email sent by an agency, facilitating phishing attacks. Publishing an SPF policy for each agency domain mitigates forged `FROM` fields by providing a means for recipients to detect emails spoofed in this way. SPF is required for FCEB departments and agencies by Binding Operational Directive (BOD) 18-01, "Enhance Email and Web Security". +Rationale: An adversary may modify the `FROM` field of an email such that it appears to be a legitimate email sent by an agency, facilitating phishing attacks. Publishing an SPF policy for each agency domain mitigates forged `FROM` fields by providing a means for recipients to detect emails spoofed in this way. SPF is required for FCEB departments and agencies by Binding Operational Directive (BOD) 18-01, "Enhance Email and Web Security". SCuBA accepts either a hard fail (`-all`) or soft fail (`~all`) mechanism; a redirect modifier is also accepted as in ScubaGear. Coexistence domains related to Hybrid Configuration Wizard (HCW) are skipped. Production use of coexistence domains is discouraged, and additional controls, such as transport rules, should be used to restrict their use. @@ -13,13 +13,13 @@ To test your SPF configuration, consider using a web-based tool, such as those l `Resolve-DnsName example.onmicrosoft.com txt` -If SPF is configured, you will see a response resembling `v=spf1 include:spf.protection.outlook.com -all` returned; though by necessity, the contents of the SPF policy may vary by agency. In this example, the SPF policy indicates the IP addresses listed by the policy for "spf.protection.outlook.com" are the only approved senders for "example.onmicrosoft.com." These IPs can be determined via an additional SPF lookup, this time for "spf.protection.outlook.com." Ensure the IP addresses listed as approved senders for your domain are those identified for MS.EXO.2.1v1. [See SPF TXT record syntax for Microsoft 365 | Microsoft Learn](https://learn.microsoft.com/microsoft-365/security/office-365-security/email-authentication-anti-spoofing?view=o365-worldwide#spf-txt-record-syntax-for-microsoft-365) for a more in-depth discussion of SPF record syntax. +If SPF is configured, you will see a response resembling `v=spf1 include:spf.protection.outlook.com -all`; the contents of the policy may vary by agency. This check verifies that each sending domain has an SPF policy that ends in a fail-all mechanism (`-all` or `~all`) or delegates through a redirect modifier. It does not validate that the individual sender addresses are authorized. See [SPF TXT record syntax for Microsoft 365 | Microsoft Learn](https://learn.microsoft.com/microsoft-365/security/office-365-security/email-authentication-anti-spoofing?view=o365-worldwide#spf-txt-record-syntax-for-microsoft-365) for more information. #### Related links * [Exchange admin center - Accepted domains](https://admin.exchange.microsoft.com/#/accepteddomains) -* [CISA 2 Sender Policy Framework - MS.EXO.2.2v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/exo.md#msexo22v1) -* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/EXOConfig.rego#L75) +* [CISA 2 Sender Policy Framework - MS.EXO.2.2v3](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/exo.md#msexo22v3) +* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/EXOConfig.rego#L145) %TestResult% diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 index 65f90c13b3..b69092718d 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 @@ -4,12 +4,12 @@ Checks state of SPF records for all exo domains .DESCRIPTION - An SPF policy SHALL be published for each domain, designating only these addresses as approved senders. + An SPF policy SHALL be published for each sending domain, and fail or redirect non-approved senders. .EXAMPLE Test-MtCisaSpfDirective - Returns true if SPF record exists and has at least one directive + Returns true if each sending domain has an SPF fail-all mechanism or redirect modifier .LINK https://maester.dev/docs/commands/Test-MtCisaSpfDirective @@ -45,29 +45,29 @@ $spfRecord | Add-Member -MemberType NoteProperty -Name "pass" -Value "Failed" -ErrorAction Ignore $spfRecord | Add-Member -MemberType NoteProperty -Name "reason" -Value "" -ErrorAction Ignore - $directives = ($spfRecord.spfLookups | Where-Object {$_.Include}).SPFSourceDomain | Select-Object -Unique + $terms = @($spfRecord.spfRecord.terms) + $hasFailAll = @($terms | Where-Object { + $_.mechanism -eq 'all' -and $_.qualifier -in @('-', '~') + }).Count -gt 0 + $hasRedirect = @($terms | Where-Object { $_.modifier -eq 'redirect' }).Count -gt 0 - $check = "spf.protection.outlook.com" -in $directives -or "outlook.com" -in $directives - - if(($directives|Measure-Object).Count -ge 1 -and $check){ - $spfRecord.pass = "Passed" - $spfRecord.reason = "1+ mechanism targets" - }elseif($domain.IsCoexistenceDomain){ + if ($domain.IsCoexistenceDomain) { $spfRecord.pass = "Skipped" $spfRecord.reason = "coexistence domain" - }elseif(($directives|Measure-Object).Count -ge 1 -and -not $check){ - $spfRecord.reason = "No Exchange Online directive" - }elseif($spfRecord.spfRecord -like "*not available"){ + } + elseif ($hasFailAll -or $hasRedirect) { + $spfRecord.pass = "Passed" + $spfRecord.reason = if ($hasFailAll) { 'Fail-all mechanism' } else { 'Redirect modifier' } + } + elseif ($spfRecord.spfRecord -is [string] -and $spfRecord.spfRecord -like "*not available") { $spfRecord.pass = "Skipped" $spfRecord.reason = $spfRecord.spfRecord - }elseif($spfRecord.spfRecord.GetType().Name -eq "SPFRecord"){ - if($spfRecord.spfRecord.terms[-1].modifier -eq "redirect"){ - $spfRecord.pass = "Skipped" - $spfRecord.reason = "Redirect modifier" - } - }else{ - #$spfRecord.reason = "No mechanism targets" - $spfRecord.reason = "Failure to obtain record" + } + elseif ($spfRecord.spfRecord -is [string]) { + $spfRecord.reason = $spfRecord.spfRecord + } + else { + $spfRecord.reason = "No -all, ~all, or redirect mechanism" } #Hacky sort, doesn't handle IPv6 @@ -81,17 +81,19 @@ if("Failed" -in $spfRecords.pass){ $testResult = $false - }elseif("Failed" -notin $spfRecords.pass -and "Passed" -notin $spfRecords.pass){ + } + elseif ("Failed" -notin $spfRecords.pass -and "Passed" -notin $spfRecords.pass) { Add-MtTestResultDetail -SkippedBecause NotSupported return $null - }else{ + } + else { $testResult = $true } if($testResult){ - $testResultMarkdown = "Well done. Your tenant's domains have at least 1 directives with specific mechanism targets, review authorized senders for accuracy.`n`n%TestResult%" + $testResultMarkdown = "Well done. All sending domains have an SPF policy that fails or redirects non-approved senders.`n`n%TestResult%" }else{ - $testResultMarkdown = "Not all Exchange Online accepted domains designate Exchange Online as approved sender.`n`n%TestResult%" + $testResultMarkdown = "One or more sending domains do not have an SPF policy that fails or redirects non-approved senders.`n`n%TestResult%" } $passResult = "✅ Pass" diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.md b/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.md index e60534e58f..95c0de79fc 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.md +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.md @@ -1,14 +1,8 @@ -The selected DLP solution SHOULD offer services comparable to the native DLP solution offered by Microsoft. - -Rationale: Any alternative DLP solution should be able to detect sensitive information in Exchange Online and block access to unauthorized entities. - -> This test will always skip by default. +This legacy check is retained for compatibility with existing result history. CISA removed `MS.EXO.8.3` from the SCuBA baseline in April 2026, so Maester marks it deprecated and skips it; it does not assess a current CISA requirement. #### Related links -* [Purview admin center - Data loss prevention policies](https://purview.microsoft.com/datalossprevention/policies) -* [CISA 8 Data Loss Prevention Solutions - MS.EXO.8.3](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/exo.md#msexo83v1) -* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/EXOConfig.rego#L453) +* [ScubaGear removed policies - MS.EXO.8.3v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/removedpolicies.md#msexo83v1) -%TestResult% \ No newline at end of file +%TestResult% diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 index c931a3ea54..21b3b14ee2 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 @@ -1,10 +1,10 @@ function Test-MtCisaDlpAlternate { <# .SYNOPSIS - This will always return $null + This retired CISA requirement is no longer assessed. .DESCRIPTION - The selected DLP solution SHOULD offer services comparable to the native DLP solution offered by Microsoft. + CISA removed this requirement from the SCuBA baseline in April 2026. .EXAMPLE Test-MtCisaDlpAlternate @@ -28,12 +28,13 @@ Mitre = ('T1213', 'T1530', 'T1567'), Control = 'cisa-scuba:MS.EXO.8.3', Service = 'None', + Lifecycle = 'Deprecated', Author = 'soulemike' )] [CmdletBinding()] [OutputType([bool])] param() - Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "Unable to validate 3rd party solutions." + Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "CISA removed MS.EXO.8.3 from the SCuBA baseline in April 2026. This legacy check is no longer assessed." return $null } diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.md b/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.md index ac27d7807f..9368ddbdfb 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.md +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.md @@ -1,24 +1,8 @@ -The attachment filter SHOULD attempt to determine the true file type and assess the file extension. - -Rationale: Users can change a file extension at the end of a file name (e.g., notepad.exe to notepad.txt) to obscure the actual file type. Verifying the file type and checking that this matches the designated file extension can help detect instances where the file extension was changed. - -#### Remediation action - -1. Sign in to **Microsoft 365 Defender**. -2. In the left-hand menu, go to **Email & Collaboration** > **Policies & Rules**. -3. Select **Threat Policies**. -4. From the **Templated policies** section, select [**Preset Security Policies**](https://security.microsoft.com/presetSecurityPolicies). -5. Under **Standard protection**, slide the toggle switch to the right so the text next to the toggle reads **Standard protection is on**. -6. Under **Strict protection**, slide the toggle switch to the right so the text next to the toggle reads **Strict protection is on**. - -Note: If the toggle slider in step 5 is grayed out, click on **Manage protection settings** instead and configure the policy settings according to [Use the Microsoft 365 Defender portal to assign Standard and Strict preset security policies to users | Microsoft Learn](https://learn.microsoft.com/microsoft-365/security/office-365-security/preset-security-policies?view=o365-worldwide#use-the-microsoft-365-defender-portal-to-assign-standard-and-strict-preset-security-policies-to-users). +This legacy check is retained for compatibility with existing result history. CISA removed `MS.EXO.9.2` from the SCuBA baseline in April 2026 because Defender could not configure and assess the requirement. Maester marks it deprecated and skips it; it does not assess a current CISA requirement. #### Related links -* [Defender admin center - Preset security policies](https://security.microsoft.com/presetSecurityPolicies) -* [CISA 9 Attachment File Type - MS.EXO.9.2v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/exo.md#msexo92v1) -* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/EXOConfig.rego#L502) -* [Microsoft Learn - True type matching in the common attachments filter](https://learn.microsoft.com/defender-office-365/anti-malware-protection-about#true-type-matching-in-the-common-attachments-filter) +* [ScubaGear removed policies - MS.EXO.9.2v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/removedpolicies.md#msexo92v1) %TestResult% diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 index a194a17e40..d9ad33ddb6 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 @@ -1,10 +1,10 @@ function Test-MtCheckCISAMSEXO92 { <# .SYNOPSIS - The attachment filter SHOULD attempt to determine the true file type and assess the file extension. + This retired CISA requirement is no longer assessed. .DESCRIPTION - Runs the shared check Test-MtCisaAttachmentFileType. + CISA removed this requirement from the SCuBA baseline in April 2026. #> [MaesterTest( Id = 'CISA.MS.EXO.9.2', @@ -19,14 +19,14 @@ ImplementationCost = 'Low', Mitre = ('T1036.008', 'T1204.002', 'T1566.001'), Control = 'cisa-scuba:MS.EXO.9.2', - Service = 'ExchangeOnline', + Service = 'None', + Lifecycle = 'Deprecated', Author = 'soulemike' )] [CmdletBinding()] [OutputType([bool])] param() - $result = Test-MtCisaAttachmentFileType - if ($null -eq $result) { return $null } - return $result + Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "CISA removed MS.EXO.9.2 from the SCuBA baseline in April 2026 because it could not be configured through Defender and assessed by ScubaGear. This legacy check is no longer assessed." + return $null } diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.md b/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.md index 8fa2112bd2..cbdbe8704e 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.md +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.md @@ -1,25 +1,8 @@ -Alternatively chosen filtering solutions SHOULD offer services comparable to Microsoft Defender's Common Attachment Filter. - -Rationale: Malicious attachments often take the form of click-to-run files. Sharing high risk file types, when necessary, is better left to a means other than email; the dangers of allowing them to be sent over email outweigh any potential benefits. Filtering email attachments based on file types can prevent spread of malware distributed via click-to-run email attachments. - -> Note: This test will always result in a skip result. - -#### Remediation action - -1. Sign in to **Microsoft 365 Defender**. -2. In the left-hand menu, go to **Email & Collaboration** > **Policies & Rules**. -3. Select **Threat Policies**. -4. From the **Templated policies** section, select **Preset Security Policies**. -5. Under **Standard protection**, slide the toggle switch to the right so the text next to the toggle reads **Standard protection is on**. -6. Under **Strict protection**, slide the toggle switch to the right so the text next to the toggle reads **Strict protection is on**. - -Note: If the toggle slider in step 5 is grayed out, click on **Manage protection settings** instead and configure the policy settings according to [Use the Microsoft 365 Defender portal to assign Standard and Strict preset security policies to users | Microsoft Learn](https://learn.microsoft.com/microsoft-365/security/office-365-security/preset-security-policies?view=o365-worldwide#use-the-microsoft-365-defender-portal-to-assign-standard-and-strict-preset-security-policies-to-users). +This legacy check is retained for compatibility with existing result history. CISA removed `MS.EXO.9.4` from the SCuBA baseline in April 2026 as part of the Security Suite baseline consolidation. Maester marks it deprecated and skips it; it does not assess a current CISA requirement. #### Related links -* [Defender admin center - Preset security policies](https://security.microsoft.com/presetSecurityPolicies) -* [CISA 9 Attachment File Type - MS.EXO.9.4v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/exo.md#msexo94v1) -* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/EXOConfig.rego#L532) +* [ScubaGear removed policies - MS.EXO.9.4v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/removedpolicies.md#msexo94v1) %TestResult% diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 index 9a14217258..c9fddfeaa4 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 @@ -1,10 +1,10 @@ function Test-MtCisaEmailFilterAlternative { <# .SYNOPSIS - Placeholder + This retired CISA requirement is no longer assessed. .DESCRIPTION - Alternatively chosen filtering solutions SHOULD offer services comparable to Microsoft Defender's Common Attachment Filter. + CISA removed this requirement from the SCuBA baseline in April 2026. .EXAMPLE Test-MtCisaEmailFilterAlternative @@ -27,7 +27,8 @@ ImplementationCost = 'Low', Mitre = ('T1204.002', 'T1566.001'), Control = 'cisa-scuba:MS.EXO.9.4', - Service = 'Graph', + Service = 'None', + Lifecycle = 'Deprecated', Author = 'soulemike', Contributor = ('thomas-s-schmidt', 'SamErde') )] @@ -35,11 +36,6 @@ [OutputType([bool])] param() - if ('Eop' -in (Get-MtLicenseInformation -Product Eop) -or 'Eop' -in (Get-MtLicenseInformation -Product MdoV2)) { - Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "Tenant is licensed for Exchange Online Protection; an alternative mail filter is not needed." - return $null - } else { - Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "Tenant is not licensed for Exchange Online Protection and there is no implementation to check for alternate mail filters available." - return $null - } + Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "CISA removed MS.EXO.9.4 from the SCuBA baseline in April 2026. This legacy check is no longer assessed." + return $null } diff --git a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.md b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.md index 74ebfb122c..49892dbd13 100644 --- a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.md +++ b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.md @@ -13,7 +13,8 @@ Rationale: Requiring periodic reauthentication via verification codes ensures th #### Related links * [CISA 3 Verification Code Reauth - MS.SHAREPOINT.3.3v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint33v1) -* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/SharepointConfig.rego) +* [CISA SCuBA baseline - MS.SHAREPOINT.3.3v2](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint33v2) +* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/SharepointConfig.rego#L477) %TestResult% diff --git a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 index 71abd1dcfc..25689ffcf0 100644 --- a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 +++ b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 @@ -35,9 +35,13 @@ $spoTenant = Get-MtSpo - # Only applicable when sharing allows external users: ExternalUserSharingOnly (1) or ExternalUserAndGuestSharing (2) - if ($spoTenant.SharingCapability -notin @("ExternalUserSharingOnly", "ExternalUserAndGuestSharing")) { - Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "External sharing does not allow new or anonymous guests. Verification code reauthentication is not applicable." + # SCuBA applies this policy when sharing is Anyone, New and existing guests, or Existing guests. + if ($spoTenant.SharingCapability -notin @( + "ExternalUserAndGuestSharing", + "ExternalUserSharingOnly", + "ExistingExternalUserSharingOnly" + )) { + Add-MtTestResultDetail -SkippedBecause NotApplicable return $null } From 679e1b1384be73805e0985c2d1065af80410bba3 Mon Sep 17 00:00:00 2001 From: Jeremy Finney Date: Tue, 10 Nov 2026 11:25:43 +1300 Subject: [PATCH 02/12] fix(cisa): correct test helper and retired check help Use a non-state-changing verb for the SPF test helper and document that the withdrawn EXO.11.3 check returns null and is skipped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../tests/functions/Test-MtCisaSpfDirective.Tests.ps1 | 10 +++++----- tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 b/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 index ebe80a829b..4cdcf45ecb 100644 --- a/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 +++ b/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 @@ -2,7 +2,7 @@ . "$PSScriptRoot/../helpers/Use-MtModuleFunction.ps1" Use-MtModuleFunction -Name Test-MtCisaSpfDirective - function New-TestSpfRecord { + function Get-TestSpfRecord { param( [string] $Mechanism, [string] $Qualifier = '?', @@ -53,7 +53,7 @@ Describe 'Test-MtCisaSpfDirective' { @{ Qualifier = '-' } @{ Qualifier = '~' } ) { - $script:TestSpfRecord = New-TestSpfRecord -Mechanism 'all' -Qualifier $Qualifier + $script:TestSpfRecord = Get-TestSpfRecord -Mechanism 'all' -Qualifier $Qualifier Test-MtCisaSpfDirective | Should -BeTrue $script:TestResultMarkdown | Should -Match 'Fail-all mechanism' @@ -63,14 +63,14 @@ Describe 'Test-MtCisaSpfDirective' { @{ Qualifier = '+' } @{ Qualifier = '?' } ) { - $script:TestSpfRecord = New-TestSpfRecord -Mechanism 'all' -Qualifier $Qualifier + $script:TestSpfRecord = Get-TestSpfRecord -Mechanism 'all' -Qualifier $Qualifier Test-MtCisaSpfDirective | Should -BeFalse $script:TestResultMarkdown | Should -Match 'No -all, ~all, or redirect mechanism' } It 'accepts a redirect modifier' { - $script:TestSpfRecord = New-TestSpfRecord -Mechanism '' -Modifier 'redirect' + $script:TestSpfRecord = Get-TestSpfRecord -Mechanism '' -Modifier 'redirect' Test-MtCisaSpfDirective | Should -BeTrue $script:TestResultMarkdown | Should -Match 'Redirect modifier' @@ -78,7 +78,7 @@ Describe 'Test-MtCisaSpfDirective' { It 'skips coexistence domains even when the SPF record would otherwise pass' { $script:IsCoexistenceDomain = $true - $script:TestSpfRecord = New-TestSpfRecord -Mechanism 'all' -Qualifier '-' + $script:TestSpfRecord = Get-TestSpfRecord -Mechanism 'all' -Qualifier '-' Test-MtCisaSpfDirective | Should -BeNull $script:SkippedBecause | Should -Be 'NotSupported' diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 index be0b41498f..6ff80bb2c4 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 @@ -9,7 +9,7 @@ .EXAMPLE Test-MtCisaMailboxIntelligence - Returns true if standard and strict protection is on + Returns $null because this deprecated check is skipped; CISA removed the requirement from SCuBA. .LINK https://maester.dev/docs/commands/Test-MtCisaMailboxIntelligence From c45cbcaa2bef4693a2bb0d454567b978c9c47305 Mon Sep 17 00:00:00 2001 From: Jeremy Finney Date: Tue, 10 Nov 2026 15:37:04 +1300 Subject: [PATCH 03/12] test(cisa): drop the licence gate expectation for retired EXO 11.3 MS.EXO.11.3 no longer declares a licence because it is skipped as retired upstream, so NativeLicenseGates no longer expects one. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- powershell/tests/functions/engine/NativeLicenseGates.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powershell/tests/functions/engine/NativeLicenseGates.Tests.ps1 b/powershell/tests/functions/engine/NativeLicenseGates.Tests.ps1 index 586d84a1c2..2d755385cf 100644 --- a/powershell/tests/functions/engine/NativeLicenseGates.Tests.ps1 +++ b/powershell/tests/functions/engine/NativeLicenseGates.Tests.ps1 @@ -15,7 +15,7 @@ 'CISA.MS.AAD.3.5' = $p1; 'CISA.MS.AAD.3.6' = $p1; 'CISA.MS.AAD.3.7' = $p1; 'CISA.MS.AAD.3.8' = $p1; 'CISA.MS.AAD.4.1' = $p1 'CISA.MS.AAD.2.1' = $p2; 'CISA.MS.AAD.2.2' = $p2; 'CISA.MS.AAD.2.3' = $p2 'CISA.MS.AAD.7.4' = $p2OrGovernance; 'CISA.MS.AAD.7.5' = $p2OrGovernance; 'CISA.MS.AAD.7.6' = $p2OrGovernance; 'CISA.MS.AAD.7.7' = $p2OrGovernance - 'CISA.MS.EXO.11.1' = $mdoP1; 'CISA.MS.EXO.11.2' = $mdoP1; 'CISA.MS.EXO.11.3' = $mdoP1; 'CISA.MS.EXO.15.1' = $mdoP1 + 'CISA.MS.EXO.11.1' = $mdoP1; 'CISA.MS.EXO.11.2' = $mdoP1; 'CISA.MS.EXO.15.1' = $mdoP1 'CISA.MS.EXO.15.2' = $mdoP1; 'CISA.MS.EXO.15.3' = $mdoP1; 'CISA.MS.EXO.16.1' = $mdoP1; 'CISA.MS.EXO.16.2' = $mdoP1 'CISA.MS.EXO.17.3' = @{ License = @('M365_ADVANCED_AUDITING'); Legacy = 'NotLicensedAdvAudit' } 'CISA.MS.EXO.8.1' = $exoDlp; 'CISA.MS.EXO.8.2' = $exoDlp; 'CISA.MS.EXO.8.4' = $exoDlp From 6e6d1b1d7ea058d2212f355351687d65c87a4898 Mon Sep 17 00:00:00 2001 From: Jeremy Finney Date: Wed, 11 Nov 2026 09:20:29 +1300 Subject: [PATCH 04/12] fix(cisa): handle PIM licence errors and align assessment results Skip PIM API licence rejections without masking other errors, clarify Authenticator software OTP requirements, and guard missing SharePoint reauthentication periods. Retain SCuBA SPF scope and heuristic wording with regression coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Test-MtCisaActivationNotification.ps1 | 10 +- ...-MtRoleActivationNotificationRecipient.ps1 | 2 +- .../Test-MtCisaAuthenticatorContext.Tests.ps1 | 58 ++++++ .../functions/Test-MtCisaPimLicense.Tests.ps1 | 182 ++++++++++++++++++ .../Test-MtCisaSpfDirective.Tests.ps1 | 42 ++-- ...-MtCisaSpoVerificationCodeReauth.Tests.ps1 | 22 +++ tests/cisa/entra/Test.CISA.MS.AAD.3.3.md | 6 +- tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 | 10 +- tests/cisa/entra/Test.CISA.MS.AAD.7.4.md | 2 + tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 | 12 +- tests/cisa/entra/Test.CISA.MS.AAD.7.5.md | 2 + tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 | 14 +- tests/cisa/entra/Test.CISA.MS.AAD.7.6.md | 2 + tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 | 10 +- tests/cisa/entra/Test.CISA.MS.AAD.7.7.md | 2 + tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 | 10 +- tests/cisa/entra/Test.CISA.MS.AAD.7.8.md | 2 + tests/cisa/entra/Test.CISA.MS.AAD.7.9.md | 2 + tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md | 7 +- tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 | 24 +-- .../Test.CISA.MS.SHAREPOINT.3.3.ps1 | 4 +- 21 files changed, 375 insertions(+), 50 deletions(-) create mode 100644 powershell/tests/functions/Test-MtCisaAuthenticatorContext.Tests.ps1 create mode 100644 powershell/tests/functions/Test-MtCisaPimLicense.Tests.ps1 diff --git a/powershell/internal/checks/cisa/entra/Test-MtCisaActivationNotification.ps1 b/powershell/internal/checks/cisa/entra/Test-MtCisaActivationNotification.ps1 index 451ab07cfb..14939165ad 100644 --- a/powershell/internal/checks/cisa/entra/Test-MtCisaActivationNotification.ps1 +++ b/powershell/internal/checks/cisa/entra/Test-MtCisaActivationNotification.ps1 @@ -52,7 +52,15 @@ role = $role.displayName activationNotify = $false } - $recipients = @(Get-MtRoleActivationNotificationRecipient -RoleDefinitionId $role.id) + try { + $recipients = @(Get-MtRoleActivationNotificationRecipient -RoleDefinitionId $role.id -ErrorAction Stop) + } catch { + if ($_.ErrorDetails.Message -match '"code"\s*:\s*"AadPremiumLicenseRequired"') { + Add-MtTestResultDetail -SkippedBecause NotLicensedEntraIDP2OrGovernance + return $null + } + throw + } $rolePolicy.activationNotify = $recipients.Count -gt 0 $rolePolicies += $rolePolicy diff --git a/powershell/internal/services/entra/Get-MtRoleActivationNotificationRecipient.ps1 b/powershell/internal/services/entra/Get-MtRoleActivationNotificationRecipient.ps1 index f44b72e249..9588f6d590 100644 --- a/powershell/internal/services/entra/Get-MtRoleActivationNotificationRecipient.ps1 +++ b/powershell/internal/services/entra/Get-MtRoleActivationNotificationRecipient.ps1 @@ -28,7 +28,7 @@ Filter = "scopeId eq '/' and scopeType eq 'DirectoryRole' and roleDefinitionId eq '$RoleDefinitionId'" QueryParameters = @{ expand = 'policy(expand=rules)' } } - $assignment = Invoke-MtGraphRequest @policySplat + $assignment = Invoke-MtGraphRequest @policySplat -ErrorAction Stop $rule = @($assignment.policy.rules) | Where-Object { $_.id -eq 'Notification_Admin_EndUser_Assignment' } | Select-Object -First 1 return [string[]]@($rule.notificationRecipients | Where-Object { $_ }) } diff --git a/powershell/tests/functions/Test-MtCisaAuthenticatorContext.Tests.ps1 b/powershell/tests/functions/Test-MtCisaAuthenticatorContext.Tests.ps1 new file mode 100644 index 0000000000..4c91af2d16 --- /dev/null +++ b/powershell/tests/functions/Test-MtCisaAuthenticatorContext.Tests.ps1 @@ -0,0 +1,58 @@ +BeforeAll { + . "$PSScriptRoot/../helpers/Use-MtModuleFunction.ps1" + Use-MtModuleFunction -Name Test-MtCisaAuthenticatorContext +} + +Describe 'CISA Microsoft Authenticator context and software OTP' { + BeforeEach { + $script:ResultMarkdown = $null + $script:AuthenticatorPolicy = [pscustomobject]@{ + id = 'MicrosoftAuthenticator' + state = 'enabled' + includeTargets = @(@{ id = 'all_users' }) + isSoftwareOathEnabled = $false + featureSettings = @{ + displayAppInformationRequiredState = @{ state = 'enabled'; includeTarget = @{ id = 'all_users' } } + displayLocationInformationRequiredState = @{ state = 'enabled'; includeTarget = @{ id = 'all_users' } } + } + } + Mock -ModuleName Maester Get-MtAuthenticationMethodPolicyConfig { + @( + $script:AuthenticatorPolicy + [pscustomobject]@{ id = 'Email'; state = 'enabled' } + ) + } + Mock -ModuleName Maester Add-MtTestResultDetail { + param($Result) + $script:ResultMarkdown = $Result + } + } + + It 'passes with Authenticator software OTP disabled even when Email OTP is enabled' { + Test-MtCisaAuthenticatorContext | Should -BeTrue + $script:ResultMarkdown | Should -Match 'software OTP \(not Email OTP\) disabled' + } + + It 'fails with Authenticator software OTP enabled despite both context settings being enabled' { + $script:AuthenticatorPolicy.isSoftwareOathEnabled = $true + + Test-MtCisaAuthenticatorContext | Should -BeFalse + $script:ResultMarkdown | Should -Match '\| Microsoft Authenticator software OTP \(not Email OTP\) disabled \| ❌ Fail \|' + } + + It 'does not label missing Authenticator software OTP data as passing' { + $script:AuthenticatorPolicy.isSoftwareOathEnabled = $null + + Test-MtCisaAuthenticatorContext | Should -BeFalse + $script:ResultMarkdown | Should -Match '\| Microsoft Authenticator software OTP \(not Email OTP\) disabled \| ❌ Fail \|' + } + + It 'still fails when application or location context is disabled' -ForEach @( + @{ Setting = 'displayAppInformationRequiredState' } + @{ Setting = 'displayLocationInformationRequiredState' } + ) { + $script:AuthenticatorPolicy.featureSettings[$Setting].state = 'disabled' + + Test-MtCisaAuthenticatorContext | Should -BeFalse + } +} diff --git a/powershell/tests/functions/Test-MtCisaPimLicense.Tests.ps1 b/powershell/tests/functions/Test-MtCisaPimLicense.Tests.ps1 new file mode 100644 index 0000000000..91adad0af8 --- /dev/null +++ b/powershell/tests/functions/Test-MtCisaPimLicense.Tests.ps1 @@ -0,0 +1,182 @@ +BeforeAll { + . "$PSScriptRoot/../helpers/Use-MtModuleFunction.ps1" + Use-MtModuleFunction -Name @( + 'Test-MtCisaPermanentRoleAssignment', + 'Test-MtCisaUnmanagedRoleAssignment', + 'Test-MtCisaRequireActivationApproval', + 'Test-MtCisaAssignmentNotification', + 'Test-MtCheckCISAMSAAD78', + 'Test-MtCheckCISAMSAAD79' + ) + + function Get-TestPimErrorRecord { + param([string] $Code) + + $record = [System.Management.Automation.ErrorRecord]::new( + [System.Exception]::new('Response status code does not indicate success: 400 (Bad Request).'), + 'InvokeGraphHttpResponseException', + [System.Management.Automation.ErrorCategory]::InvalidOperation, + $null + ) + $record.ErrorDetails = [System.Management.Automation.ErrorDetails]::new( + "{`"error`":{`"code`":`"$Code`",`"message`":`"PIM request rejected.`"}}" + ) + return $record + } +} + +Describe 'CISA PIM API licence rejection: ' -ForEach @( + @{ CheckName = 'Test-MtCisaPermanentRoleAssignment' } + @{ CheckName = 'Test-MtCisaUnmanagedRoleAssignment' } + @{ CheckName = 'Test-MtCisaRequireActivationApproval' } + @{ CheckName = 'Test-MtCisaAssignmentNotification' } + @{ CheckName = 'Test-MtCheckCISAMSAAD78' } + @{ CheckName = 'Test-MtCheckCISAMSAAD79' } +) { + BeforeEach { + $script:SkippedBecause = $null + $script:Compliant = $true + Mock -ModuleName Maester Get-MtLicenseInformation { 'P2' } + Mock -ModuleName Maester Get-MtRole { + @( + [pscustomobject]@{ id = '62e90394-69f5-4237-9190-012177145e10'; displayName = 'Global Administrator' } + [pscustomobject]@{ id = '194ae4cb-b126-40b2-bd5b-6091b380977d'; displayName = 'Security Administrator' } + ) + } + Mock -ModuleName Maester Add-MtTestResultDetail { + param($SkippedBecause) + $script:SkippedBecause = $SkippedBecause + } + Mock -ModuleName Maester Invoke-MtGraphRequest { + if ($RelativeUri -eq 'roleManagement/directory/roleAssignmentSchedules') { + return [pscustomobject]@{ + createdUsing = if ($script:Compliant) { 'request-1' } else { $null } + scheduleInfo = @{ + startDateTime = if ($script:Compliant) { '2026-01-01T00:00:00Z' } else { $null } + expiration = @{ type = if ($script:Compliant) { 'afterDateTime' } else { 'noExpiration' } } + } + principal = [pscustomobject]@{ + id = 'user-1' + displayName = 'Test user' + '@odata.type' = '#microsoft.graph.user' + } + } + } + return [pscustomobject]@{ + policy = @{ + rules = @( + [pscustomobject]@{ + '@odata.type' = '#microsoft.graph.unifiedRoleManagementPolicyApprovalRule' + setting = @{ isApprovalRequired = $script:Compliant } + } + foreach ($id in @( + 'Notification_Admin_Admin_Eligibility', + 'Notification_Admin_Admin_Assignment', + 'Notification_Admin_EndUser_Assignment' + )) { + [pscustomobject]@{ + id = $id + notificationRecipients = if ($script:Compliant) { @('monitor@example.com') } else { @() } + } + } + ) + } + } + } + } + + It 'skips instead of returning a verdict when the API rejects the licence' { + Mock -ModuleName Maester Invoke-MtGraphRequest { + throw (Get-TestPimErrorRecord -Code 'AadPremiumLicenseRequired') + } + + & $CheckName | Should -BeNullOrEmpty + $script:SkippedBecause | Should -Be 'NotLicensedEntraIDP2OrGovernance' + Should -Invoke Invoke-MtGraphRequest -ModuleName Maester -Exactly 1 + } + + It 'requests terminating API errors before interpreting PIM data' { + Mock -ModuleName Maester Invoke-MtGraphRequest { + param($ErrorAction) + + Write-Error -ErrorRecord (Get-TestPimErrorRecord -Code 'AadPremiumLicenseRequired') -ErrorAction $ErrorAction + } + + & $CheckName | Should -BeNullOrEmpty + $script:SkippedBecause | Should -Be 'NotLicensedEntraIDP2OrGovernance' + Should -Invoke Invoke-MtGraphRequest -ModuleName Maester -Exactly 1 -ParameterFilter { $ErrorAction -eq 'Stop' } + } + + It 'propagates instead of treating it as a licence skip' -ForEach @( + @{ Code = 'Authorization_RequestDenied' } + @{ Code = 'InternalServerError' } + ) { + Mock -ModuleName Maester Invoke-MtGraphRequest { + throw (Get-TestPimErrorRecord -Code $Code) + } + + { & $CheckName } | Should -Throw -ErrorId 'InvokeGraphHttpResponseException' + $script:SkippedBecause | Should -BeNullOrEmpty + } + + It 'preserves a passing verdict for compliant PIM data' { + & $CheckName | Should -BeTrue + $script:SkippedBecause | Should -BeNullOrEmpty + } + + It 'preserves a failing verdict for noncompliant PIM data' { + $script:Compliant = $false + + & $CheckName | Should -BeFalse + $script:SkippedBecause | Should -BeNullOrEmpty + } +} + +Describe 'CISA PIM native-engine outcome: ' -ForEach @( + @{ Id = 'CISA.MS.AAD.7.4' } + @{ Id = 'CISA.MS.AAD.7.5' } + @{ Id = 'CISA.MS.AAD.7.6' } + @{ Id = 'CISA.MS.AAD.7.7' } + @{ Id = 'CISA.MS.AAD.7.8' } + @{ Id = 'CISA.MS.AAD.7.9' } +) { + BeforeEach { + Mock -ModuleName Maester Test-MtConnection { $true } + Mock -ModuleName Maester Get-MgContext { $null } + Mock -ModuleName Maester Get-MtLicenseInformation { 'P2' } + Mock -ModuleName Maester Get-MtRole { + @( + [pscustomobject]@{ id = '62e90394-69f5-4237-9190-012177145e10'; displayName = 'Global Administrator' } + [pscustomobject]@{ id = '194ae4cb-b126-40b2-bd5b-6091b380977d'; displayName = 'Security Administrator' } + ) + } + $config = [pscustomobject]@{ + Environment = [pscustomobject]@{ + Licenses = @('AAD_PREMIUM_P2') + Services = [pscustomobject]@{ Graph = $true } + } + } + } + + It 'reports a licence rejection as Skipped, not Passed, Failed or Error' { + Mock -ModuleName Maester Invoke-MtGraphRequest { + throw (Get-TestPimErrorRecord -Code 'AadPremiumLicenseRequired') + } + + $row = Invoke-MtTest -Id $Id -Config $config + + $row.Result | Should -Be 'Skipped' + $row.ResultDetail.TestSkipped | Should -Be 'NotLicensedEntraIDP2OrGovernance' + } + + It 'reports permission failures as Error, not a licence skip' { + Mock -ModuleName Maester Invoke-MtGraphRequest { + throw (Get-TestPimErrorRecord -Code 'Authorization_RequestDenied') + } + + $row = Invoke-MtTest -Id $Id -Config $config + + $row.Result | Should -Be 'Error' + $row.ReasonCode | Should -Be 'TestError' + } +} diff --git a/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 b/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 index 4cdcf45ecb..a0a0afe04e 100644 --- a/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 +++ b/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 @@ -10,6 +10,7 @@ ) return [pscustomobject]@{ + domain = 'example.gov' spfRecord = [pscustomobject]@{ terms = @( [pscustomobject]@{ @@ -31,14 +32,16 @@ Describe 'Test-MtCisaSpfDirective' { $script:TestSpfRecord = $null $script:TestResultMarkdown = $null $script:SkippedBecause = $null - $script:IsCoexistenceDomain = $false - - Mock -ModuleName Maester Get-MtExo { - return @([pscustomobject]@{ + $script:AcceptedDomains = @( + [pscustomobject]@{ DomainName = 'example.gov' SendingFromDomainDisabled = $false - IsCoexistenceDomain = $script:IsCoexistenceDomain - }) + IsCoexistenceDomain = $false + } + ) + + Mock -ModuleName Maester Get-MtExo { + return $script:AcceptedDomains } Mock -ModuleName Maester Get-MailAuthenticationRecord { return $script:TestSpfRecord } Mock -ModuleName Maester Add-MtTestResultDetail { @@ -76,11 +79,28 @@ Describe 'Test-MtCisaSpfDirective' { $script:TestResultMarkdown | Should -Match 'Redirect modifier' } - It 'skips coexistence domains even when the SPF record would otherwise pass' { - $script:IsCoexistenceDomain = $true - $script:TestSpfRecord = Get-TestSpfRecord -Mechanism 'all' -Qualifier '-' + It 'evaluates accepted domains even when sending is disabled or the domain is marked as coexistence' { + $script:AcceptedDomains = @( + [pscustomobject]@{ + DomainName = 'coexistence.example.gov' + SendingFromDomainDisabled = $true + IsCoexistenceDomain = $true + } + ) + $script:TestSpfRecord = Get-TestSpfRecord -Mechanism 'all' -Qualifier '+' + $script:TestSpfRecord.domain = 'coexistence.example.gov' + + Test-MtCisaSpfDirective | Should -BeFalse + $script:SkippedBecause | Should -BeNullOrEmpty + $script:TestResultMarkdown | Should -Match 'coexistence.example.gov' + } + + It 'describes the redirect check as a heuristic that requires review' { + $script:TestSpfRecord = Get-TestSpfRecord -Mechanism 'all' -Qualifier '+' -Modifier 'redirect' - Test-MtCisaSpfDirective | Should -BeNull - $script:SkippedBecause | Should -Be 'NotSupported' + Test-MtCisaSpfDirective | Should -BeTrue + $script:TestResultMarkdown | Should -Match 'passed this heuristic' + $script:TestResultMarkdown | Should -Match 'Review the policies' + $script:TestResultMarkdown | Should -Not -Match 'Well done' } } diff --git a/powershell/tests/functions/Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 b/powershell/tests/functions/Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 index 36bc8378c7..86701e4538 100644 --- a/powershell/tests/functions/Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 +++ b/powershell/tests/functions/Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 @@ -44,4 +44,26 @@ Describe 'Test-MtCisaSpoVerificationCodeReauth' { Test-MtCisaSpoVerificationCodeReauth | Should -BeNull $script:SkippedBecause | Should -Be 'NotApplicable' } + + It 'fails when the reauthentication period is missing' { + $script:SpoTenant = [pscustomobject]@{ + SharingCapability = 'ExternalUserAndGuestSharing' + EmailAttestationRequired = $true + EmailAttestationReAuthDays = $null + } + + Test-MtCisaSpoVerificationCodeReauth | Should -BeFalse + $script:SkippedBecause | Should -BeNullOrEmpty + $script:TestResultMarkdown | Should -Match 'not properly configured' + } + + It 'applies the SCuBA upper-bound condition to a zero-day value' { + $script:SpoTenant = [pscustomobject]@{ + SharingCapability = 'ExternalUserAndGuestSharing' + EmailAttestationRequired = $true + EmailAttestationReAuthDays = 0 + } + + Test-MtCisaSpoVerificationCodeReauth | Should -BeTrue + } } diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.3.3.md b/tests/cisa/entra/Test.CISA.MS.AAD.3.3.md index 1b2f34205f..c6c7a6dbbd 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.3.3.md +++ b/tests/cisa/entra/Test.CISA.MS.AAD.3.3.md @@ -1,7 +1,11 @@ -If Microsoft Authenticator is enabled, it SHALL be configured to show login context information. +If Microsoft Authenticator is enabled, it SHALL show login context information with Authenticator OTP disabled. Rationale: This policy helps protect the tenant when Microsoft Authenticator is used by showing user context information, which helps reduce MFA phishing compromises. +The SCuBA MS.AAD.3.3v2 implementation instructions also require **Allow use of Microsoft Authenticator OTP** to be **No**, and ScubaGear checks `isSoftwareOathEnabled = false`. Authenticator software OATH codes do not display the application and location context shown in push and passwordless notifications, so leaving this option enabled fails this check even when both context settings are enabled. + +This is **Microsoft Authenticator software OTP**, not **Email OTP** or the separate **Software OATH tokens** authentication method. Email OTP is assessed separately by `CISA.MS.AAD.3.5`; this check does not assess its state. + #### Remediation action: If Microsoft Authenticator is in use, configure Authenticator to display context information to users when they log in. diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 index 63f5c9a7ce..b80e9a68b4 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 @@ -4,7 +4,7 @@ Checks if the Authentication Methods policy for Microsoft Authenticator is set appropriately .DESCRIPTION - If Microsoft Authenticator is enabled, it SHALL be configured to show login context information. + If Microsoft Authenticator is enabled, it SHALL show login context information with Authenticator OTP disabled. .EXAMPLE Test-MtCisaAuthenticatorContext @@ -16,7 +16,7 @@ #> [MaesterTest( Id = 'CISA.MS.AAD.3.3', - Title = 'If Microsoft Authenticator is enabled, it SHALL be configured to show login context information.', + Title = 'If Microsoft Authenticator is enabled, it SHALL show login context information with Authenticator OTP disabled.', Product = 'entra', Feature = 'authentication-methods', Area = 'authentication', @@ -57,7 +57,7 @@ $resultPass = "✅ Pass" if ($testResult) { - $testResultMarkdown = "Well done. Your tenant has the [Authentication Methods]($link) policy for Microsoft Authenticator set appropriately.`n`n" + $testResultMarkdown = "Well done. The [Microsoft Authenticator policy]($link) displays application and location context for all users with Authenticator software OTP disabled.`n`n" } else { $testResultMarkdown = "Your tenant does not have the [Authentication Methods]($link) policy for Microsoft Authenticator set appropriately or migration to Authentication Methods is not complete.`n`n" } @@ -65,7 +65,7 @@ $checks = @{ MethodEnabled = if($authenticatorPolicy.state -eq "enabled"){$resultPass}else{$resultFail} MethodTarget = if($authenticatorPolicy.includeTargets.Id -contains "all_users"){$resultPass}else{$resultFail} - OtpDisabled = if(-not $authenticatorPolicy.isSoftwareOathEnabled){$resultPass}else{$resultFail} + OtpDisabled = if($authenticatorPolicy.isSoftwareOathEnabled -eq $false){$resultPass}else{$resultFail} ContextEnabled = if($authenticatorPolicy.featureSettings.displayAppInformationRequiredState.state -eq "enabled"){$resultPass}else{$resultFail} ContextTarget = if($authenticatorPolicy.featureSettings.displayAppInformationRequiredState.includeTarget.id -contains "all_users"){$resultPass}else{$resultFail} LocationEnabled = if($authenticatorPolicy.featureSettings.displayLocationInformationRequiredState.state -eq "enabled"){$resultPass}else{$resultFail} @@ -76,7 +76,7 @@ $testResultMarkdown += "| --- | --- |`n" $testResultMarkdown += "| Microsoft Authenticator state | $($checks.MethodEnabled) |`n" $testResultMarkdown += "| Included Targets | $($checks.MethodTarget) |`n" - $testResultMarkdown += "| Allow use of Microsoft Authenticator OTP set to *No* | $($checks.OtpDisabled) |`n" + $testResultMarkdown += "| Microsoft Authenticator software OTP (not Email OTP) disabled | $($checks.OtpDisabled) |`n" $testResultMarkdown += "| Show application name in push and passwordless notifications status | $($checks.ContextEnabled) | `n" $testResultMarkdown += "| Show application name in push and passwordless notifications included target | $($checks.ContextTarget) | `n" $testResultMarkdown += "| Show geographic location in push and passwordless notifications status | $($checks.LocationEnabled) | `n" diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.4.md b/tests/cisa/entra/Test.CISA.MS.AAD.7.4.md index 6393846480..bc21726388 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.4.md +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.4.md @@ -9,6 +9,8 @@ Note: Exceptions to this policy are: #### Remediation action +This assessment requires access to the Entra PIM API. If the API returns `AadPremiumLicenseRequired`, Maester skips the check with `NotLicensedEntraIDP2OrGovernance`, even if the tenant's service plans list a qualifying licence. A skip is not evidence that the requirement is satisfied; other API errors are not treated as licence skips. + 1. In **Entra admin center** select **Show more** and **Roles & Admins** and then **[All roles](https://entra.microsoft.com/#view/Microsoft_AAD_IAM/RolesManagementMenuBlade/~/AllRoles)**. Perform the steps below for each highly privileged role. We reference the Global Administrator role as an example. diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 index b4d00783a4..4ef01dba7a 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 @@ -52,8 +52,16 @@ expand = "principal" } } - $assignments = Invoke-MtGraphRequest @assignmentsSplat | Where-Object {` - $_.scheduleInfo.expiration.type -eq "noExpiration" } + try { + $assignments = Invoke-MtGraphRequest @assignmentsSplat -ErrorAction Stop | Where-Object {` + $_.scheduleInfo.expiration.type -eq "noExpiration" } + } catch { + if ($_.ErrorDetails.Message -match '"code"\s*:\s*"AadPremiumLicenseRequired"') { + Add-MtTestResultDetail -SkippedBecause NotLicensedEntraIDP2OrGovernance + return $null + } + throw + } $roleAssignment.principal = $assignments.principal diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.5.md b/tests/cisa/entra/Test.CISA.MS.AAD.7.5.md index 0edcbdef0d..1dc94ab2df 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.5.md +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.5.md @@ -4,6 +4,8 @@ Rationale: Provisioning users to privileged roles within a PAM system enables en #### Remediation action +This assessment requires access to the Entra PIM API. If the API returns `AadPremiumLicenseRequired`, Maester skips the check with `NotLicensedEntraIDP2OrGovernance`, even if the tenant's service plans list a qualifying licence. A skip is not evidence that the requirement is satisfied; other API errors are not treated as licence skips. + 1. In **Entra admin center** select **Show more** > **Roles & admins** and then select **[All roles](https://entra.microsoft.com/#view/Microsoft_AAD_IAM/RolesManagementMenuBlade/~/AllRoles)**. Perform the steps below for each highly privileged role. We reference the **Global Administrator** role as an example. diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 index 5e000307e5..97cb67e178 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 @@ -52,9 +52,17 @@ expand = "principal" } } - $assignments = Invoke-MtGraphRequest @assignmentsSplat | Where-Object {` - $null -eq $_.createdUsing -or ` - $null -eq $_.scheduleInfo.startDateTime } + try { + $assignments = Invoke-MtGraphRequest @assignmentsSplat -ErrorAction Stop | Where-Object {` + $null -eq $_.createdUsing -or ` + $null -eq $_.scheduleInfo.startDateTime } + } catch { + if ($_.ErrorDetails.Message -match '"code"\s*:\s*"AadPremiumLicenseRequired"') { + Add-MtTestResultDetail -SkippedBecause NotLicensedEntraIDP2OrGovernance + return $null + } + throw + } $roleAssignment.principal = $assignments.principal diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.6.md b/tests/cisa/entra/Test.CISA.MS.AAD.7.6.md index c8e5232362..73af86dd0c 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.6.md +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.6.md @@ -4,6 +4,8 @@ Rationale: Requiring approval for a user to activate Global Administrator, which #### Remediation action: +This assessment requires access to the Entra PIM API. If the API returns `AadPremiumLicenseRequired`, Maester skips the check with `NotLicensedEntraIDP2OrGovernance`, even if the tenant's service plans list a qualifying licence. A skip is not evidence that the requirement is satisfied; other API errors are not treated as licence skips. + 1. In **Entra admin center** select **Identity governance** and **Privileged Identity Management**. 2. Under **Manage**, select **Microsoft Entra roles**. 3. Under **Manage**, select **[Roles](https://entra.microsoft.com/#view/Microsoft_Azure_PIMCommon/ResourceMenuBlade/~/roles/resourceId//resourceType/tenant/provider/aadroles)**. diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 index a50b83610d..3600375d59 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 @@ -46,7 +46,15 @@ expand = "policy(expand=rules)" } } - $policy = Invoke-MtGraphRequest @policySplat + try { + $policy = Invoke-MtGraphRequest @policySplat -ErrorAction Stop + } catch { + if ($_.ErrorDetails.Message -match '"code"\s*:\s*"AadPremiumLicenseRequired"') { + Add-MtTestResultDetail -SkippedBecause NotLicensedEntraIDP2OrGovernance + return $null + } + throw + } $testResult = ($policy.policy.rules | Where-Object {` $_.'@odata.type' -eq "#microsoft.graph.unifiedRoleManagementPolicyApprovalRule" diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.7.md b/tests/cisa/entra/Test.CISA.MS.AAD.7.7.md index a52dd1da2d..fe678b886e 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.7.md +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.7.md @@ -4,6 +4,8 @@ Rationale: Closely monitor assignment of the highest privileged roles for signs #### Remediation action: +This assessment requires access to the Entra PIM API. If the API returns `AadPremiumLicenseRequired`, Maester skips the check with `NotLicensedEntraIDP2OrGovernance`, even if the tenant's service plans list a qualifying licence. A skip is not evidence that the requirement is satisfied; other API errors are not treated as licence skips. + 1. In **Entra admin center** select **Identity governance** and **Privileged Identity Management**. 2. Under **Manage**, select **Microsoft Entra roles**. 3. Under **Manage**, select **[Roles](https://entra.microsoft.com/#view/Microsoft_Azure_PIMCommon/ResourceMenuBlade/~/roles/resourceId//resourceType/tenant/provider/aadroles)**. diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 index f6c6f0e5ff..f700cd6190 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 @@ -52,7 +52,15 @@ expand = "policy(expand=rules)" } } - $policy = Invoke-MtGraphRequest @policySplat + try { + $policy = Invoke-MtGraphRequest @policySplat -ErrorAction Stop + } catch { + if ($_.ErrorDetails.Message -match '"code"\s*:\s*"AadPremiumLicenseRequired"') { + Add-MtTestResultDetail -SkippedBecause NotLicensedEntraIDP2OrGovernance + return $null + } + throw + } $eligibleNotify = $policy.policy.rules | Where-Object {` $_.id -eq "Notification_Admin_Admin_Eligibility" -and ` diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.8.md b/tests/cisa/entra/Test.CISA.MS.AAD.7.8.md index 3eec35e112..5edcd56604 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.8.md +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.8.md @@ -8,6 +8,8 @@ Rationale: Closely monitor activation of high-risk roles for signs of compromise #### Remediation action: +This assessment requires access to the Entra PIM API. If the API returns `AadPremiumLicenseRequired`, Maester skips the check with `NotLicensedEntraIDP2OrGovernance`, even if the tenant's service plans list a qualifying licence. A skip is not evidence that the requirement is satisfied; other API errors are not treated as licence skips. + 1. In **Entra admin center** select **Identity governance** and **Privileged Identity Management**. 2. Under **Manage**, select **Microsoft Entra roles**. 3. Under **Manage**, select **[Roles](https://entra.microsoft.com/#view/Microsoft_Azure_PIMCommon/ResourceMenuBlade/~/roles/resourceId//resourceType/tenant/provider/aadroles)**. diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.9.md b/tests/cisa/entra/Test.CISA.MS.AAD.7.9.md index 3eec35e112..5edcd56604 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.9.md +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.9.md @@ -8,6 +8,8 @@ Rationale: Closely monitor activation of high-risk roles for signs of compromise #### Remediation action: +This assessment requires access to the Entra PIM API. If the API returns `AadPremiumLicenseRequired`, Maester skips the check with `NotLicensedEntraIDP2OrGovernance`, even if the tenant's service plans list a qualifying licence. A skip is not evidence that the requirement is satisfied; other API errors are not treated as licence skips. + 1. In **Entra admin center** select **Identity governance** and **Privileged Identity Management**. 2. Under **Manage**, select **Microsoft Entra roles**. 3. Under **Manage**, select **[Roles](https://entra.microsoft.com/#view/Microsoft_Azure_PIMCommon/ResourceMenuBlade/~/roles/resourceId//resourceType/tenant/provider/aadroles)**. diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md index dac8053976..53e177e025 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md @@ -1,9 +1,8 @@ -An SPF policy SHALL be published for each sending domain that fails non-approved senders. +An SPF policy SHALL be published for each accepted domain that fails all non-approved senders. Rationale: An adversary may modify the `FROM` field of an email such that it appears to be a legitimate email sent by an agency, facilitating phishing attacks. Publishing an SPF policy for each agency domain mitigates forged `FROM` fields by providing a means for recipients to detect emails spoofed in this way. SPF is required for FCEB departments and agencies by Binding Operational Directive (BOD) 18-01, "Enhance Email and Web Security". SCuBA accepts either a hard fail (`-all`) or soft fail (`~all`) mechanism; a redirect modifier is also accepted as in ScubaGear. -Coexistence domains related to Hybrid Configuration Wizard (HCW) are skipped. -Production use of coexistence domains is discouraged, and additional controls, such as transport rules, should be used to restrict their use. +This check evaluates every accepted domain, including coexistence domains, to match the SCuBA evaluation scope. #### Remediation action @@ -13,7 +12,7 @@ To test your SPF configuration, consider using a web-based tool, such as those l `Resolve-DnsName example.onmicrosoft.com txt` -If SPF is configured, you will see a response resembling `v=spf1 include:spf.protection.outlook.com -all`; the contents of the policy may vary by agency. This check verifies that each sending domain has an SPF policy that ends in a fail-all mechanism (`-all` or `~all`) or delegates through a redirect modifier. It does not validate that the individual sender addresses are authorized. See [SPF TXT record syntax for Microsoft 365 | Microsoft Learn](https://learn.microsoft.com/microsoft-365/security/office-365-security/email-authentication-anti-spoofing?view=o365-worldwide#spf-txt-record-syntax-for-microsoft-365) for more information. +If SPF is configured, you will see a response resembling `v=spf1 include:spf.protection.outlook.com -all`; the contents of the policy may vary by agency. This check applies the SCuBA heuristic to each accepted domain: the parsed SPF record must contain a `-all` or `~all` mechanism, or a redirect modifier. A passing result is not proof that the redirect target rejects all non-approved senders, and the check does not validate individual sender addresses; review the reported records. See [SPF TXT record syntax for Microsoft 365 | Microsoft Learn](https://learn.microsoft.com/microsoft-365/security/office-365-security/email-authentication-anti-spoofing?view=o365-worldwide#spf-txt-record-syntax-for-microsoft-365) for more information. #### Related links diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 index b69092718d..bb508aa5f6 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 @@ -16,7 +16,7 @@ #> [MaesterTest( Id = 'CISA.MS.EXO.2.2', - Title = 'An SPF policy SHALL be published for each domain, designating only these addresses as approved senders.', + Title = 'An SPF policy SHALL be published for each domain that fails all non-approved senders.', Product = 'exchange', Feature = 'email-authentication', Area = 'email-protection', @@ -35,12 +35,8 @@ param() $acceptedDomains = Get-MtExo -Request AcceptedDomain - $sendingDomains = $acceptedDomains | Where-Object {` - -not $_.SendingFromDomainDisabled - } - $spfRecords = @() - foreach($domain in $sendingDomains){ + foreach($domain in $acceptedDomains){ $spfRecord = Get-MailAuthenticationRecord -DomainName $domain.DomainName -Records SPF $spfRecord | Add-Member -MemberType NoteProperty -Name "pass" -Value "Failed" -ErrorAction Ignore $spfRecord | Add-Member -MemberType NoteProperty -Name "reason" -Value "" -ErrorAction Ignore @@ -51,18 +47,10 @@ }).Count -gt 0 $hasRedirect = @($terms | Where-Object { $_.modifier -eq 'redirect' }).Count -gt 0 - if ($domain.IsCoexistenceDomain) { - $spfRecord.pass = "Skipped" - $spfRecord.reason = "coexistence domain" - } - elseif ($hasFailAll -or $hasRedirect) { + if ($hasFailAll -or $hasRedirect) { $spfRecord.pass = "Passed" $spfRecord.reason = if ($hasFailAll) { 'Fail-all mechanism' } else { 'Redirect modifier' } } - elseif ($spfRecord.spfRecord -is [string] -and $spfRecord.spfRecord -like "*not available") { - $spfRecord.pass = "Skipped" - $spfRecord.reason = $spfRecord.spfRecord - } elseif ($spfRecord.spfRecord -is [string]) { $spfRecord.reason = $spfRecord.spfRecord } @@ -91,20 +79,18 @@ } if($testResult){ - $testResultMarkdown = "Well done. All sending domains have an SPF policy that fails or redirects non-approved senders.`n`n%TestResult%" + $testResultMarkdown = "The SCuBA SPF check passed this heuristic: each accepted domain has a fail-all mechanism or redirect modifier. Review the policies to confirm that non-approved senders do not pass SPF.`n`n%TestResult%" }else{ - $testResultMarkdown = "One or more sending domains do not have an SPF policy that fails or redirects non-approved senders.`n`n%TestResult%" + $testResultMarkdown = "One or more accepted domains do not have a parsed fail-all mechanism or redirect modifier in the SPF policy.`n`n%TestResult%" } $passResult = "✅ Pass" $failResult = "❌ Fail" - $skipResult = "🗄️ Skip" $result = "| Domain | Result | Reason | Directives |`n" $result += "| --- | --- | --- | --- |`n" foreach ($item in $spfRecords | Sort-Object -Property domain) { switch($item.pass){ "Passed" {$itemResult = $passResult} - "Skipped" {$itemResult = $skipResult} "Failed" {$itemResult = $failResult} } $itemDirectives = ($item.spfRecord.terms|Where-Object {` diff --git a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 index 25689ffcf0..6f8cccea0b 100644 --- a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 +++ b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 @@ -48,7 +48,9 @@ # EmailAttestationRequired: $true = verification code required, $false = not required # EmailAttestationReAuthDays: number of days before reauthentication is required # CISA requires <= 30 days - $testResult = $spoTenant.EmailAttestationRequired -eq $true -and $spoTenant.EmailAttestationReAuthDays -le 30 + $testResult = $spoTenant.EmailAttestationRequired -eq $true -and + $null -ne $spoTenant.EmailAttestationReAuthDays -and + $spoTenant.EmailAttestationReAuthDays -le 30 if ($testResult) { $testResultMarkdown = "Well done. Verification code reauthentication is required every $($spoTenant.EmailAttestationReAuthDays) day(s)." From 657e1e7917c9f398d50c56c7625b9f9f98a05ed9 Mon Sep 17 00:00:00 2001 From: Jeremy Finney Date: Wed, 11 Nov 2026 09:29:29 +1300 Subject: [PATCH 05/12] test(cisa): make shared PIM fixture scope explicit Use an explicitly scoped fixture across Pester BeforeEach and It blocks so the unused-variable analyzer can recognize its usage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- powershell/tests/functions/Test-MtCisaPimLicense.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/powershell/tests/functions/Test-MtCisaPimLicense.Tests.ps1 b/powershell/tests/functions/Test-MtCisaPimLicense.Tests.ps1 index 91adad0af8..6ae5387a86 100644 --- a/powershell/tests/functions/Test-MtCisaPimLicense.Tests.ps1 +++ b/powershell/tests/functions/Test-MtCisaPimLicense.Tests.ps1 @@ -150,7 +150,7 @@ Describe 'CISA PIM native-engine outcome: ' -ForEach @( [pscustomobject]@{ id = '194ae4cb-b126-40b2-bd5b-6091b380977d'; displayName = 'Security Administrator' } ) } - $config = [pscustomobject]@{ + $script:PimConfig = [pscustomobject]@{ Environment = [pscustomobject]@{ Licenses = @('AAD_PREMIUM_P2') Services = [pscustomobject]@{ Graph = $true } @@ -163,7 +163,7 @@ Describe 'CISA PIM native-engine outcome: ' -ForEach @( throw (Get-TestPimErrorRecord -Code 'AadPremiumLicenseRequired') } - $row = Invoke-MtTest -Id $Id -Config $config + $row = Invoke-MtTest -Id $Id -Config $script:PimConfig $row.Result | Should -Be 'Skipped' $row.ResultDetail.TestSkipped | Should -Be 'NotLicensedEntraIDP2OrGovernance' @@ -174,7 +174,7 @@ Describe 'CISA PIM native-engine outcome: ' -ForEach @( throw (Get-TestPimErrorRecord -Code 'Authorization_RequestDenied') } - $row = Invoke-MtTest -Id $Id -Config $config + $row = Invoke-MtTest -Id $Id -Config $script:PimConfig $row.Result | Should -Be 'Error' $row.ReasonCode | Should -Be 'TestError' From d242e773ed212674bd22c40866e179cbc17ab639 Mon Sep 17 00:00:00 2001 From: Jeremy Finney Date: Wed, 11 Nov 2026 12:20:01 +1300 Subject: [PATCH 06/12] updated contributor information --- tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 | 2 +- tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 | 2 +- tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 | 2 +- tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 | 2 +- tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 | 2 +- tests/cisa/entra/Test.CISA.MS.AAD.7.8.ps1 | 2 +- tests/cisa/entra/Test.CISA.MS.AAD.7.9.ps1 | 2 +- tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 | 3 ++- tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 | 2 +- tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 | 3 ++- tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 | 3 ++- tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 | 2 +- tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 | 3 ++- 13 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 index b80e9a68b4..da0cbce967 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.3.3.ps1 @@ -29,7 +29,7 @@ Service = 'Graph', License = 'AAD_PREMIUM', Author = 'soulemike', - Contributor = 'thomas-s-schmidt' + Contributor = ('thomas-s-schmidt', 'JeremyFinney-lgtm') )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 index 4ef01dba7a..aa383bd4eb 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.4.ps1 @@ -29,7 +29,7 @@ Service = 'Graph', License = ('AAD_PREMIUM_P2', 'Entra_Identity_Governance'), Author = 'soulemike', - Contributor = ('michaelmsonne', 'JeanPhilippeGeorge') + Contributor = ('michaelmsonne', 'JeanPhilippeGeorge', 'JeremyFinney-lgtm') )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 index 97cb67e178..ccc28bcf23 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.5.ps1 @@ -29,7 +29,7 @@ Service = 'Graph', License = ('AAD_PREMIUM_P2', 'Entra_Identity_Governance'), Author = 'soulemike', - Contributor = 'michaelmsonne' + Contributor = ('michaelmsonne', 'JeremyFinney-lgtm') )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 index 3600375d59..064e1e992e 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.6.ps1 @@ -29,7 +29,7 @@ Service = 'Graph', License = ('AAD_PREMIUM_P2', 'Entra_Identity_Governance'), Author = 'soulemike', - Contributor = ('ThorNicolai', 'JeanPhilippeGeorge') + Contributor = ('ThorNicolai', 'JeanPhilippeGeorge', 'JeremyFinney-lgtm') )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 index f700cd6190..bde1732247 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.7.ps1 @@ -29,7 +29,7 @@ Service = 'Graph', License = ('AAD_PREMIUM_P2', 'Entra_Identity_Governance'), Author = 'soulemike', - Contributor = ('michaelmsonne', 'JeanPhilippeGeorge') + Contributor = ('michaelmsonne', 'JeanPhilippeGeorge', 'JeremyFinney-lgtm') )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.8.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.8.ps1 index baef2c0654..7d20db158c 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.8.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.8.ps1 @@ -20,7 +20,7 @@ Control = 'cisa-scuba:MS.AAD.7.8', Service = 'Graph', Author = 'soulemike', - Contributor = ('michaelmsonne', 'JeanPhilippeGeorge') + Contributor = ('michaelmsonne', 'JeanPhilippeGeorge', 'JeremyFinney-lgtm') )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/entra/Test.CISA.MS.AAD.7.9.ps1 b/tests/cisa/entra/Test.CISA.MS.AAD.7.9.ps1 index 3188fcd596..2c2d3da56d 100644 --- a/tests/cisa/entra/Test.CISA.MS.AAD.7.9.ps1 +++ b/tests/cisa/entra/Test.CISA.MS.AAD.7.9.ps1 @@ -20,7 +20,7 @@ Control = 'cisa-scuba:MS.AAD.7.9', Service = 'Graph', Author = 'soulemike', - Contributor = ('michaelmsonne', 'JeanPhilippeGeorge') + Contributor = ('michaelmsonne', 'JeanPhilippeGeorge', 'JeremyFinney-lgtm') )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 index 6ff80bb2c4..ee19a81473 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.11.3.ps1 @@ -29,7 +29,8 @@ Control = 'cisa-scuba:MS.EXO.11.3', Service = 'None', Lifecycle = 'Deprecated', - Author = 'soulemike' + Author = 'soulemike', + Contributor = 'JeremyFinney-lgtm' )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 index bb508aa5f6..55faed2a2b 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 @@ -28,7 +28,7 @@ Control = 'cisa-scuba:MS.EXO.2.2', Service = 'ExchangeOnline', Author = 'soulemike', - Contributor = 'moorereason' + Contributor = ('moorereason', 'JeremyFinney-lgtm') )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 index 21b3b14ee2..3e59c34f17 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.8.3.ps1 @@ -29,7 +29,8 @@ Control = 'cisa-scuba:MS.EXO.8.3', Service = 'None', Lifecycle = 'Deprecated', - Author = 'soulemike' + Author = 'soulemike', + Contributor = 'JeremyFinney-lgtm' )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 index d9ad33ddb6..2bf5a8b2ae 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.9.2.ps1 @@ -21,7 +21,8 @@ Control = 'cisa-scuba:MS.EXO.9.2', Service = 'None', Lifecycle = 'Deprecated', - Author = 'soulemike' + Author = 'soulemike', + Contributor = 'JeremyFinney-lgtm' )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 b/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 index c9fddfeaa4..39e767b656 100644 --- a/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 +++ b/tests/cisa/exchange/Test.CISA.MS.EXO.9.4.ps1 @@ -30,7 +30,7 @@ Service = 'None', Lifecycle = 'Deprecated', Author = 'soulemike', - Contributor = ('thomas-s-schmidt', 'SamErde') + Contributor = ('thomas-s-schmidt', 'SamErde', 'JeremyFinney-lgtm') )] [CmdletBinding()] [OutputType([bool])] diff --git a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 index 6f8cccea0b..313318a5da 100644 --- a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 +++ b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 @@ -27,7 +27,8 @@ Mitre = ('T1213.002', 'T1530'), Control = 'cisa-scuba:MS.SHAREPOINT.3.3', Service = 'SharePointOnline', - Author = 'Mynster9361' + Author = 'Mynster9361', + Contributor = 'JeremyFinney-lgtm' )] [CmdletBinding()] [OutputType([bool])] From 32c862f4dac6cb76fc9c2814800abfddd45b9ba6 Mon Sep 17 00:00:00 2001 From: Jeremy Finney Date: Fri, 13 Nov 2026 08:10:17 +1300 Subject: [PATCH 07/12] chore: credit reviewer for SharePoint check finding Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 index 313318a5da..1ef0dc4aa0 100644 --- a/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 +++ b/tests/cisa/sharepoint/Test.CISA.MS.SHAREPOINT.3.3.ps1 @@ -28,7 +28,7 @@ Control = 'cisa-scuba:MS.SHAREPOINT.3.3', Service = 'SharePointOnline', Author = 'Mynster9361', - Contributor = 'JeremyFinney-lgtm' + Contributor = ('JeremyFinney-lgtm', 'earbona23') )] [CmdletBinding()] [OutputType([bool])] From 8cfda8f2e2a946a9d31843bcfc3c9a553e5d8574 Mon Sep 17 00:00:00 2001 From: Jeremy Finney Date: Fri, 13 Nov 2026 08:28:50 +1300 Subject: [PATCH 08/12] fix: fail CISA SPF assessment when accepted domains are missing Preserve domain-level skips and assert that SharePoint zero-day results display the observed value. Targeted Pester: 29 passed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../functions/Test-MtCisaSpfDirective.Tests.ps1 | 12 ++++++++++++ .../Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 | 1 + tests/cisa/exchange/Test.CISA.MS.EXO.2.2.md | 2 ++ tests/cisa/exchange/Test.CISA.MS.EXO.2.2.ps1 | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 b/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 index 6e478562e6..dd25d4afcd 100644 --- a/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 +++ b/powershell/tests/functions/Test-MtCisaSpfDirective.Tests.ps1 @@ -78,6 +78,18 @@ Describe 'Test-MtCisaSpfDirective' { } } + It 'fails rather than skipping when accepted-domain retrieval returns