Feature/cisa spo remaining controls#1498
Feature/cisa spo remaining controls#1498DataAndGoliath wants to merge 5 commits intomaester365:mainfrom
Conversation
…2.2, 3.1, 3.2, 3.3) Implement 6 of the 8 remaining CISA SCuBA SharePoint Online security controls that were previously listed as "Not Implemented". These controls require the Microsoft.Online.SharePoint.PowerShell module since the properties are not available via Microsoft Graph. New test cmdlets: - Test-MtCisaSpoOneDriveSharing (MS.SHAREPOINT.1.2v1) - Test-MtCisaSpoDefaultSharingScope (MS.SHAREPOINT.2.1v1) - Test-MtCisaSpoDefaultSharingPermission (MS.SHAREPOINT.2.2v1) - Test-MtCisaSpoAnyoneLinkExpiration (MS.SHAREPOINT.3.1v1) - Test-MtCisaSpoAnyoneLinkPermission (MS.SHAREPOINT.3.2v1) - Test-MtCisaSpoVerificationCodeReauth (MS.SHAREPOINT.3.3v1) Infrastructure: - Add Get-MtSpo caching helper (mirrors Get-MtExo pattern) - Add Clear-MtSpoCache for session cache management - Add SpoCache to module session state - Add SharePointOnline as a service in Connect-Maester, Disconnect-Maester, and Test-MtConnection - Add -SharePointAdminUrl parameter to Connect-Maester for manual override - Use -UseWindowsPowerShell on PS7 for SPO module compatibility - Update module manifest with all new exported functions
Hey Maester Team, I've been using the tool in the field for some time now and thoroughly appreciate what has been done. I've encountered requests for SPO integration a couple of times now, and especially since there's SCuBA tests for this that have not been completed. I've taken the liberty to add SPO through some not-perfect handling of PS5.1 through the Connect-SPOService module. Also thought about PnP, but that requires too much refactoring. Implemented 6 of the 8 remaining CISA SCuBA SPO security controls that were previously listed as "Not Implemented". These controls require the Microsoft.Online.SharePoint.PowerShell module since the properties are not available via Microsoft Graph. New test cmdlets: * Test-MtCisaSpoOneDriveSharing (MS.SHAREPOINT.1.2v1) * Test-MtCisaSpoDefaultSharingScope (MS.SHAREPOINT.2.1v1) * Test-MtCisaSpoDefaultSharingPermission (MS.SHAREPOINT.2.2v1) * Test-MtCisaSpoAnyoneLinkExpiration (MS.SHAREPOINT.3.1v1) * Test-MtCisaSpoAnyoneLinkPermission (MS.SHAREPOINT.3.2v1) * Test-MtCisaSpoVerificationCodeReauth (MS.SHAREPOINT.3.3v1) Infrastructure: * Add Get-MtSpo caching helper (mirrors Get-MtExo pattern) * Add Clear-MtSpoCache for session cache management * Add SpoCache to module session state * Add SharePointOnline as a service in Connect-Maester, Disconnect-Maester, and Test-MtConnection * Add -SharePointAdminUrl parameter to Connect-Maester for manual override * Use -UseWindowsPowerShell on PS7 for SPO module compatibility * Update module manifest with all new exported functions
|
Thanks for the helpful addition, @DataAndGoliath! There's a bit of a queue to review right now but we're excited to see this in action. |
There was a problem hiding this comment.
Pull request overview
This PR adds SharePoint Online (SPO) support to Maester’s CISA SCuBA baseline coverage by introducing new SPO security control test cmdlets, plus connection/caching infrastructure and documentation updates.
Changes:
- Added 6 new CISA SPO control tests (plus accompanying markdown docs and Pester tests).
- Introduced SPO session caching (
Get-MtSpo/Clear-MtSpoCache) and wired SPO intoConnect-Maester,Disconnect-Maester, andTest-MtConnection. - Updated website docs to list the newly-implemented SPO controls.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| website/versioned_docs/version-2.0.0/tests/cisa/spo.md | Updates versioned docs to list newly implemented SPO controls. |
| website/docs/tests/cisa/spo.md | Updates current docs to list newly implemented SPO controls. |
| tests/cisa/spo/Test-MtCisaSpoVerificationCodeReauth.Tests.ps1 | Adds Pester coverage for MS.SHAREPOINT.3.3. |
| tests/cisa/spo/Test-MtCisaSpoOneDriveSharing.Tests.ps1 | Adds Pester coverage for MS.SHAREPOINT.1.2. |
| tests/cisa/spo/Test-MtCisaSpoDefaultSharingScope.Tests.ps1 | Adds Pester coverage for MS.SHAREPOINT.2.1. |
| tests/cisa/spo/Test-MtCisaSpoDefaultSharingPermission.Tests.ps1 | Adds Pester coverage for MS.SHAREPOINT.2.2. |
| tests/cisa/spo/Test-MtCisaSpoAnyoneLinkPermission.Tests.ps1 | Adds Pester coverage for MS.SHAREPOINT.3.2. |
| tests/cisa/spo/Test-MtCisaSpoAnyoneLinkExpiration.Tests.ps1 | Adds Pester coverage for MS.SHAREPOINT.3.1. |
| powershell/public/Disconnect-Maester.ps1 | Adds SPO disconnect lifecycle handling. |
| powershell/public/core/Test-MtConnection.ps1 | Adds SPO connection verification support. |
| powershell/public/Connect-Maester.ps1 | Adds SPO connection support and -SharePointAdminUrl parameter. |
| powershell/public/Clear-MtSpoCache.ps1 | Adds cmdlet to clear cached SPO tenant settings. |
| powershell/public/cisa/spo/Test-MtCisaSpoVerificationCodeReauth.ps1 | Implements MS.SHAREPOINT.3.3 control evaluation via SPO module. |
| powershell/public/cisa/spo/Test-MtCisaSpoVerificationCodeReauth.md | Adds end-user guidance/remediation doc for MS.SHAREPOINT.3.3. |
| powershell/public/cisa/spo/Test-MtCisaSpoOneDriveSharing.ps1 | Implements MS.SHAREPOINT.1.2 control evaluation via SPO module. |
| powershell/public/cisa/spo/Test-MtCisaSpoOneDriveSharing.md | Adds end-user guidance/remediation doc for MS.SHAREPOINT.1.2. |
| powershell/public/cisa/spo/Test-MtCisaSpoDefaultSharingScope.ps1 | Implements MS.SHAREPOINT.2.1 control evaluation (new/legacy property names). |
| powershell/public/cisa/spo/Test-MtCisaSpoDefaultSharingScope.md | Adds end-user guidance/remediation doc for MS.SHAREPOINT.2.1. |
| powershell/public/cisa/spo/Test-MtCisaSpoDefaultSharingPermission.ps1 | Implements MS.SHAREPOINT.2.2 control evaluation (new/legacy property names). |
| powershell/public/cisa/spo/Test-MtCisaSpoDefaultSharingPermission.md | Adds end-user guidance/remediation doc for MS.SHAREPOINT.2.2. |
| powershell/public/cisa/spo/Test-MtCisaSpoAnyoneLinkPermission.ps1 | Implements MS.SHAREPOINT.3.2 control evaluation via SPO module. |
| powershell/public/cisa/spo/Test-MtCisaSpoAnyoneLinkPermission.md | Adds end-user guidance/remediation doc for MS.SHAREPOINT.3.2. |
| powershell/public/cisa/spo/Test-MtCisaSpoAnyoneLinkExpiration.ps1 | Implements MS.SHAREPOINT.3.1 control evaluation via SPO module. |
| powershell/public/cisa/spo/Test-MtCisaSpoAnyoneLinkExpiration.md | Adds end-user guidance/remediation doc for MS.SHAREPOINT.3.1. |
| powershell/public/cisa/spo/Get-MtSpo.ps1 | Adds cached Get-SPOTenant helper used by SPO tests. |
| powershell/Maester.psm1 | Adds SpoCache to module session state. |
| powershell/Maester.psd1 | Exports new SPO cmdlets and helpers. |
| powershell/internal/Clear-ModuleVariable.ps1 | Ensures SPO cache is cleared during module variable reset. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Checks if the current session is connected to the specified service | ||
| [ValidateSet('All', 'Azure', 'ExchangeOnline', 'EOP', 'Graph', 'SecurityCompliance', 'Teams')] | ||
| [ValidateSet('All', 'Azure', 'ExchangeOnline', 'EOP', 'Graph', 'SecurityCompliance', 'SharePointOnline', 'Teams')] | ||
| [Parameter(Position = 0)] | ||
| [string[]]$Service = 'Graph', | ||
|
|
There was a problem hiding this comment.
The comment-based help for the Service parameter lists valid values but doesn’t mention the newly-added SharePointOnline option. Please update the help text so Get-Help Test-MtConnection stays accurate.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Yeah that's true, it's referring to 'tests' which is a plural object. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
$MtConnections. for SPO module is indeed reffed in line 54, but never populated as the same check vocabulary. I'll use the handler for this to ensure consistency, and so it doesn't break the $MtConnections.all check. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
DataAndGoliath
left a comment
There was a problem hiding this comment.
Validated through CoPilot check. Retrofitted a health-state check, that is now initialized alongside the other modules. There wasn't one previously for SharePoint, because the checks for SPO were running against Graph. Should be valid to check on Get-SPOTenant for the time being.
I completely understand :) I just saw that there wasn't anything in the docs with regards to getting SPO up and running, so I thought I'd take a jab at it. In my perfect dream world, this would've all be done on native Graph, but alas... |
Description
Hey Maester Team,
I've been using the tool in the field for some time now and thoroughly appreciate what has been done. I've encountered requests for SPO integration a couple of times now, and especially since there's SCuBA tests for this that have not been completed. I've taken the liberty to add SPO through some not-perfect handling of PS5.1 through the Connect-SPOService module. Also thought about PnP, but that requires too much refactoring.
Implemented 6 of the 8 remaining CISA SCuBA SPO security controls that were previously listed as "Not Implemented". These controls require the
Microsoft.Online.SharePoint.PowerShellmodule since the properties are not available via Microsoft Graph.New test cmdlets:
Test-MtCisaSpoOneDriveSharing(MS.SHAREPOINT.1.2v1)Test-MtCisaSpoDefaultSharingScope(MS.SHAREPOINT.2.1v1)Test-MtCisaSpoDefaultSharingPermission(MS.SHAREPOINT.2.2v1)Test-MtCisaSpoAnyoneLinkExpiration(MS.SHAREPOINT.3.1v1)Test-MtCisaSpoAnyoneLinkPermission(MS.SHAREPOINT.3.2v1)Test-MtCisaSpoVerificationCodeReauth(MS.SHAREPOINT.3.3v1)Infrastructure:
Get-MtSpocaching helper (mirrorsGet-MtExopattern) withClear-MtSpoCacheSharePointOnlineadded as a service inConnect-Maester,Disconnect-Maester, andTest-MtConnection-SharePointAdminUrlparameter onConnect-Maesterfor manual override-UseWindowsPowerShellon PS7 for SPO module compatibilityDesign decisions:
DefaultSharingLinkType→CoreDefaultShareLinkScope,DefaultLinkPermission→CoreDefaultShareLinkRole)Test plan
Get-MtSpocaching works correctlyInvoke-Maester -Path ./tests/cisa/spo/generates HTML reportContribution Checklist
Before submitting this PR, please confirm you have completed the following:
/powershell/tests/pester.ps1on your local system.Join us at the Maester repository discussions 💬 or Entra Discord 🧑💻 for more help and conversations!