diff --git a/build/golden/Export-MtLegacyIdTable.ps1 b/build/golden/Export-MtLegacyIdTable.ps1 index e5a8d8ea9e..802c76ffcd 100644 --- a/build/golden/Export-MtLegacyIdTable.ps1 +++ b/build/golden/Export-MtLegacyIdTable.ps1 @@ -5,7 +5,8 @@ .DESCRIPTION Walks every commit that touched a *.Tests.ps1 file under tests/ (tests/Custom excluded), parses the It names of every changed file version with the PowerShell AST (regex fallback for files that do - not parse) and records every static test ID that ever shipped. + not parse) and records every static test ID that ever shipped. Current native test IDs, titles and + check functions are read from the current tests/ tree. The ID of an It name is the text before the first colon when that text has no spaces (for example 'MT.1001' or 'MS.AAD.7.1'). Early wrappers had no ID; for those the whole It name is @@ -19,9 +20,11 @@ function - the single check function called in the It body is called by exactly one current test retired - nothing matched - The output is deterministic: GeneratedFrom is the last commit that touched the scanned test files, - and current IDs are read from that commit's tree, so rerunning on a later commit that does not touch - tests/ produces identical output. + A previous mapping is retained with its original rule when no new match is found and its target is + still a current ID. + + Historical IDs are derived from git history. Current native test IDs and functions come from the + working tree, so the output is deterministic for the same history and current test files. .EXAMPLE ./build/golden/Export-MtLegacyIdTable.ps1 @@ -55,6 +58,8 @@ $ManualOverrides = [ordered]@{ # Pre-colon names of the split checks; the current titles say 'Global Administrator' and both call one function. 'MT.1050 Apps with high-risk permissions having a direct path to Global Admin' = 'MT.1050' 'MT.1051 Apps with high-risk permissions having an indirect path to Global Admin' = 'MT.1051' + # This title matches both the CIS and Maester checks; preserve the historical Maester mapping. + 'Ensure modern authentication for Exchange Online is enabled' = 'MT.1044' # Mock-based unit tests that briefly lived under tests/; they were never security checks. 'MFA for All users should pass even if not targeting guests' = 'retired' 'MFA for All users that excludes any guest type should fail' = 'retired' @@ -244,7 +249,7 @@ foreach ($commit in $commits) { } #endregion Scan history -#region Current IDs (from the tree of $generatedFrom) +#region Current IDs $currentIds = [System.Collections.Generic.Dictionary[string, object]]::new([System.StringComparer]::OrdinalIgnoreCase) $familyPrefixes = [System.Collections.Generic.SortedSet[string]]::new([System.StringComparer]::Ordinal) $treeLines = Invoke-Git ls-tree -r $generatedFrom -- tests @@ -261,8 +266,66 @@ foreach ($line in $treeLines) { $currentIds[$split.Id] = [pscustomobject]@{ Id = $split.Id; Title = (Get-NormalizedTitle $split.Title); Functions = $it.Functions; Path = $path } } } + +$testsRoot = Join-Path $RepoRoot 'tests' +$customRoot = Join-Path $testsRoot 'Custom' +$nativeTestFiles = Get-ChildItem -Path $testsRoot -Filter 'Test.*.ps1' -File -Recurse | + Where-Object { -not $_.FullName.StartsWith($customRoot, [System.StringComparison]::OrdinalIgnoreCase) } +foreach ($nativeTestFile in $nativeTestFiles) { + $id = [System.IO.Path]::GetFileNameWithoutExtension($nativeTestFile.Name).Substring(5) + $tokens = $null + $parseErrors = $null + $ast = [System.Management.Automation.Language.Parser]::ParseFile($nativeTestFile.FullName, [ref] $tokens, [ref] $parseErrors) + if ($parseErrors.Count -gt 0) { + throw "Failed to parse native test '$($nativeTestFile.FullName)': $($parseErrors[0].Message)" + } + $functionAsts = @($ast.FindAll({ + param($node) + $node -is [System.Management.Automation.Language.FunctionDefinitionAst] + }, $false)) + $functions = @($functionAsts | ForEach-Object { $_.Name } | + Where-Object { $_ -like 'Test-*' -and $_ -notin $IgnoredFunctions } | Sort-Object -Unique) + $testFunctions = @($functionAsts | Where-Object { + $_.Body.ParamBlock -and ($_.Body.ParamBlock.Attributes | Where-Object { $_.TypeName.Name -in 'MaesterTest', 'MaesterTestAttribute' }) + }) + if ($testFunctions.Count -ne 1) { + throw "Expected one function with a [MaesterTest] attribute in '$($nativeTestFile.FullName)'." + } + + $attribute = $testFunctions[0].Body.ParamBlock.Attributes | + Where-Object { $_.TypeName.Name -in 'MaesterTest', 'MaesterTestAttribute' } | + Select-Object -First 1 + $titleArgument = $attribute.NamedArguments | + Where-Object { $_.ArgumentName -eq 'Title' } | + Select-Object -First 1 + if (-not $titleArgument) { + throw "Missing Title in the [MaesterTest] attribute in '$($nativeTestFile.FullName)'." + } + $titleExpression = $titleArgument.Argument + $title = if ($titleExpression -is [System.Management.Automation.Language.StringConstantExpressionAst]) { + $titleExpression.Value + } elseif ( + $titleExpression -is [System.Management.Automation.Language.ExpandableStringExpressionAst] -and + $titleExpression.NestedExpressions.Count -eq 0 + ) { + $titleExpression.Value + } else { + throw "Title must be a constant string in the [MaesterTest] attribute in '$($nativeTestFile.FullName)'." + } + $currentIds[$id] = [pscustomobject]@{ + Id = $id; Title = (Get-NormalizedTitle $title); Functions = $functions; Path = $nativeTestFile.FullName + } +} Write-Verbose "Current static IDs: $($currentIds.Count); family prefixes: $($familyPrefixes -join ', ')" +$previousEntries = @{} +if (Test-Path -Path $OutputPath) { + $previousTable = [System.IO.File]::ReadAllText($OutputPath) | ConvertFrom-Json + foreach ($entry in $previousTable.Entries) { + $previousEntries[$entry.LegacyId] = $entry + } +} + $titleIndex = @{} $functionIndex = @{} foreach ($c in $currentIds.Values) { @@ -323,6 +386,16 @@ foreach ($record in $history.Values) { $review.Add("AMBIGUOUS $($record.Id): function -> $($functionCandidates -join '|')") } + if ($previousEntries.ContainsKey($record.Id)) { + $previous = $previousEntries[$record.Id] + if ($currentId -eq 'retired' -and $previous.CurrentId -ne 'retired' -and $currentIds.ContainsKey($previous.CurrentId)) { + $currentId = $currentIds[$previous.CurrentId].Id + $rule = $previous.Rule + } elseif ($currentId -eq $previous.CurrentId) { + $rule = $previous.Rule + } + } + if ($currentId -ne 'retired' -and -not $currentIds.ContainsKey($currentId)) { throw "Mapping for '$($record.Id)' targets '$currentId', which is not a current ID." } diff --git a/build/golden/README.md b/build/golden/README.md index 2ec873cc51..a62caa7443 100644 --- a/build/golden/README.md +++ b/build/golden/README.md @@ -18,10 +18,13 @@ Regenerate it after a change to `tests/` that renames or removes a check: script), `prefix` (known prefix renames such as `MS.` to `CISA.MS.`), `title` (same normalised title), `function` (same single `Test-*` function called), otherwise `retired`. +- If no new match is found, the exporter retains a previous mapping only when its + target is still a current built-in ID. - `-Verbose` prints counts by rule and a `REVIEW` line for each ambiguous, conflicting or title-only match. Resolve ambiguous ones by adding them to `$ManualOverrides`. -- `GeneratedFrom` is the last commit that touched the scanned test files, so the - output only changes when `tests/` changes. +- `GeneratedFrom` is the last commit that touched historical `*.Tests.ps1` + files. Current native test IDs, titles and functions are read from the working + tree, so run the exporter after renaming or removing a native check as well. - `powershell/tests/general/LegacyIds.Tests.ps1` checks that no legacy ID is a current ID and that every target ID still exists. If it fails after you rename or remove a check, regenerate the table. diff --git a/powershell/assets/Maester.LegacyIds.json b/powershell/assets/Maester.LegacyIds.json index d0681e44a6..92e2967830 100644 --- a/powershell/assets/Maester.LegacyIds.json +++ b/powershell/assets/Maester.LegacyIds.json @@ -1,11 +1,11 @@ { "SchemaVersion": "1.0", - "GeneratedFrom": "fc6a9078bcdd59b5b2f788682fdcd2be27e15b9c", + "GeneratedFrom": "eb13e7a116e4063bec204e901e4847ae67c1f6f6", "Entries": [ { "LegacyId": "1.1.1 (L1) Ensure Administrative accounts are cloud-only", "CurrentId": "CIS.M365.1.1.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisCloudAdmin.Tests.ps1" @@ -37,7 +37,7 @@ { "LegacyId": "2.1.3 (L1) Ensure notifications for internal users sending malware is Enabled (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.3", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "7e35b57b0f8c01aedc4a29d057a810830a98d873", "LastSeenCommit": "7e35b57b0f8c01aedc4a29d057a810830a98d873", "LastSeenFile": "tests/cis/Test-MtCisInternalMalwareNotification.Tests.ps1" @@ -53,7 +53,7 @@ { "LegacyId": "2.1.4 (L2) Ensure Safe Attachments policy is enabled (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.4", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "7e35b57b0f8c01aedc4a29d057a810830a98d873", "LastSeenCommit": "7e35b57b0f8c01aedc4a29d057a810830a98d873", "LastSeenFile": "tests/cis/Test-MtCisSafeAttachment.Tests.ps1" @@ -61,7 +61,7 @@ { "LegacyId": "2.1.5 (L2) Ensure Safe Attachments for SharePoint, OneDrive, and Microsoft Teams is Enabled", "CurrentId": "CIS.M365.2.1.5", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "811ca62ea0cd22285c9393b56acdd3e338ad5f0f", "LastSeenCommit": "811ca62ea0cd22285c9393b56acdd3e338ad5f0f", "LastSeenFile": "tests/cis/Test-MtCisSafeAttachmentsAtpPolicy.Tests.ps1" @@ -77,7 +77,7 @@ { "LegacyId": "2.1.6 (L1) Ensure Exchange Online Spam Policies are set to notify administrators (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.6", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "7e35b57b0f8c01aedc4a29d057a810830a98d873", "LastSeenCommit": "7e35b57b0f8c01aedc4a29d057a810830a98d873", "LastSeenFile": "tests/cis/Test-MtCisOutboundSpamFilterPolicy.Tests.ps1" @@ -85,7 +85,7 @@ { "LegacyId": "2.1.7 (L1) Ensure that an anti-phishing policy has been created (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.7", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "2487d220155d59d0a35da593584baf23d58bdf41", "LastSeenCommit": "2487d220155d59d0a35da593584baf23d58bdf41", "LastSeenFile": "tests/cis/Test-MtCisSafeAntiPhishingPolicy.Tests.ps1" @@ -829,7 +829,7 @@ { "LegacyId": "App management restrictions on applications and service principals is configured and enabled", "CurrentId": "MT.1002", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c719496991fe90b2e629063847650f943d0df69e", "LastSeenCommit": "c719496991fe90b2e629063847650f943d0df69e", "LastSeenFile": "tests/Identity/Test-AppManagementPolicies.Tests.ps1" @@ -853,7 +853,7 @@ { "LegacyId": "CIS 1.1.3 (L1) Ensure that between two and four global admins are designated", "CurrentId": "CIS.M365.1.1.3", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "9daff9942284717b7705fdaaa14460e7e7779253", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisGlobalAdminCount.Tests.ps1" @@ -869,7 +869,7 @@ { "LegacyId": "CIS 1.2.2 (L1) Ensure sign-in to shared mailboxes is blocked", "CurrentId": "CIS.M365.1.2.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "9daff9942284717b7705fdaaa14460e7e7779253", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisSharedMailboxSignIn.Tests.ps1" @@ -877,7 +877,7 @@ { "LegacyId": "CIS 1.3.1 (L1) Ensure the 'Password expiration policy' is set to 'Set passwords to never expire (recommended)'", "CurrentId": "CIS.M365.1.3.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "9daff9942284717b7705fdaaa14460e7e7779253", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisPasswordExpiry.Tests.ps1" @@ -885,7 +885,7 @@ { "LegacyId": "CIS 1.3.3 (L2) Ensure 'External sharing' of calendars is not available", "CurrentId": "CIS.M365.1.3.3", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "9daff9942284717b7705fdaaa14460e7e7779253", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisCalendarSharing.Tests.ps1" @@ -893,7 +893,7 @@ { "LegacyId": "CIS 1.3.6 (L2) Ensure the customer lockbox feature is enabled", "CurrentId": "CIS.M365.1.3.6", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "9daff9942284717b7705fdaaa14460e7e7779253", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisCustomerLockBox.Tests.ps1" @@ -909,7 +909,7 @@ { "LegacyId": "CIS 2.1.11 (L2) Ensure comprehensive attachment filtering is applied", "CurrentId": "CIS.M365.2.1.11", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisAttachmentFilterComprehensive.Tests.ps1" @@ -917,7 +917,7 @@ { "LegacyId": "CIS 2.1.12 (L1) Ensure the connection filter IP allow list is not used (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.12", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "5a82f51d84dffda157308885725462e0d18c3aad", "LastSeenCommit": "5a82f51d84dffda157308885725462e0d18c3aad", "LastSeenFile": "tests/cis/Test-MtCisHostedConnectionFilterPolicy.Tests.ps1" @@ -925,7 +925,7 @@ { "LegacyId": "CIS 2.1.13 (L1) Ensure the connection filter safe list is off (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.13", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "222cde5ea3722f391da338d4869d86069ac5f56f", "LastSeenCommit": "222cde5ea3722f391da338d4869d86069ac5f56f", "LastSeenFile": "tests/cis/Test-MtCisConnectionFilterSafeList.Tests.ps1" @@ -949,7 +949,7 @@ { "LegacyId": "CIS 2.1.2 (L1) Ensure the Common Attachment Types Filter is enabled (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "7e35b57b0f8c01aedc4a29d057a810830a98d873", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisAttachmentFilter.Tests.ps1" @@ -957,7 +957,7 @@ { "LegacyId": "CIS 2.1.3 (L1) Ensure notifications for internal users sending malware is Enabled (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.3", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "4df9d3e671e648ae838c919e29aa1d03e50474b4", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisInternalMalwareNotification.Tests.ps1" @@ -965,7 +965,7 @@ { "LegacyId": "CIS 2.1.4 (L2) Ensure Safe Attachments policy is enabled (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.4", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "4df9d3e671e648ae838c919e29aa1d03e50474b4", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisSafeAttachment.Tests.ps1" @@ -973,7 +973,7 @@ { "LegacyId": "CIS 2.1.5 (L2) Ensure Safe Attachments for SharePoint, OneDrive, and Microsoft Teams is Enabled", "CurrentId": "CIS.M365.2.1.5", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "4df9d3e671e648ae838c919e29aa1d03e50474b4", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisSafeAttachmentsAtpPolicy.Tests.ps1" @@ -981,7 +981,7 @@ { "LegacyId": "CIS 2.1.6 (L1) Ensure Exchange Online Spam Policies are set to notify administrators (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.6", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "4df9d3e671e648ae838c919e29aa1d03e50474b4", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisOutboundSpamFilterPolicy.Tests.ps1" @@ -989,7 +989,7 @@ { "LegacyId": "CIS 2.1.7 (L1) Ensure that an anti-phishing policy has been created (Only Checks Default Policy)", "CurrentId": "CIS.M365.2.1.7", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "4df9d3e671e648ae838c919e29aa1d03e50474b4", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisSafeAntiPhishingPolicy.Tests.ps1" @@ -997,7 +997,7 @@ { "LegacyId": "CIS 2.1.9 (L1) Ensure that DKIM is enabled for all Exchange Online Domains", "CurrentId": "CIS.M365.2.1.9", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "dfffedfaf152607c1d573549d2443890205d57ea", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisDkim.Tests.ps1" @@ -1013,7 +1013,7 @@ { "LegacyId": "CIS 2.4.4 (L1) Ensure Zero-hour auto purge for Microsoft Teams is on (Only Checks ZAP is enabled)", "CurrentId": "CIS.M365.2.4.4", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e88fddcf9725996d957018ee33f51383c651d940", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisZAP.Tests.ps1" @@ -1021,7 +1021,7 @@ { "LegacyId": "CIS 3.1.1 (L1) Ensure Microsoft 365 audit log search is Enabled", "CurrentId": "CIS.M365.3.1.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "22714f8f530937f69cf8ffb31fb39c84945e128b", "LastSeenCommit": "22714f8f530937f69cf8ffb31fb39c84945e128b", "LastSeenFile": "tests/cis/Test-MtCisAuditLogSearch.Tests.ps1" @@ -1029,7 +1029,7 @@ { "LegacyId": "CIS 8.1.1 (L2) Ensure external file sharing in Teams is enabled for only approved cloud storage services", "CurrentId": "CIS.M365.8.1.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "3d82ef864339525388e94be7469f304dd3aea67e", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisThirdPartyFileSharing.Tests.ps1" @@ -1037,7 +1037,7 @@ { "LegacyId": "CIS 8.2.2 (L1) Ensure communication with unmanaged Teams users is disabled", "CurrentId": "CIS.M365.8.2.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "3d82ef864339525388e94be7469f304dd3aea67e", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisCommunicateWithUnmanagedTeamsUsers.Tests.ps1" @@ -1061,7 +1061,7 @@ { "LegacyId": "CIS 8.5.3 (L1) Ensure only people in my org can bypass the lobby", "CurrentId": "CIS.M365.8.5.3", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "3d82ef864339525388e94be7469f304dd3aea67e", "LastSeenCommit": "8a08dabc56545cf42ebac9321351463a9f1b121e", "LastSeenFile": "tests/cis/Test-MtCisTeamsLobbyBypass.Tests.ps1" @@ -1077,7 +1077,7 @@ { "LegacyId": "CISA.MS.EXO.03.1", "CurrentId": "CISA.MS.EXO.3.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", "LastSeenCommit": "5810a0dc37538fe0c4884f55938f23f5c7d1d6cc", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDkim.Tests.ps1" @@ -1085,7 +1085,7 @@ { "LegacyId": "CISA.MS.EXO.06.1", "CurrentId": "CISA.MS.EXO.6.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", "LastSeenCommit": "5810a0dc37538fe0c4884f55938f23f5c7d1d6cc", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaContactSharing.Tests.ps1" @@ -1093,7 +1093,7 @@ { "LegacyId": "CISA.MS.EXO.06.2", "CurrentId": "CISA.MS.EXO.6.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", "LastSeenCommit": "5810a0dc37538fe0c4884f55938f23f5c7d1d6cc", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaCalendarSharing.Tests.ps1" @@ -1101,7 +1101,7 @@ { "LegacyId": "CISA.MS.EXO.07.1", "CurrentId": "CISA.MS.EXO.7.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", "LastSeenCommit": "5810a0dc37538fe0c4884f55938f23f5c7d1d6cc", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaExternalSenderWarning.Tests.ps1" @@ -1109,7 +1109,7 @@ { "LegacyId": "CISA.MS.EXO.08.1", "CurrentId": "CISA.MS.EXO.8.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", "LastSeenCommit": "5810a0dc37538fe0c4884f55938f23f5c7d1d6cc", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDlp.Tests.ps1" @@ -1125,11 +1125,51 @@ { "LegacyId": "CISA.MS.EXO.09.5", "CurrentId": "CISA.MS.EXO.9.5", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", "LastSeenCommit": "5810a0dc37538fe0c4884f55938f23f5c7d1d6cc", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaBlockExecutable.Tests.ps1" }, + { + "LegacyId": "CISA.MS.EXO.14.1", + "CurrentId": "retired", + "Rule": "retired", + "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", + "LastSeenCommit": "eb38f4357cdf3576600aeca7d8da3138f77a37ca", + "LastSeenFile": "tests/cisa/exchange/Test-MtCisaSpamFilter.Tests.ps1" + }, + { + "LegacyId": "CISA.MS.EXO.14.2", + "CurrentId": "CISA.MS.SECURITYSUITE.6.1", + "Rule": "function", + "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", + "LastSeenCommit": "eb38f4357cdf3576600aeca7d8da3138f77a37ca", + "LastSeenFile": "tests/cisa/exchange/Test-MtCisaSpamAction.Tests.ps1" + }, + { + "LegacyId": "CISA.MS.EXO.14.3", + "CurrentId": "CISA.MS.SECURITYSUITE.6.2", + "Rule": "function", + "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", + "LastSeenCommit": "eb38f4357cdf3576600aeca7d8da3138f77a37ca", + "LastSeenFile": "tests/cisa/exchange/Test-MtCisaSpamBypass.Tests.ps1" + }, + { + "LegacyId": "CISA.MS.EXO.17.1", + "CurrentId": "CISA.MS.SECURITYSUITE.5.1", + "Rule": "function", + "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", + "LastSeenCommit": "eb38f4357cdf3576600aeca7d8da3138f77a37ca", + "LastSeenFile": "tests/cisa/exchange/Test-MtCisaAuditLog.Tests.ps1" + }, + { + "LegacyId": "CISA.MS.EXO.17.3", + "CurrentId": "CISA.MS.SECURITYSUITE.5.2", + "Rule": "function", + "FirstSeenCommit": "d176a815b8cfef203cfe0672af5bc092385f05b9", + "LastSeenCommit": "eb38f4357cdf3576600aeca7d8da3138f77a37ca", + "LastSeenFile": "tests/cisa/exchange/Test-MtCisaAuditLogRetention.Tests.ps1" + }, { "LegacyId": "Configure which users are allowed to present in Teams meetings", "CurrentId": "retired", @@ -1140,8 +1180,8 @@ }, { "LegacyId": "Ensure MailTips are enabled for end users", - "CurrentId": "MT.1039", - "Rule": "title", + "CurrentId": "retired", + "Rule": "retired", "FirstSeenCommit": "7cd563adfc02cdecb49b1b5e755f5c541bdd4beb", "LastSeenCommit": "7cd563adfc02cdecb49b1b5e755f5c541bdd4beb", "LastSeenFile": "tests/Maester/Exchange/Test-ExchangeSetting.Tests.ps1" @@ -1173,7 +1213,7 @@ { "LegacyId": "Ensure built-in Device Compliance Policy marks devices with no compliance policy assigned as 'Not compliant'", "CurrentId": "MT.1054", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "7347d0b002ada9eaf4e8a44029ce6d8c80dc7375", "LastSeenCommit": "7347d0b002ada9eaf4e8a44029ce6d8c80dc7375", "LastSeenFile": "tests/Maester/Intune/Test-MtIntunePlatform.Tests.ps1" @@ -1181,7 +1221,7 @@ { "LegacyId": "Ensure intune device clean-up rule is configured", "CurrentId": "MT.1053", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "824da0eb7d27a58b362a77084722299fb229dd03", "LastSeenCommit": "7347d0b002ada9eaf4e8a44029ce6d8c80dc7375", "LastSeenFile": "tests/Maester/Intune/Test-MtIntunePlatform.Tests.ps1" @@ -1189,7 +1229,7 @@ { "LegacyId": "Ensure modern authentication for Exchange Online is enabled", "CurrentId": "MT.1044", - "Rule": "title", + "Rule": "manual", "FirstSeenCommit": "7cd563adfc02cdecb49b1b5e755f5c541bdd4beb", "LastSeenCommit": "7cd563adfc02cdecb49b1b5e755f5c541bdd4beb", "LastSeenFile": "tests/Maester/Exchange/Test-ExchangeSetting.Tests.ps1" @@ -1204,8 +1244,8 @@ }, { "LegacyId": "Ensure users installing Outlook add-ins is not allowed", - "CurrentId": "MT.1041", - "Rule": "title", + "CurrentId": "retired", + "Rule": "retired", "FirstSeenCommit": "7cd563adfc02cdecb49b1b5e755f5c541bdd4beb", "LastSeenCommit": "7cd563adfc02cdecb49b1b5e755f5c541bdd4beb", "LastSeenFile": "tests/Maester/Exchange/Test-ExchangeSetting.Tests.ps1" @@ -1453,7 +1493,7 @@ { "LegacyId": "MS.AAD.2.2v1", "CurrentId": "CISA.MS.AAD.2.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "3c4b65421ae30460f255d30102b161a809983339", "LastSeenCommit": "3c4b65421ae30460f255d30102b161a809983339", "LastSeenFile": "tests/CISA/Test-MtCisaNotifyHighRisk.Tests.ps1" @@ -1677,7 +1717,7 @@ { "LegacyId": "MS.EXO.01.1", "CurrentId": "CISA.MS.EXO.1.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaAutoExternalForwarding.Tests.ps1" @@ -1685,7 +1725,7 @@ { "LegacyId": "MS.EXO.02.1", "CurrentId": "CISA.MS.EXO.2.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaSpfRestriction.Tests.ps1" @@ -1693,7 +1733,7 @@ { "LegacyId": "MS.EXO.02.2", "CurrentId": "CISA.MS.EXO.2.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaSpfDirective.Tests.ps1" @@ -1701,7 +1741,7 @@ { "LegacyId": "MS.EXO.03.1", "CurrentId": "CISA.MS.EXO.3.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDkim.Tests.ps1" @@ -1709,7 +1749,7 @@ { "LegacyId": "MS.EXO.04.1", "CurrentId": "CISA.MS.EXO.4.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDmarcRecordExist.Tests.ps1" @@ -1717,7 +1757,7 @@ { "LegacyId": "MS.EXO.04.2", "CurrentId": "CISA.MS.EXO.4.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDmarcRecordReject.Tests.ps1" @@ -1725,7 +1765,7 @@ { "LegacyId": "MS.EXO.04.3", "CurrentId": "CISA.MS.EXO.4.3", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDmarcAggregateCisa.Tests.ps1" @@ -1733,7 +1773,7 @@ { "LegacyId": "MS.EXO.05.1", "CurrentId": "CISA.MS.EXO.5.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaSmtpAuthentication.Tests.ps1" @@ -1741,7 +1781,7 @@ { "LegacyId": "MS.EXO.06.1", "CurrentId": "CISA.MS.EXO.6.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaContactSharing.Tests.ps1" @@ -1749,7 +1789,7 @@ { "LegacyId": "MS.EXO.06.2", "CurrentId": "CISA.MS.EXO.6.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaCalendarSharing.Tests.ps1" @@ -1757,7 +1797,7 @@ { "LegacyId": "MS.EXO.07.1", "CurrentId": "CISA.MS.EXO.7.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaExternalSenderWarning.Tests.ps1" @@ -1765,7 +1805,7 @@ { "LegacyId": "MS.EXO.08.1", "CurrentId": "CISA.MS.EXO.8.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDlp.Tests.ps1" @@ -1773,7 +1813,7 @@ { "LegacyId": "MS.EXO.08.2", "CurrentId": "CISA.MS.EXO.8.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDlpPii.Tests.ps1" @@ -1781,7 +1821,7 @@ { "LegacyId": "MS.EXO.08.3", "CurrentId": "CISA.MS.EXO.8.3", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDlpAlternate.Tests.ps1" @@ -1789,7 +1829,7 @@ { "LegacyId": "MS.EXO.08.4", "CurrentId": "CISA.MS.EXO.8.4", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaDlpBaselineRule.Tests.ps1" @@ -1821,7 +1861,7 @@ { "LegacyId": "MS.EXO.09.4", "CurrentId": "CISA.MS.EXO.9.4", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaEmailFilterAlternative.Tests.ps1" @@ -1829,7 +1869,7 @@ { "LegacyId": "MS.EXO.09.5", "CurrentId": "CISA.MS.EXO.9.5", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenCommit": "062c1e6a1e0566789256aaea1e37b73dcdb11aed", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaBlockExecutable.Tests.ps1" @@ -1916,24 +1956,24 @@ }, { "LegacyId": "MS.EXO.14.1", - "CurrentId": "CISA.MS.EXO.14.1", - "Rule": "prefix", + "CurrentId": "retired", + "Rule": "retired", "FirstSeenCommit": "3ff87639310f887af7730b1bbaf565cf23fbc5f7", "LastSeenCommit": "3ff87639310f887af7730b1bbaf565cf23fbc5f7", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaSpamFilter.Tests.ps1" }, { "LegacyId": "MS.EXO.14.2", - "CurrentId": "CISA.MS.EXO.14.2", - "Rule": "prefix", + "CurrentId": "CISA.MS.SECURITYSUITE.6.1", + "Rule": "function", "FirstSeenCommit": "3ff87639310f887af7730b1bbaf565cf23fbc5f7", "LastSeenCommit": "3ff87639310f887af7730b1bbaf565cf23fbc5f7", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaSpamAction.Tests.ps1" }, { "LegacyId": "MS.EXO.14.3", - "CurrentId": "CISA.MS.EXO.14.3", - "Rule": "prefix", + "CurrentId": "CISA.MS.SECURITYSUITE.6.2", + "Rule": "function", "FirstSeenCommit": "3ff87639310f887af7730b1bbaf565cf23fbc5f7", "LastSeenCommit": "3ff87639310f887af7730b1bbaf565cf23fbc5f7", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaSpamBypass.Tests.ps1" @@ -1988,8 +2028,8 @@ }, { "LegacyId": "MS.EXO.17.1", - "CurrentId": "CISA.MS.EXO.17.1", - "Rule": "prefix", + "CurrentId": "CISA.MS.SECURITYSUITE.5.1", + "Rule": "function", "FirstSeenCommit": "e4b0509ffa2a15e5ee5c89fa846533d21ab648e9", "LastSeenCommit": "e4b0509ffa2a15e5ee5c89fa846533d21ab648e9", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaAuditLog.Tests.ps1" @@ -2004,8 +2044,8 @@ }, { "LegacyId": "MS.EXO.17.3", - "CurrentId": "CISA.MS.EXO.17.3", - "Rule": "prefix", + "CurrentId": "CISA.MS.SECURITYSUITE.5.2", + "Rule": "function", "FirstSeenCommit": "e4b0509ffa2a15e5ee5c89fa846533d21ab648e9", "LastSeenCommit": "e4b0509ffa2a15e5ee5c89fa846533d21ab648e9", "LastSeenFile": "tests/cisa/exchange/Test-MtCisaAuditLogRetention.Tests.ps1" @@ -2349,7 +2389,7 @@ { "LegacyId": "MT.XXX1", "CurrentId": "MT.1086", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "013cce9d605c9859a43bd1c0c6d75e0a26384532", "LastSeenCommit": "18a24fd602180a43558b93d9bd9bc21da192fe37", "LastSeenFile": "tests/XSPM/Test-XspmCriticalAssetManagement.Tests.ps1" @@ -2525,7 +2565,7 @@ { "LegacyId": "ORCA100", "CurrentId": "ORCA.100", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA100.Tests.ps1" @@ -2533,7 +2573,7 @@ { "LegacyId": "ORCA101", "CurrentId": "ORCA.101", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA101.Tests.ps1" @@ -2541,7 +2581,7 @@ { "LegacyId": "ORCA102", "CurrentId": "ORCA.102", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA102.Tests.ps1" @@ -2549,7 +2589,7 @@ { "LegacyId": "ORCA103", "CurrentId": "ORCA.103", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA103.Tests.ps1" @@ -2557,7 +2597,7 @@ { "LegacyId": "ORCA104", "CurrentId": "ORCA.104", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA104.Tests.ps1" @@ -2565,7 +2605,7 @@ { "LegacyId": "ORCA105", "CurrentId": "ORCA.105", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA105.Tests.ps1" @@ -2573,7 +2613,7 @@ { "LegacyId": "ORCA106", "CurrentId": "ORCA.106", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA106.Tests.ps1" @@ -2581,7 +2621,7 @@ { "LegacyId": "ORCA107", "CurrentId": "ORCA.107", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA107.Tests.ps1" @@ -2589,7 +2629,7 @@ { "LegacyId": "ORCA108", "CurrentId": "ORCA.108", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA108.Tests.ps1" @@ -2597,7 +2637,7 @@ { "LegacyId": "ORCA108_1", "CurrentId": "ORCA.108.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA108_1.Tests.ps1" @@ -2605,7 +2645,7 @@ { "LegacyId": "ORCA109", "CurrentId": "ORCA.109", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA109.Tests.ps1" @@ -2613,7 +2653,7 @@ { "LegacyId": "ORCA110", "CurrentId": "ORCA.110", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA110.Tests.ps1" @@ -2621,7 +2661,7 @@ { "LegacyId": "ORCA111", "CurrentId": "ORCA.111", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA111.Tests.ps1" @@ -2629,7 +2669,7 @@ { "LegacyId": "ORCA112", "CurrentId": "ORCA.112", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA112.Tests.ps1" @@ -2637,7 +2677,7 @@ { "LegacyId": "ORCA113", "CurrentId": "ORCA.113", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA113.Tests.ps1" @@ -2645,7 +2685,7 @@ { "LegacyId": "ORCA114", "CurrentId": "ORCA.114", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA114.Tests.ps1" @@ -2653,7 +2693,7 @@ { "LegacyId": "ORCA115", "CurrentId": "ORCA.115", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA115.Tests.ps1" @@ -2661,7 +2701,7 @@ { "LegacyId": "ORCA116", "CurrentId": "ORCA.116", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA116.Tests.ps1" @@ -2677,7 +2717,7 @@ { "LegacyId": "ORCA118_1", "CurrentId": "ORCA.118.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA118_1.Tests.ps1" @@ -2685,7 +2725,7 @@ { "LegacyId": "ORCA118_2", "CurrentId": "ORCA.118.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA118_2.Tests.ps1" @@ -2693,7 +2733,7 @@ { "LegacyId": "ORCA118_3", "CurrentId": "ORCA.118.3", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA118_3.Tests.ps1" @@ -2701,7 +2741,7 @@ { "LegacyId": "ORCA118_4", "CurrentId": "ORCA.118.4", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA118_4.Tests.ps1" @@ -2709,7 +2749,7 @@ { "LegacyId": "ORCA119", "CurrentId": "ORCA.119", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA119.Tests.ps1" @@ -2725,7 +2765,7 @@ { "LegacyId": "ORCA120_malware", "CurrentId": "ORCA.120.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA120_malware.Tests.ps1" @@ -2733,7 +2773,7 @@ { "LegacyId": "ORCA120_phish", "CurrentId": "ORCA.120.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA120_phish.Tests.ps1" @@ -2741,7 +2781,7 @@ { "LegacyId": "ORCA120_spam", "CurrentId": "ORCA.120.3", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA120_spam.Tests.ps1" @@ -2749,7 +2789,7 @@ { "LegacyId": "ORCA121", "CurrentId": "ORCA.121", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA121.Tests.ps1" @@ -2757,7 +2797,7 @@ { "LegacyId": "ORCA123", "CurrentId": "ORCA.123", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA123.Tests.ps1" @@ -2765,7 +2805,7 @@ { "LegacyId": "ORCA124", "CurrentId": "ORCA.124", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA124.Tests.ps1" @@ -2773,7 +2813,7 @@ { "LegacyId": "ORCA139", "CurrentId": "ORCA.139", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA139.Tests.ps1" @@ -2781,7 +2821,7 @@ { "LegacyId": "ORCA140", "CurrentId": "ORCA.140", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA140.Tests.ps1" @@ -2789,7 +2829,7 @@ { "LegacyId": "ORCA141", "CurrentId": "ORCA.141", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA141.Tests.ps1" @@ -2797,7 +2837,7 @@ { "LegacyId": "ORCA142", "CurrentId": "ORCA.142", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA142.Tests.ps1" @@ -2805,7 +2845,7 @@ { "LegacyId": "ORCA143", "CurrentId": "ORCA.143", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA143.Tests.ps1" @@ -2813,7 +2853,7 @@ { "LegacyId": "ORCA156", "CurrentId": "ORCA.156", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA156.Tests.ps1" @@ -2821,7 +2861,7 @@ { "LegacyId": "ORCA158", "CurrentId": "ORCA.158", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA158.Tests.ps1" @@ -2829,7 +2869,7 @@ { "LegacyId": "ORCA179", "CurrentId": "ORCA.179", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA179.Tests.ps1" @@ -2837,7 +2877,7 @@ { "LegacyId": "ORCA180", "CurrentId": "ORCA.180", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA180.Tests.ps1" @@ -2845,7 +2885,7 @@ { "LegacyId": "ORCA189", "CurrentId": "ORCA.189", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA189.Tests.ps1" @@ -2853,7 +2893,7 @@ { "LegacyId": "ORCA189_2", "CurrentId": "ORCA.189.2", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA189_2.Tests.ps1" @@ -2861,7 +2901,7 @@ { "LegacyId": "ORCA205", "CurrentId": "ORCA.205", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA205.Tests.ps1" @@ -2869,7 +2909,7 @@ { "LegacyId": "ORCA220", "CurrentId": "ORCA.220", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA220.Tests.ps1" @@ -2877,7 +2917,7 @@ { "LegacyId": "ORCA221", "CurrentId": "ORCA.221", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA221.Tests.ps1" @@ -2885,7 +2925,7 @@ { "LegacyId": "ORCA222", "CurrentId": "ORCA.222", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA222.Tests.ps1" @@ -2893,7 +2933,7 @@ { "LegacyId": "ORCA223", "CurrentId": "ORCA.223", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA223.Tests.ps1" @@ -2901,7 +2941,7 @@ { "LegacyId": "ORCA224", "CurrentId": "ORCA.224", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA224.Tests.ps1" @@ -2909,7 +2949,7 @@ { "LegacyId": "ORCA225", "CurrentId": "ORCA.225", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA225.Tests.ps1" @@ -2917,7 +2957,7 @@ { "LegacyId": "ORCA226", "CurrentId": "ORCA.226", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA226.Tests.ps1" @@ -2925,7 +2965,7 @@ { "LegacyId": "ORCA227", "CurrentId": "ORCA.227", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA227.Tests.ps1" @@ -2933,7 +2973,7 @@ { "LegacyId": "ORCA228", "CurrentId": "ORCA.228", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA228.Tests.ps1" @@ -2941,7 +2981,7 @@ { "LegacyId": "ORCA229", "CurrentId": "ORCA.229", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA229.Tests.ps1" @@ -2949,7 +2989,7 @@ { "LegacyId": "ORCA230", "CurrentId": "ORCA.230", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA230.Tests.ps1" @@ -2957,7 +2997,7 @@ { "LegacyId": "ORCA231", "CurrentId": "ORCA.231", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA231.Tests.ps1" @@ -2965,7 +3005,7 @@ { "LegacyId": "ORCA232", "CurrentId": "ORCA.232", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA232.Tests.ps1" @@ -2973,7 +3013,7 @@ { "LegacyId": "ORCA233", "CurrentId": "ORCA.233", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA233.Tests.ps1" @@ -2981,7 +3021,7 @@ { "LegacyId": "ORCA233_1", "CurrentId": "ORCA.233.1", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "e16908cdfe921208ddc90a344d0ebba7f030db59", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA233_1.Tests.ps1" @@ -2989,7 +3029,7 @@ { "LegacyId": "ORCA234", "CurrentId": "ORCA.234", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA234.Tests.ps1" @@ -2997,7 +3037,7 @@ { "LegacyId": "ORCA235", "CurrentId": "ORCA.235", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA235.Tests.ps1" @@ -3005,7 +3045,7 @@ { "LegacyId": "ORCA236", "CurrentId": "ORCA.236", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA236.Tests.ps1" @@ -3013,7 +3053,7 @@ { "LegacyId": "ORCA237", "CurrentId": "ORCA.237", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA237.Tests.ps1" @@ -3021,7 +3061,7 @@ { "LegacyId": "ORCA238", "CurrentId": "ORCA.238", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA238.Tests.ps1" @@ -3029,7 +3069,7 @@ { "LegacyId": "ORCA239", "CurrentId": "ORCA.239", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA239.Tests.ps1" @@ -3037,7 +3077,7 @@ { "LegacyId": "ORCA240", "CurrentId": "ORCA.240", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA240.Tests.ps1" @@ -3045,7 +3085,7 @@ { "LegacyId": "ORCA241", "CurrentId": "ORCA.241", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA241.Tests.ps1" @@ -3053,7 +3093,7 @@ { "LegacyId": "ORCA242", "CurrentId": "ORCA.242", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA242.Tests.ps1" @@ -3061,7 +3101,7 @@ { "LegacyId": "ORCA243", "CurrentId": "ORCA.243", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA243.Tests.ps1" @@ -3069,7 +3109,7 @@ { "LegacyId": "ORCA244", "CurrentId": "ORCA.244", - "Rule": "title", + "Rule": "function", "FirstSeenCommit": "c4ed30699a3283a5dd0d134bd5ec3b2b176799d9", "LastSeenCommit": "8e12ddb478bb7e415497df6ee6bdcca8c783a321", "LastSeenFile": "tests/orca/Test-ORCA244.Tests.ps1" diff --git a/powershell/internal/checks/cisa/exchange/Get-MtExoActiveSpamPolicyEvaluation.ps1 b/powershell/internal/checks/cisa/exchange/Get-MtExoActiveSpamPolicyEvaluation.ps1 new file mode 100644 index 0000000000..ac99c1339b --- /dev/null +++ b/powershell/internal/checks/cisa/exchange/Get-MtExoActiveSpamPolicyEvaluation.ps1 @@ -0,0 +1,146 @@ +function Get-MtExoActiveSpamPolicyEvaluation { + [CmdletBinding()] + [OutputType([pscustomobject])] + param( + [Parameter(Mandatory)] + [scriptblock] $HasViolation + ) + + $policies = @(Get-MtExo -Request HostedContentFilterPolicy) + $presetRules = @(Get-MtExo -Request EOPProtectionPolicyRule) + $customRules = @(Get-MtExo -Request HostedContentFilterRule) + $tenantDomains = @( + Get-MtExo -Request AcceptedDomain | + ForEach-Object { + $domain = if ($_.DomainName) { $_.DomainName } else { $_.Name } + ([string]$domain).Trim().ToLowerInvariant() + } | + Where-Object { -not [string]::IsNullOrWhiteSpace($_) } + ) + + $isEmpty = { + param($Value) + $null -eq $Value -or + ($Value -is [string] -and [string]::IsNullOrWhiteSpace($Value)) -or + @($Value).Count -eq 0 + } + + $activePresetPolicies = @( + foreach ($rule in $presetRules) { + if ( + $rule.State -eq 'Enabled' -and + $rule.Identity -match '(?i)(Standard|Strict) Preset Security Policy' -and + (& $isEmpty $rule.SentTo) -and + (& $isEmpty $rule.SentToMemberOf) -and + (& $isEmpty $rule.RecipientDomainIs) + ) { + $rule.HostedContentFilterPolicy + } + } + ) + + $activeCustomPolicies = @( + foreach ($rule in $customRules) { + if ($rule.State -ne 'Enabled') { + continue + } + + $hasNoRecipientScope = $true + foreach ($field in @('SentTo', 'SentToMemberOf', 'ExceptIfSentTo', 'ExceptIfSentToMemberOf', 'ExceptIfRecipientDomainIs')) { + if (-not (& $isEmpty $rule.$field)) { + $hasNoRecipientScope = $false + break + } + } + + if (-not $hasNoRecipientScope) { + continue + } + + if (-not (& $isEmpty $rule.RecipientDomainIs)) { + if ($tenantDomains.Count -eq 0) { + throw 'Cannot determine whether the enabled all-recipient anti-spam rule covers the tenant because no accepted domains were returned.' + } + + $recipientDomains = @($rule.RecipientDomainIs | ForEach-Object { ([string]$_).Trim().ToLowerInvariant() }) + if (@($tenantDomains | Where-Object { $_ -notin $recipientDomains }).Count -gt 0) { + continue + } + } + + $rule.HostedContentFilterPolicy + } + ) + + $activePolicies = @( + $policies | Where-Object { + $_.IsDefault -eq $true -or + ($_.RecommendedPolicyType -in @('Standard', 'Strict') -and $_.Identity -in $activePresetPolicies) -or + ($_.RecommendedPolicyType -eq 'Custom' -and $_.IsDefault -eq $false -and $_.Identity -in $activeCustomPolicies) + } + ) + $policyEvaluations = @( + foreach ($policy in $activePolicies) { + [pscustomobject]@{ + Policy = $policy + HasViolation = [bool](& $HasViolation $policy) + } + } + ) + + $strictCompliant = @( + $policyEvaluations | Where-Object { + $_.Policy.RecommendedPolicyType -eq 'Strict' -and -not $_.HasViolation + } + ).Count -gt 0 + $standardCompliant = @( + $policyEvaluations | Where-Object { + $_.Policy.RecommendedPolicyType -eq 'Standard' -and -not $_.HasViolation + } + ).Count -gt 0 + $anyPresetCompliant = $strictCompliant -or $standardCompliant + $anyCustomCompliant = @( + $policyEvaluations | Where-Object { + $_.Policy.RecommendedPolicyType -eq 'Custom' -and + $_.Policy.IsDefault -eq $false -and + -not $_.HasViolation + } + ).Count -gt 0 + + $failingPolicies = @( + $policyEvaluations | Where-Object { + $policy = $_.Policy + if ($_.HasViolation) { + if ($policy.IsDefault -eq $true) { + -not $anyPresetCompliant -and -not $anyCustomCompliant + } elseif ($policy.RecommendedPolicyType -eq 'Strict') { + $true + } elseif ($policy.RecommendedPolicyType -eq 'Standard') { + -not $strictCompliant + } elseif ($policy.RecommendedPolicyType -eq 'Custom') { + -not $anyPresetCompliant + } + } + } | ForEach-Object { $_.Policy } + ) + + $cascadeStatus = if ($strictCompliant) { + 'Strict preset is active and compliant; lower-priority policies are shielded.' + } elseif ($standardCompliant) { + 'Standard preset is active and compliant; custom and default policies are shielded.' + } elseif ($anyCustomCompliant) { + 'No active preset is compliant; a compliant all-recipient custom policy shields the default policy.' + } else { + 'All active policies were evaluated; no policy was shielded by a compliant higher-priority preset or custom policy.' + } + + [pscustomobject]@{ + ActivePolicies = $activePolicies + FailingPolicies = $failingPolicies + StrictCompliant = $strictCompliant + AnyPresetCompliant = $anyPresetCompliant + AnyCustomCompliant = $anyCustomCompliant + CascadeStatus = $cascadeStatus + TestResult = ($activePolicies.Count -gt 0 -and $failingPolicies.Count -eq 0) + } +} diff --git a/powershell/public/run/Add-MtTestResultDetail.ps1 b/powershell/public/run/Add-MtTestResultDetail.ps1 index 3f4fa78dba..1835343965 100644 --- a/powershell/public/run/Add-MtTestResultDetail.ps1 +++ b/powershell/public/run/Add-MtTestResultDetail.ps1 @@ -34,7 +34,7 @@ .EXAMPLE Add-MtTestResultDetail -Description 'Check for stale credentials' -Result 'Found 3 service principals with unused credentials' -Investigate - This example marks a test as requiring investigation. The test passed but needs manual review to confirm all scenarios were considered. + This example marks a result as requiring investigation. A native test's Maester result is Investigate regardless of its return value; its return value still controls NUnit/JUnit export (`$null` is ignored, `$true` succeeds, and `$false` fails). .LINK https://maester.dev/docs/commands/Add-MtTestResultDetail @@ -86,8 +86,8 @@ [Parameter(Mandatory = $false)] [string] $SkippedCustomReason, - # Marks the test as requiring investigation. The test passed but needs manual review to confirm all scenarios were considered. - # This is different from skipped - the test ran and collected data, but the result needs human interpretation. + # Marks the test as requiring investigation. For native tests, this overrides the Maester result, while the return value still controls NUnit/JUnit export. + # Return $null when the investigation should be ignored by CI, rather than marked as passed or failed. [Parameter(Mandatory = $false)] [switch] $Investigate, diff --git a/powershell/public/services/exchange/Get-MtExo.ps1 b/powershell/public/services/exchange/Get-MtExo.ps1 index f78d5f7209..79fd0299ca 100644 --- a/powershell/public/services/exchange/Get-MtExo.ps1 +++ b/powershell/public/services/exchange/Get-MtExo.ps1 @@ -76,6 +76,7 @@ "ManagementRoleAssignment" = "Get-ManagementRoleAssignment" "ConnectionInformation" = "Get-ConnectionInformation" "AdminAuditLogConfig" = "Get-AdminAuditLogConfig" + "UnifiedAuditLogRetentionPolicy" = "Get-UnifiedAuditLogRetentionPolicy" "EXOMailboxAudit" = "Get-EXOMailbox -RecipientTypeDetails 'UserMailbox' -PropertySets 'Audit','Minimum' -ResultSize 'Unlimited'" "MailboxAuditBypassAssociation" = "Get-MailboxAuditBypassAssociation -ResultSize 'Unlimited' -WarningAction 'SilentlyContinue'" "EmailTenantSettings" = "Get-EmailTenantSettings" diff --git a/powershell/tests/functions/Get-MtExo.Tests.ps1 b/powershell/tests/functions/Get-MtExo.Tests.ps1 index d2f2fc4a7d..1b6306383c 100644 --- a/powershell/tests/functions/Get-MtExo.Tests.ps1 +++ b/powershell/tests/functions/Get-MtExo.Tests.ps1 @@ -25,10 +25,13 @@ [PSCustomObject]@{ UserPrincipalName = 'vip@example.test'; IsVIP = $IsVIP.IsPresent; ResultSize = $ResultSize } } } | Import-Module -Global -Force + New-Module -Name tmpEXO_audit_mttest -ScriptBlock { + function Get-UnifiedAuditLogRetentionPolicy { } + } | Import-Module -Global -Force } AfterAll { - Remove-Module tmpEXO_restricted_mttest, tmpEXO_mttest, tmpEOP_mttest, tmpEXO_vip_mttest -Force -ErrorAction SilentlyContinue + Remove-Module tmpEXO_restricted_mttest, tmpEXO_mttest, tmpEOP_mttest, tmpEXO_vip_mttest, tmpEXO_audit_mttest -Force -ErrorAction SilentlyContinue Clear-MtExoCache } @@ -74,4 +77,17 @@ $vipUsers[0].IsVIP | Should -BeTrue $vipUsers[0].ResultSize | Should -Be 'Unlimited' } + + It 'caches unified audit log retention policy results' { + Mock -ModuleName Maester Get-UnifiedAuditLogRetentionPolicy { + [PSCustomObject]@{ Identity = 'Default'; RetentionDuration = 'TwelveMonths' } + } + + $first = Get-MtExo -Request UnifiedAuditLogRetentionPolicy + $second = Get-MtExo -Request UnifiedAuditLogRetentionPolicy + + $first.RetentionDuration | Should -Be 'TwelveMonths' + $second.RetentionDuration | Should -Be 'TwelveMonths' + Should -Invoke -ModuleName Maester Get-UnifiedAuditLogRetentionPolicy -Times 1 -Exactly + } } diff --git a/powershell/tests/functions/Test-MtCisaSecuritySuiteAudit.Tests.ps1 b/powershell/tests/functions/Test-MtCisaSecuritySuiteAudit.Tests.ps1 new file mode 100644 index 0000000000..90610f283b --- /dev/null +++ b/powershell/tests/functions/Test-MtCisaSecuritySuiteAudit.Tests.ps1 @@ -0,0 +1,60 @@ +BeforeAll { + $testRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..\..') + . (Join-Path $testRoot 'tests\cisa\exchange\Test.CISA.MS.SECURITYSUITE.5.2.ps1') +} + +Describe 'CISA Security Suite audit retention check' { + BeforeEach { + Mock Add-MtTestResultDetail {} + $script:exoResponses = @{ + UnifiedAuditLogRetentionPolicy = @( + [pscustomobject]@{ + Enabled = $true + RecordTypes = @('ExchangeAdmin', 'ExchangeItem', 'ExchangeItemGroup', 'ExchangeAggregatedOperation', 'ExchangeItemAggregated') + RetentionDuration = 'TwelveMonths' + } + ) + } + Mock Get-MtExo { $script:exoResponses[$Request] } + } + + It 'reports Exchange retention evidence as requiring manual verification of the full requirement' { + $result = Test-MtCisaAuditLogRetention + $result | Should -BeNullOrEmpty + + Should -Invoke Add-MtTestResultDetail -Times 1 -Exactly -ParameterFilter { + $Investigate -and $Result -match 'cannot verify the full requirement' -and $Result -match 'does not assess the user scope' + } + } + + It 'keeps the result investigatory when no qualifying Exchange retention policy is found' { + $script:exoResponses.UnifiedAuditLogRetentionPolicy[0].RetentionDuration = 'SixMonths' + + $result = Test-MtCisaAuditLogRetention + $result | Should -BeNullOrEmpty + + Should -Invoke Add-MtTestResultDetail -Times 1 -Exactly -ParameterFilter { + $Investigate -and $Result -match 'Other approved retention or log-export solutions may still satisfy' + } + } + + It 'reports manual review when no Exchange retention policy is returned' { + $script:exoResponses.UnifiedAuditLogRetentionPolicy = @() + + $result = Test-MtCisaAuditLogRetention + $result | Should -BeNullOrEmpty + + Should -Invoke Add-MtTestResultDetail -Times 1 -Exactly -ParameterFilter { $Investigate } + } + + It 'keeps manual review available and includes the error when the optional policy lookup fails' { + Mock Get-MtExo { throw 'Retention policy lookup unavailable.' } + + $result = Test-MtCisaAuditLogRetention + $result | Should -BeNullOrEmpty + + Should -Invoke Add-MtTestResultDetail -Times 1 -Exactly -ParameterFilter { + $Investigate -and $Result -match 'evidence could not be retrieved. Retention policy lookup unavailable' + } + } +} diff --git a/powershell/tests/functions/Test-MtCisaSecuritySuiteSpam.Tests.ps1 b/powershell/tests/functions/Test-MtCisaSecuritySuiteSpam.Tests.ps1 new file mode 100644 index 0000000000..23dbf0c905 --- /dev/null +++ b/powershell/tests/functions/Test-MtCisaSecuritySuiteSpam.Tests.ps1 @@ -0,0 +1,211 @@ +BeforeAll { + $testRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..\..') + . (Join-Path $testRoot 'powershell\internal\checks\cisa\exchange\Get-MtExoActiveSpamPolicyEvaluation.ps1') + . (Join-Path $testRoot 'tests\cisa\exchange\Test.CISA.MS.SECURITYSUITE.6.1.ps1') + . (Join-Path $testRoot 'tests\cisa\exchange\Test.CISA.MS.SECURITYSUITE.6.2.ps1') +} +Describe 'CISA Security Suite spam filter checks' { + BeforeEach { + Mock Add-MtTestResultDetail {} + } + + It 'uses active all-recipient spam-policy precedence and checks the strict preset first' { + $script:exoResponses = @{ + HostedContentFilterPolicy = @( + [pscustomobject]@{ + Identity = 'Strict'; RecommendedPolicyType = 'Strict'; IsDefault = $false + SpamAction = 'Quarantine'; HighConfidenceSpamAction = 'Delete' + PhishSpamAction = 'Redirect'; HighConfidencePhishAction = 'MoveToJmf' + }, + [pscustomobject]@{ + Identity = 'Custom'; RecommendedPolicyType = 'Custom'; IsDefault = $false + SpamAction = 'Deliver'; HighConfidenceSpamAction = 'Deliver' + PhishSpamAction = 'Deliver'; HighConfidencePhishAction = 'Deliver' + }, + [pscustomobject]@{ + Identity = 'Default'; RecommendedPolicyType = 'Custom'; IsDefault = $true + SpamAction = 'Deliver'; HighConfidenceSpamAction = 'Deliver' + PhishSpamAction = 'Deliver'; HighConfidencePhishAction = 'Deliver' + } + ) + EOPProtectionPolicyRule = @( + [pscustomobject]@{ + Identity = 'Strict Preset Security Policy'; HostedContentFilterPolicy = 'Strict' + State = 'Enabled'; SentTo = @(); SentToMemberOf = @(); RecipientDomainIs = @() + } + ) + HostedContentFilterRule = @( + [pscustomobject]@{ + Identity = 'Custom'; HostedContentFilterPolicy = 'Custom'; State = 'Enabled' + SentTo = @(); SentToMemberOf = @(); RecipientDomainIs = @() + ExceptIfSentTo = @(); ExceptIfSentToMemberOf = @(); ExceptIfRecipientDomainIs = @() + } + ) + AcceptedDomain = @() + } + Mock Get-MtExo { $script:exoResponses[$Request] } + + Test-MtCisaSpamAction | Should -BeTrue + + $script:exoResponses.HostedContentFilterPolicy[0].HighConfidencePhishAction = 'Deliver' + Test-MtCisaSpamAction | Should -BeFalse + } + + It 'checks the default spam policy when no higher-priority policy is compliant' { + $script:exoResponses = @{ + HostedContentFilterPolicy = @( + [pscustomobject]@{ + Identity = 'Default'; RecommendedPolicyType = 'Custom'; IsDefault = $true + SpamAction = 'Deliver'; HighConfidenceSpamAction = 'Quarantine' + PhishSpamAction = 'Quarantine'; HighConfidencePhishAction = 'Quarantine' + } + ) + EOPProtectionPolicyRule = @() + HostedContentFilterRule = @() + AcceptedDomain = @() + } + Mock Get-MtExo { $script:exoResponses[$Request] } + + Test-MtCisaSpamAction | Should -BeFalse + + $script:exoResponses.HostedContentFilterPolicy[0].SpamAction = 'Delete' + Test-MtCisaSpamAction | Should -BeTrue + } + + It 'labels default policies accurately and describes an unshielded pass neutrally' { + $script:exoResponses = @{ + HostedContentFilterPolicy = @( + [pscustomobject]@{ + Identity = 'Default'; RecommendedPolicyType = 'Custom'; IsDefault = $true + SpamAction = 'MoveToJmf'; HighConfidenceSpamAction = 'Quarantine' + PhishSpamAction = 'Delete'; HighConfidencePhishAction = 'Redirect' + AllowedSenderDomains = @() + } + ) + EOPProtectionPolicyRule = @() + HostedContentFilterRule = @() + AcceptedDomain = @() + } + Mock Get-MtExo { $script:exoResponses[$Request] } + + Test-MtCisaSpamAction | Should -BeTrue + Test-MtCisaSpamBypass | Should -BeTrue + + Should -Invoke Add-MtTestResultDetail -Times 2 -Exactly -ParameterFilter { + $Result -match '\| Default \| Default \|' -and + $Result -match 'All active policies were evaluated; no policy was shielded by a compliant higher-priority preset or custom policy\.' + } + } + + It 'errors when a domain-scoped spam rule cannot be checked because accepted domains are unavailable' { + $script:exoResponses = @{ + HostedContentFilterPolicy = @() + EOPProtectionPolicyRule = @() + HostedContentFilterRule = @( + [pscustomobject]@{ + Identity = 'Custom'; HostedContentFilterPolicy = 'Custom'; State = 'Enabled' + SentTo = @(); SentToMemberOf = @(); RecipientDomainIs = @('contoso.com') + ExceptIfSentTo = @(); ExceptIfSentToMemberOf = @(); ExceptIfRecipientDomainIs = @() + } + ) + AcceptedDomain = @() + } + Mock Get-MtExo { $script:exoResponses[$Request] } + + { Test-MtCisaSpamAction } | Should -Throw '*no accepted domains were returned*' + { Test-MtCisaSpamBypass } | Should -Throw '*no accepted domains were returned*' + } + + It 'applies allowed-domain checks to active policies using preset precedence' { + $script:exoResponses = @{ + HostedContentFilterPolicy = @( + [pscustomobject]@{ + Identity = 'Strict'; RecommendedPolicyType = 'Strict'; IsDefault = $false + AllowedSenderDomains = @() + }, + [pscustomobject]@{ + Identity = 'Standard'; RecommendedPolicyType = 'Standard'; IsDefault = $false + AllowedSenderDomains = @('example.com') + }, + [pscustomobject]@{ + Identity = 'Default'; RecommendedPolicyType = 'Custom'; IsDefault = $true + AllowedSenderDomains = @('example.com') + } + ) + EOPProtectionPolicyRule = @( + [pscustomobject]@{ + Identity = 'Strict Preset Security Policy'; HostedContentFilterPolicy = 'Strict' + State = 'Enabled'; SentTo = @(); SentToMemberOf = @(); RecipientDomainIs = @() + }, + [pscustomobject]@{ + Identity = 'Standard Preset Security Policy'; HostedContentFilterPolicy = 'Standard' + State = 'Enabled'; SentTo = @(); SentToMemberOf = @(); RecipientDomainIs = @() + } + ) + HostedContentFilterRule = @() + AcceptedDomain = @([pscustomobject]@{ DomainName = 'contoso.com' }) + } + Mock Get-MtExo { $script:exoResponses[$Request] } + + Test-MtCisaSpamBypass | Should -BeTrue + + $script:exoResponses.HostedContentFilterPolicy[0].AllowedSenderDomains = @('example.com') + Test-MtCisaSpamBypass | Should -BeFalse + } + + It 'allows a compliant all-recipient custom policy to shield the default policy' { + $script:exoResponses = @{ + HostedContentFilterPolicy = @( + [pscustomobject]@{ + Identity = 'Custom'; RecommendedPolicyType = 'Custom'; IsDefault = $false + AllowedSenderDomains = @() + }, + [pscustomobject]@{ + Identity = 'Default'; RecommendedPolicyType = 'Custom'; IsDefault = $true + AllowedSenderDomains = @('example.com') + } + ) + EOPProtectionPolicyRule = @() + HostedContentFilterRule = @( + [pscustomobject]@{ + Identity = 'Custom'; HostedContentFilterPolicy = 'Custom'; State = 'Enabled' + SentTo = @(); SentToMemberOf = @(); RecipientDomainIs = @('CONTOSO.COM') + ExceptIfSentTo = @(); ExceptIfSentToMemberOf = @(); ExceptIfRecipientDomainIs = @() + } + ) + AcceptedDomain = @([pscustomobject]@{ DomainName = 'contoso.com' }) + } + Mock Get-MtExo { $script:exoResponses[$Request] } + + Test-MtCisaSpamBypass | Should -BeTrue + + $script:exoResponses.HostedContentFilterPolicy[0].AllowedSenderDomains = @('example.com') + Test-MtCisaSpamBypass | Should -BeFalse + } + + It 'ignores inactive preset policies when checking allowed domains' { + $script:exoResponses = @{ + HostedContentFilterPolicy = @( + [pscustomobject]@{ + Identity = 'Strict'; RecommendedPolicyType = 'Strict'; IsDefault = $false + AllowedSenderDomains = @('example.com') + }, + [pscustomobject]@{ + Identity = 'Default'; RecommendedPolicyType = 'Custom'; IsDefault = $true + AllowedSenderDomains = @() + } + ) + EOPProtectionPolicyRule = @( + [pscustomobject]@{ + Identity = 'Strict Preset Security Policy'; HostedContentFilterPolicy = 'Strict' + State = 'Disabled'; SentTo = @(); SentToMemberOf = @(); RecipientDomainIs = @() + } + ) + HostedContentFilterRule = @() + AcceptedDomain = @([pscustomobject]@{ DomainName = 'contoso.com' }) + } + Mock Get-MtExo { $script:exoResponses[$Request] } + + Test-MtCisaSpamBypass | Should -BeTrue + } +} diff --git a/powershell/tests/functions/engine/Frameworks.Tests.ps1 b/powershell/tests/functions/engine/Frameworks.Tests.ps1 index 06a6372fd8..1adc555872 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