From fc37b2381442401f17e99995dd471d1a056a1a88 Mon Sep 17 00:00:00 2001 From: Jeremy Finney Date: Tue, 10 Nov 2026 15:36:38 +1300 Subject: [PATCH 1/5] feat(cisa): migrate Security Suite malware checks 1.1-1.4 (Part 1) Pin the CISA framework to ScubaGear 92e5f2e, add the Security Suite requirements, mark removed policies, move EXO 9.5 and 10.3 to SECURITYSUITE 1.1 and 1.2, add 1.3 and the 1.4 shim of ORCA.158, and remove the superseded EXO 9.1, 9.3, 10.1 and 10.2 tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Test-MtCisaSecuritySuiteMalware.Tests.ps1 | 54 +++++++ .../functions/engine/Frameworks.Tests.ps1 | 31 +++- .../tests/general/NativeTestLint.Tests.ps1 | 1 + .../Test.CISA.MS.SECURITYSUITE.1.3.md | 20 +++ .../Test.CISA.MS.SECURITYSUITE.1.3.ps1 | 147 ++++++++++++++++++ .../Test.CISA.MS.SECURITYSUITE.1.4.md | 18 +++ .../Test.CISA.MS.SECURITYSUITE.1.4.ps1 | 39 +++++ tests/cisa/exchange/Test.CISA.MS.EXO.10.1.md | 25 --- tests/cisa/exchange/Test.CISA.MS.EXO.10.1.ps1 | 33 ---- tests/cisa/exchange/Test.CISA.MS.EXO.10.2.md | 25 --- tests/cisa/exchange/Test.CISA.MS.EXO.10.2.ps1 | 72 --------- tests/cisa/exchange/Test.CISA.MS.EXO.9.1.md | 25 --- tests/cisa/exchange/Test.CISA.MS.EXO.9.1.ps1 | 33 ---- tests/cisa/exchange/Test.CISA.MS.EXO.9.3.md | 24 --- tests/cisa/exchange/Test.CISA.MS.EXO.9.3.ps1 | 32 ---- ...5.md => Test.CISA.MS.SECURITYSUITE.1.1.md} | 6 +- ...ps1 => Test.CISA.MS.SECURITYSUITE.1.1.ps1} | 6 +- ...3.md => Test.CISA.MS.SECURITYSUITE.1.2.md} | 4 +- ...ps1 => Test.CISA.MS.SECURITYSUITE.1.2.ps1} | 4 +- tests/cisa/frameworks/cisa-scuba.json | 34 +++- tests/cisa/suite.json | 4 +- 21 files changed, 347 insertions(+), 290 deletions(-) create mode 100644 powershell/tests/functions/Test-MtCisaSecuritySuiteMalware.Tests.ps1 create mode 100644 tests/cisa/defender/Test.CISA.MS.SECURITYSUITE.1.3.md create mode 100644 tests/cisa/defender/Test.CISA.MS.SECURITYSUITE.1.3.ps1 create mode 100644 tests/cisa/defender/Test.CISA.MS.SECURITYSUITE.1.4.md create mode 100644 tests/cisa/defender/Test.CISA.MS.SECURITYSUITE.1.4.ps1 delete mode 100644 tests/cisa/exchange/Test.CISA.MS.EXO.10.1.md delete mode 100644 tests/cisa/exchange/Test.CISA.MS.EXO.10.1.ps1 delete mode 100644 tests/cisa/exchange/Test.CISA.MS.EXO.10.2.md delete mode 100644 tests/cisa/exchange/Test.CISA.MS.EXO.10.2.ps1 delete mode 100644 tests/cisa/exchange/Test.CISA.MS.EXO.9.1.md delete mode 100644 tests/cisa/exchange/Test.CISA.MS.EXO.9.1.ps1 delete mode 100644 tests/cisa/exchange/Test.CISA.MS.EXO.9.3.md delete mode 100644 tests/cisa/exchange/Test.CISA.MS.EXO.9.3.ps1 rename tests/cisa/exchange/{Test.CISA.MS.EXO.9.5.md => Test.CISA.MS.SECURITYSUITE.1.1.md} (72%) rename tests/cisa/exchange/{Test.CISA.MS.EXO.9.5.ps1 => Test.CISA.MS.SECURITYSUITE.1.1.ps1} (93%) rename tests/cisa/exchange/{Test.CISA.MS.EXO.10.3.md => Test.CISA.MS.SECURITYSUITE.1.2.md} (82%) rename tests/cisa/exchange/{Test.CISA.MS.EXO.10.3.ps1 => Test.CISA.MS.SECURITYSUITE.1.2.ps1} (96%) diff --git a/powershell/tests/functions/Test-MtCisaSecuritySuiteMalware.Tests.ps1 b/powershell/tests/functions/Test-MtCisaSecuritySuiteMalware.Tests.ps1 new file mode 100644 index 0000000000..c985967134 --- /dev/null +++ b/powershell/tests/functions/Test-MtCisaSecuritySuiteMalware.Tests.ps1 @@ -0,0 +1,54 @@ +BeforeAll { + $testRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..\..') + . (Join-Path $testRoot 'tests\orca\Test.ORCA.158.ps1') + . (Join-Path $testRoot 'tests\cisa\defender\Test.CISA.MS.SECURITYSUITE.1.3.ps1') + . (Join-Path $testRoot 'tests\cisa\defender\Test.CISA.MS.SECURITYSUITE.1.4.ps1') +} +Describe 'CISA Security Suite malware and Safe Attachments checks' { + BeforeEach { + Mock Add-MtTestResultDetail {} + } + + It 'checks the global SharePoint, OneDrive, and Teams Safe Attachments setting' { + Mock Test-ORCA158 { $true } + Test-MtCisaSafeAttachmentsForSharePoint | Should -BeTrue + Should -Invoke Test-ORCA158 -Times 1 -Exactly + + Mock Test-ORCA158 { $false } + Test-MtCisaSafeAttachmentsForSharePoint | Should -BeFalse + } + + It 'uses the highest-priority Safe Attachments rule among the rules covering all recipients' { + $script:exoResponses = @{ + SafeAttachmentPolicy = @( + [pscustomobject]@{ Identity = 'All domains'; Name = 'All domains'; Action = 'DynamicDelivery' } + ) + ATPProtectionPolicyRule = @() + SafeAttachmentRule = @( + [pscustomobject]@{ + State = 'Enabled'; Priority = 1; SafeAttachmentPolicy = 'Targeted' + SentTo = @('user@contoso.com'); SentToMemberOf = @(); ExceptIfSentTo = @(); ExceptIfSentToMemberOf = @() + ExceptIfRecipientDomainIs = @(); RecipientDomainIs = @() + }, + [pscustomobject]@{ + State = 'Enabled'; Priority = 2; SafeAttachmentPolicy = 'All domains' + SentTo = @(); SentToMemberOf = @(); ExceptIfSentTo = @(); ExceptIfSentToMemberOf = @() + ExceptIfRecipientDomainIs = @(); RecipientDomainIs = @('contoso.com') + } + ) + ATPBuiltInProtectionRule = @() + AcceptedDomain = @([pscustomobject]@{ Name = 'contoso.com' }) + } + Mock Get-MtExo { $script:exoResponses[$Request] } + + Test-MtCisaSafeAttachment | Should -BeTrue + + $script:exoResponses.SafeAttachmentRule[1].Priority = 3 + $script:exoResponses.SafeAttachmentRule += [pscustomobject]@{ + State = 'Enabled'; Priority = 2; SafeAttachmentPolicy = 'Targeted' + SentTo = @('other@contoso.com'); SentToMemberOf = @(); ExceptIfSentTo = @(); ExceptIfSentToMemberOf = @() + ExceptIfRecipientDomainIs = @(); RecipientDomainIs = @() + } + Test-MtCisaSafeAttachment | Should -BeTrue + } +} diff --git a/powershell/tests/functions/engine/Frameworks.Tests.ps1 b/powershell/tests/functions/engine/Frameworks.Tests.ps1 index 06a6372fd8..a70043fe8b 100644 --- a/powershell/tests/functions/engine/Frameworks.Tests.ps1 +++ b/powershell/tests/functions/engine/Frameworks.Tests.ps1 @@ -336,7 +336,7 @@ Describe 'Benchmark of the tests shipped with Maester' { It 'Gives every test a Benchmark of