Test-MtCisPasswordExpiry: Only Check domains with isVerified: true to avoid false positives#1757
Test-MtCisPasswordExpiry: Only Check domains with isVerified: true to avoid false positives#1757blindzero wants to merge 11 commits into
Conversation
… avoid false positives with MD double newline fix
Up to standards ✅🟢 Issues
|
Mynster9361
left a comment
There was a problem hiding this comment.
Although this is not listed in the CIS documentation for this test i believe this addition is needed to avoid false positives.
LGTM
|
Thanks, @blindzero! Great catch! |
There was a problem hiding this comment.
Pull request overview
This PR updates the CIS control implementation for password expiry to avoid false positives by excluding unverified domains from evaluation when querying Microsoft Graph domain settings.
Changes:
- Filter
Test-MtCisPasswordExpiryresults to only include domains whereisVerifiedistrue. - Minor Markdown formatting cleanup in the CIS guidance page.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| powershell/public/cis/Test-MtCisPasswordExpiry.ps1 | Adds isVerified filtering to avoid flagging unverified domains as failing. |
| powershell/public/cis/Test-MtCisPasswordExpiry.md | Removes an extra blank/whitespace line in the guidance content. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
|
@SamErde added safety net for string value of passwordExpiry value. Ready for review. Thx. |
| if (($_.authenticationType -ne "Managed") -or ($_.isVerified -ne $true)) { | ||
| return $false |
There was a problem hiding this comment.
@SamErde good one...thanks. implemented skip result logic. All tests ✅
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
📑 Description
Test-MtCisPasswordExpirywas checking onPasswordValidityPeriodInDaysandisManaged: truefor domains.With unverified domains this led to false positive errors, as unverified domains have
PasswordValidityPeriodInDays: false, although the setting is globally applied in Microsoft 365 Admin Portal UI.My assumption is that unverified domains can't be properly used in Microsoft 365 anyways and therefor should be excluded from this test. As soon as a domain is verified, the proper
PasswordValidityPeriodInDaysvalue from tenant configuration is applied (checked this with a new domain on our end).Changes
$resultfilter was enriched with-and ($isVerified -eq $true)Closes #1714
✅ Checks
/powershell/tests/pester.ps1locally.