Skip to content

Three checks report a pass when their data source returns nothing, two of them High severity auditing controls #2468

Open

Description

@earbona23

Summary

Three checks report a pass when their data source returns nothing. Two of them are Severity = 'High' and both are auditing controls, which is the worst place for it: the operator reads "Well done" and closes the tab.

This is one mechanism with three instances. I sorted through the rest of the suite first and am deliberately not reporting the other candidates, because each one turned out to have a guard. The list of what I discarded is at the end, since knowing which forms are already safe is as useful as the findings.

The mechanism

An absent property and an empty collection are not the same thing in PowerShell, and both fall on the pass side of a negation or a filter:

$empty = @()
if ($empty | Where-Object { $_.Flag -ne 'True' }) { 'fail' } else { 'pass' }   # => pass

$noProp = [pscustomobject]@{}
-not $noProp.AuditDisabled                                                      # => True

Worth writing down because it bit me while measuring this: @($null).Count is 1, but @(<a function that emits nothing>).Count is 0. Invoke-MtGraphRequest returning no rows produces the second, so a Count -gt 0 guard over a function call is safe while the same expression over a property access is not. That distinction removed about seventy five candidates from my list, including one I was ready to report.

1. CIS.M365.3.1.1, audit log search, Severity High

tests/cis/Test.CIS.M365.3.1.1.ps1:41

