-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #467 from Snozzberries/cisaSpo
Initial setup for CISA SPO Tests using Graph
- Loading branch information
Showing
10 changed files
with
186 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
External sharing for SharePoint SHALL be limited to Existing guests or Only People in your organization. | ||
|
||
Rationale: Sharing information outside the organization via SharePoint increases the risk of unauthorized access. By limiting external sharing, administrators decrease the risk of access to information. | ||
|
||
#### Remediation action: | ||
|
||
1. Sign in to the [SharePoint admin center](https://go.microsoft.com/fwlink/?linkid=2185219). | ||
2. Select Policies > Sharing. | ||
3. Adjust external sharing slider for SharePoint to Existing guests or Only people in your organization. | ||
|
||
> ⚠️ WARNING: This will break existing sharing. | ||
4. Select Save. | ||
|
||
#### Related links | ||
|
||
* [CISA 1 External Sharing - MS.SHAREPOINT.1.1v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint11v1) | ||
* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/SharepointConfig.rego#L68) | ||
|
||
<!--- Results ---> | ||
%TestResult% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<# | ||
.SYNOPSIS | ||
Checks state of SharePoint Online sharing | ||
.DESCRIPTION | ||
External sharing for SharePoint SHALL be limited to Existing guests or Only People in your organization. | ||
.EXAMPLE | ||
Test-MtCisaSharePointOnlineSharing | ||
Returns true if sharing is restricted | ||
.LINK | ||
https://maester.dev/docs/commands/Test-MtCisaSharePointOnlineSharing | ||
#> | ||
function Test-MtCisaSharePointOnlineSharing { | ||
[CmdletBinding()] | ||
[OutputType([bool])] | ||
param() | ||
|
||
$policy = Invoke-MtGraphRequest -RelativeUri "admin/sharepoint/settings" -ApiVersion "v1.0" | ||
|
||
$resultPolicy = $policy | Where-Object { | ||
$_.sharingCapability -in @("disabled","existingExternalUserSharingOnly") | ||
} | ||
|
||
$testResult = ($resultPolicy | Measure-Object).Count -gt 0 | ||
|
||
if ($testResult) { | ||
$testResultMarkdown = "Well done. Your tenant restricts SharePoint Online sharing." | ||
} else { | ||
$testResultMarkdown = "Your tenant does not restrict SharePoint Online sharing.`n`n%TestResult%" | ||
$policy | ForEach-Object { | ||
$result = "* $($_.sharingCapability)`n" | ||
$result | Out-Null | ||
} | ||
} | ||
|
||
$testResultMarkdown = $testResultMarkdown -replace "%TestResult%", $result | ||
|
||
Add-MtTestResultDetail -Result $testResultMarkdown | ||
|
||
return $testResult | ||
} |
24 changes: 24 additions & 0 deletions
24
powershell/public/cisa/spo/Test-MtCisaSpoSharingAllowedDomain.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
External sharing SHALL be restricted to approved external domains and/or users in approved security groups per interagency collaboration needs. | ||
|
||
Rationale: By limiting sharing to domains or approved security groups used for interagency collaboration purposes, administrators help prevent sharing with unknown organizations and individuals. | ||
|
||
#### Remediation action: | ||
|
||
This policy is only applicable if the external sharing slider on the admin page is set to any value other than Only People in your organization. | ||
1. Sign in to the [SharePoint admin center](https://go.microsoft.com/fwlink/?linkid=2185219). | ||
2. Select Policies > Sharing. | ||
3. Expand More external sharing settings. | ||
4. Select Limit external sharing by domain. | ||
5. Select Add domains. | ||
6. Add each approved external domain users are allowed to share files with. | ||
7. Select Manage security groups | ||
8. Add each approved security group. Members of these groups will be allowed to share files externally. | ||
9. Select Save. | ||
|
||
#### Related links | ||
|
||
* [CISA 1 External Sharing - MS.SHAREPOINT.1.3v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint13v1) | ||
* [CISA ScubaGear Rego Reference](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/Rego/SharepointConfig.rego#L130) | ||
|
||
<!--- Results ---> | ||
%TestResult% |
48 changes: 48 additions & 0 deletions
48
powershell/public/cisa/spo/Test-MtCisaSpoSharingAllowedDomain.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<# | ||
.SYNOPSIS | ||
Checks state of SharePoint Online sharing | ||
.DESCRIPTION | ||
External sharing SHALL be restricted to approved external domains and/or users in approved security groups per interagency collaboration needs. | ||
.EXAMPLE | ||
Test-MtCisaSharePointOnlineSharingAllowedDomains | ||
Returns true if sharing uses restricted domains | ||
.LINK | ||
https://maester.dev/docs/commands/Test-MtCisaSharePointOnlineSharingAllowedDomain | ||
#> | ||
function Test-MtCisaSharePointOnlineSharingAllowedDomain { | ||
[CmdletBinding()] | ||
[OutputType([bool])] | ||
param() | ||
|
||
$policy = Invoke-MtGraphRequest -RelativeUri "admin/sharepoint/settings" -ApiVersion "v1.0" | ||
|
||
if($policy.sharingCapability -eq "disabled"){ | ||
Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "SharePoint Online external sharing is disabled." | ||
return $null | ||
} | ||
|
||
$resultPolicy = $policy.sharingAllowedDomainList | ||
|
||
$testResult = ($resultPolicy | Measure-Object).Count -gt 0 | ||
|
||
if ($testResult) { | ||
$testResultMarkdown = "Well done. Your tenant restricts SharePoint Online sharing to specific domains.`n`n%TestResult%" | ||
} else { | ||
$testResultMarkdown = "Your tenant does not restrict SharePoint Online sharing to specific domains." | ||
} | ||
|
||
$resultPolicy | ForEach-Object { | ||
$result = "* $_`n" | ||
$result | Out-Null | ||
} | ||
|
||
$testResultMarkdown = $testResultMarkdown -replace "%TestResult%", $result | ||
|
||
Add-MtTestResultDetail -Result $testResultMarkdown | ||
|
||
return $testResult | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Describe "CISA SCuBA" -Tag "MS.SHAREPOINT", "MS.SHAREPOINT.1.1", "CISA", "Security", "All" { | ||
It "MS.SHAREPOINT.1.1: External sharing for SharePoint SHALL be limited to Existing guests or Only People in your organization." { | ||
|
||
$result = Test-MtCisaSharePointOnlineSharing | ||
|
||
if ($null -ne $result) { | ||
$result | Should -Be $true -Because "external sharing is limited." | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/cisa/spo/Test-MtCisaSpoSharingAllowedDomain.Tests.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Describe "CISA SCuBA" -Tag "MS.SHAREPOINT", "MS.SHAREPOINT.1.3", "CISA", "Security", "All" { | ||
It "MS.SHAREPOINT.1.3: External sharing SHALL be restricted to approved external domains and/or users in approved security groups per interagency collaboration needs." { | ||
|
||
$result = Test-MtCisaSharePointOnlineSharingAllowedDomain | ||
|
||
if ($null -ne $result) { | ||
$result | Should -Be $true -Because "external sharing is limited." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
sidebar_label: SharePoint Online | ||
description: Implementation of CISA SharePoint Online Controls | ||
--- | ||
|
||
# CISA Controls for Microsoft SharePoint Online | ||
|
||
## Overview | ||
|
||
The tests in this section verifies that a Microsoft 365 tenant’s **SharePoint Online** configuration conforms to the policies described in the Secure Cloud Business Applications ([SCuBA](https://cisa.gov/scuba)) Security Configuration Baseline [documents](https://github.com/cisagov/ScubaGear/blob/main/baselines/README.md). | ||
|
||
## Tests | ||
|
||
| Cmdlet Name | CISA Control ID (Link) | | ||
|- | - | | ||
| Test-MtCisaSpoSharing | [MS.SHAREPOINT.1.1v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint11v1) | | ||
| Not Implemented (Not availabile in Graph) | [MS.SHAREPOINT.1.2v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint12v1) | | ||
| Test-MtCisaSpoSharingAllowedDomain | [MS.SHAREPOINT.1.3v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint13v1) | | ||
| Not Implemented (Deprecated setting) | [MS.SHAREPOINT.1.4v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint14v1) | | ||
| Not Implemented | [MS.SHAREPOINT.2.1v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint21v1) | | ||
| Not Implemented | [MS.SHAREPOINT.2.2v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint22v1) | | ||
| Not Implemented | [MS.SHAREPOINT.3.1v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint31v1) | | ||
| Not Implemented | [MS.SHAREPOINT.3.2v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint32v1) | | ||
| Not Implemented | [MS.SHAREPOINT.3.3v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint33v1) | | ||
| Not Implemented | [MS.SHAREPOINT.3.3v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint33v1) | | ||
| Not Implemented | [MS.SHAREPOINT.4.2v1](https://github.com/cisagov/ScubaGear/blob/main/PowerShell/ScubaGear/baselines/sharepoint.md#mssharepoint42v1) | |