if ($auditLogSearch | Where-Object { $_.UnifiedAuditLogIngestionEnabled -ne 'True' }) {
    $testResult = $false
} else {
    # pass: "Well done. Your tenant has audit log search enabled"

With zero rows from Get-AdminAuditLogConfig, the filter yields nothing, the if is false, and the else is the pass. Measured: pass. With a row saying disabled: fail, correctly. So the check works on data and inverts on absence.

The strongest evidence here is internal. The same tenant setting is read by three tests, and they disagree:

test expression with zero rows
MT.1172 (High) [bool]$config.UnifiedAuditLogIngestionEnabled False, correct
CISA.MS.EXO.17.1 (High) $config.UnifiedAuditLogIngestionEnabled $null, so the engine skips
CIS.M365.3.1.1 (High) `if ($c Where-Object {...})`

Two of the three already fail closed. MT.1172 is the shape to copy.

2. CISA.MS.EXO.13.1, mailbox auditing, Severity High

tests/cisa/exchange/Test.CISA.MS.EXO.13.1.ps1:39

$testResult = (-not $config.AuditDisabled)

The flag is negative, so a missing OrganizationConfig or a missing AuditDisabled property gives -not $null, which is $true, which is the pass. Measured: absent property passes, AuditDisabled = $true fails correctly.

3. MT.1037, Teams participant give and request control

powershell/internal/checks/maester/teams/Test-MtTeamsRestrictParticipantGiveRequestControl.ps1:29

$result = -not $TeamsMeetingPolicyGlobal.AllowParticipantGiveRequestControl

Measured: with no policies, and also with policies present but none whose Identity is Global, the result is a pass.

This one does not need an argument from me, because the project already made the decision and wrote it down in the sibling file. tests/maester/teams/Test.MT.1045.ps1:31:

if (-not $TeamsMeetingPolicyGlobal) {
    # 2.x failed this test when no Global Teams Meeting Policy exists.
    return $false
}

And of the six tests in that family, four end in return ($result -eq $false), so a $null result becomes False and they fail closed:

test ending with no Global policy
MT.1042, MT.1046, MT.1047, MT.1048 return ($result -eq $false) fail closed
MT.1045 explicit guard with the comment above fail closed
MT.1037 return $result pass

Test.MT.1037.ps1:34 also has if ($null -eq $result) { return $null }, which cannot fire because the check always returns a [bool].

Two more, lower severity, included because they are the same class

CIS.M365.1.3.6, customer lockbox, Medium: an empty OrganizationConfig gives (($lockbox | Where-Object {...} | Measure-Object).Count -eq 0), which is $true. Same file has a second defect: $resultMd is only assigned inside the failure branch but used in the -replace of both, so the pass message renders an empty table and would throw under Set-StrictMode.

tests/ad/domain/Test.AD-FOR-03.ps1: line 54 substitutes a default of 180 when TombstoneLifetime is null, and line 61 then asks $null -ne $tombstoneLifetime, which can no longer be false. The "Unable to retrieve tombstone lifetime" branch is unreachable, and line 73 prints "Meets recommendation (180+ days)" over a value that was never read. Its sibling tests/ad/config/Test.AD-CFG-01.ps1:55 checks the object rather than the substituted value, which is the right shape.

The fix already exists in the repo

CIS.M365.5.2.3.8 and .9 assume a documented Microsoft default, which is the same situation, and guard it with -match '^\d+$'. That rejects $null, because "$null" is the empty string. CISA.MS.AAD.6.1 handles $null and a [bool] explicitly with TryParse. Either is a precedent for fixing the five above.

For the two High findings I would argue for a skip rather than a fail, since "the service returned nothing" is usually a permissions or licence problem rather than a misconfiguration, and Add-MtTestResultDetail -SkippedBecause NotAuthorized says that honestly. But a fail is still better than a pass, and the call is yours.

What I checked and discarded, with the guard that saved each one

Reporting these because the forms matter more than the list: 46 -ge 0 tautologies in tests/ad/** are all Severity = 'Info' with titles saying "should be retrievable", so they are intentional; about 60 raw $result = $obj.flag assignments return $null and the engine skips, and a skip is not a pass; 9 uses of [bool]$Policy.value fail closed because [bool]$null is False; CIS.M365.2.1.7, SHAREPOINT.3.1, CIS.7.2.9 and AZDO.1035 all feed a failure list or compare in the fail-closed direction; MT.1225 reads a property that is not in the beta metadata and documents it with a guard, so it is preview rather than a typo; and MT.1096 looked like the headline finding until I replaced my stub with the real Invoke-MtGraphRequest and the pass disappeared, which is the two-nulls distinction above.

I also indexed every property name in the beta and v1.0 $metadata and compared them against all 762 tests. Only seven camelCase names do not appear, and none of them produces a false pass. There are no no-ops from a misspelled property.

Three I could not close without a tenant

CISA.MS.SHAREPOINT.3.3:47 checks EmailAttestationReAuthDays -le 30 with no lower bound, while its sibling 3.1:46 uses -ge 1 -and -le 30 and documents that 0 means no expiration. If Get-PnPTenant can return 0 here, then 0 -le 30 passes "never reauthenticate", which would be a false pass with a concrete value rather than a null. Also whether Get-MtAIAgentInfo ever yields the "Unknown (...)" sentinel it constructs, since no consumer treats that string as uncertainty; and whether Get-AdminAuditLogConfig throws or returns zero rows for an account with only view-only audit rights, which is what decides whether finding 1 is a design defect or something reachable today.

Happy to send these as separate pull requests, one per suite, or as one if you prefer. I have a reproduction for each as a few lines of PowerShell with no tenant needed.

Activity

  1. added
    status: needs triage
    bug
    product: purview
    product: exchange
    product: teams
    suite: cis
    suite: cisa
    and removed on Oct 23, 2026
  2. earbona23 commented on Nov 5, 2026

    @earbona23
    ContributorAuthor

    Closing the loop on this, measured against main at 6165598.

    Three of the five are fixed and in main. They went in as part of other work and I never came back to
    say so here:

    finding severity commit
    CIS.M365.3.1.1, audit log search High 357aa44
    CISA.MS.EXO.13.1, mailbox auditing High 357aa44
    MT.1037, participant give and request control Low 0179568

    The two auditing checks now return $null with Add-MtTestResultDetail -SkippedBecause NotAuthorized
    when their source returns nothing, and MT.1037 returns $false with no Global meeting policy, which is
    the guard MT.1045 already had. CIS.M365.3.1.1 has been changed twice since, by @JeremyFinney-lgtm in
    59fce9f and 22457e7 and by @merill in a2eb2da, to read AdminAuditLogConfig through the Exchange
    Online session; I re-read the file on main and the guard survived all three.

    Two are still open, and I would fix one of them now.

    CIS.M365.1.3.6, customer lockbox, Medium, at tests/cis/Test.CIS.M365.1.3.6.ps1:41-47. Measured
    against each shape the data source can take:

    Get-MtExo -Request OrganizationConfig returns verdict today
    nothing pass — "Well done. Your tenant has the customer lockbox enabled"
    an object without CustomerLockBoxEnabled fail, correctly
    CustomerLockBoxEnabled = $false fail, correctly
    CustomerLockBoxEnabled = $true pass, correctly

    Only the first row is wrong, and it is the same shape as the two auditing checks: the empty collection
    filters to nothing, ($result | Measure-Object).Count -eq 0 is $true, and that is the pass branch.

    The same file has a second, smaller defect. $resultMd is assigned only inside
    if ($testResult -eq $false) but used in the -replace of both branches, so a passing tenant reads
    "Well done..." followed by an empty table. In the original report above I said that would throw under
    Set-StrictMode; I have since checked, and nothing that runs a check sets strict mode — Set-StrictMode
    appears only under build/. So the effect is the empty table, not an error. I would rather correct that
    here than leave it standing.

    I have the fix ready as one change to that one file: the NotAuthorized guard in the shape of 357aa44,
    and the table built on both paths. Building it on both paths means the per-row verdict has to read
    CustomerLockBoxEnabled, because the $item.id -notin $result.id it replaces compares $null against
    $null — the projection is Select-Object CustomerLockBoxEnabled and carries no id. It is a bug fix,
    so it is inside the 3.0 freeze. Say the word and I will open it.

    AD-FOR-03, tombstone lifetime, Info. I would now leave this one alone, and it is worth saying why
    since I listed it. Severity = 'Info' and a title of "Tombstone lifetime should be retrievable" put it in
    the same intentional category as the 46 -ge 0 checks in tests/ad/** that I discarded in the original
    report. What remains is a reporting defect rather than a false pass: with no value the check substitutes
    the 180-day default at line 55, so $null -ne $tombstoneLifetime at line 62 can no longer be false, the
    "Unable to retrieve tombstone lifetime" branch at line 79 is unreachable, and line 73 prints "✅ Meets
    recommendation (180+ days)" over a value that was never read. Worth fixing, not worth a bug-fix PR during
    the freeze.

    What this does not cover. Everything above is measured against the source on main and against
    mocked inputs. I still have no tenant, so I cannot tell you whether
    Get-MtExo -Request OrganizationConfig really returns nothing for an account with partial Exchange
    rights, which is what decides whether the lockbox row is reachable today or only by construction. The
    three questions I could not close without a tenant at the end of the original report are unchanged and
    still open.

  3. JeremyFinney-lgtm commented on Nov 10, 2026

    @JeremyFinney-lgtm
    Contributor

    The CISA SharePoint missing-value case is addressed in #2756, pushed in commit 6e6d1b1d7.

    CISA.MS.SHAREPOINT.3.3 now explicitly requires a non-null EmailAttestationReAuthDays before comparing it with 30. A missing value therefore cannot pass through PowerShell's $null -le 30 behavior.

    For the zero-day question, the fix deliberately retains ScubaGear's SharePoint policy: attestation must be required and the reauthentication period must be <= 30, with no additional lower bound. Zero remains passing under those conditions. We have not assumed that this property's zero semantics match the separate anonymous-link-expiration setting.

    All six focused SharePoint regressions passed, including the missing-value failure and zero-value behavior. The broader targeted selection passed 137 tests, plus 92 analyzer/retired-check validations. No live-tenant validation was performed.

    This is a partial fix, pending review and merge. It does not resolve the remaining non-CISA findings or the other tenant-dependent questions in this issue, so the PR does not close this issue.

  4. earbona23 commented on Nov 11, 2026

    @earbona23
    ContributorAuthor

    All five findings are now addressed. Updated tally:

    finding severity where it landed
    CIS.M365.3.1.1, audit log search High 357aa44, in main
    CISA.MS.EXO.13.1, mailbox auditing High 357aa44, in main
    MT.1037, give and request control Low 0179568, in main
    CISA.MS.SHAREPOINT.3.3, attestation reauth — #2756 by @JeremyFinney-lgtm, open

    I verified the SharePoint one in the PR: the -le 30 comparison is now gated on $null -ne EmailAttestationReAuthDays, with cases for $null and for 0.

    One thing came out of reviewing it that belongs in this issue, because it is the same mechanism one step further on. Set-SPOTenant -EmailAttestationReAuthDays documents the value as "from 1 to 365 days", so 0 is not something an administrator can set. A tenant reporting 0 is therefore not reporting a chosen period; it is most likely an unconfigured default surfacing as an integer. 0 -le 30 is $true, so it passes — an absent setting on the pass side, which is what this issue is about. I raised it on #2756 with the two ways out; it needs a measurement from a tenant that actually reports 0 to settle, and I do not have one.

    Leaving this issue open until #2756 lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugproduct: exchangeproduct: purviewproduct: teamsstatus: needs triagesuite: cissuite: cisa

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions