Skip to content

Commit

Permalink
Changed Sharepoint policy 1.4 to not-implemented since it relies on d…
Browse files Browse the repository at this point in the history
…eprecated field RequireAcceptingAccountMatchInvitedAccount (#1270)

* changed Sharepoint policy 1.4 to not-implemented since it relies on deprecated field RequireAcceptingAccountMatchInvitedAccount

* removed unnecessary parameter from NotCheckedDeprecation ruleset
  • Loading branch information
tkol2022 authored Aug 12, 2024
1 parent 2e945ba commit a66e4df
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 158 deletions.
27 changes: 6 additions & 21 deletions PowerShell/ScubaGear/Rego/SharepointConfig.rego
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sharepoint
import rego.v1
import data.utils.report.NotCheckedDetails
import data.utils.report.NotCheckedDeprecation
import data.utils.report.CheckedSkippedDetails
import data.utils.report.ReportDetailsBoolean
import data.utils.report.ReportDetailsBooleanWarning
Expand Down Expand Up @@ -167,35 +168,19 @@ tests contains {
# MS.SHAREPOINT.1.4v1
#--

# If SharingCapability is set to Only People In Organization
# OR require account login to be the one on the invite enabled,
# the policy should pass.
tests contains {
"PolicyId": "MS.SHAREPOINT.1.4v1",
"Criticality": "Shall",
"Commandlet": ["Get-SPOTenant", "Get-PnPTenant"],
"ActualValue": [
Tenant.RequireAcceptingAccountMatchInvitedAccount,
SharingCapability
],
"ReportDetails": ReportDetailsBoolean(Status),
"RequirementMet": Status
} if {
SharingCapability != ONLYPEOPLEINORG
Status := Tenant.RequireAcceptingAccountMatchInvitedAccount == true
}

# Based on the fact that Microsoft has removed the setting from the admin center
# and you cannot set the value RequireAcceptingAccountMatchInvitedAccount from Set-SPOTenant anymore,
# we are setting this policy to not-implemented
# and will likely remove it from the baseline in the next version.
tests contains {
"PolicyId": PolicyId,
"Criticality": "Shall/Not-Implemented",
"Commandlet": ["Get-SPOTenant", "Get-PnPTenant"],
"ActualValue": [],
"ReportDetails": CheckedSkippedDetails(PolicyId, Reason),
"ReportDetails": NotCheckedDeprecation,
"RequirementMet": false
} if {
SharingCapability == ONLYPEOPLEINORG
PolicyId := "MS.SHAREPOINT.1.4v1"
Reason := NAString(SliderSettings(0))
}
#--

Expand Down
7 changes: 7 additions & 0 deletions PowerShell/ScubaGear/Rego/Utils/ReportDetails.rego
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ NotCheckedDetails(PolicyId) := sprintf(
[PolicyLink(PolicyId)]
)

# Use this when you need to make a policy not-implemented because of deprecation
NotCheckedDeprecation :=
concat(" ", [
"This configuration setting has been deprecated and we are in the process of removing it from the baseline."
])


# Note: Reason must include %v to reference policy in document.
CheckedSkippedDetails(PolicyId, Reason) := sprintf(
concat(" ", [Reason]), [PolicyLink(PolicyId)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ SPOTenant := {
"SharingCapability": 0,
"OneDriveSharingCapability": 0,
"SharingDomainRestrictionMode": 0,
"RequireAcceptingAccountMatchInvitedAccount": false,
"DefaultSharingLinkType": 1,
"DefaultLinkPermission": 1,
"RequireAnonymousLinksExpireInDays": 30,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sharepoint_test
import rego.v1
import data.sharepoint
import data.utils.report.NotCheckedDetails
import data.utils.report.NotCheckedDeprecation
import data.utils.report.CheckedSkippedDetails
import data.utils.key.TestResult
import data.utils.key.FAIL
Expand Down Expand Up @@ -195,51 +196,11 @@ test_SharingDomainRestrictionMode_SharingCapability_Anyone_Incorrect if {
#
# Policy MS.SHAREPOINT.1.4v1
#--
test_SameAccount_NotApplicable_V1 if {
test_RequireAcceptingAccountMatchInvitedAccount_NotImplemented_V1 if {
PolicyId := "MS.SHAREPOINT.1.4v1"

Output := sharepoint.tests with input.SPO_tenant as [SPOTenant]

ReportDetailsString := concat(" ", [
"This policy is only applicable if External Sharing",
"is set to any value other than Only People In Your Organization.",
"See %v for more info"
])
TestResult(PolicyId, Output, CheckedSkippedDetails(PolicyId, ReportDetailsString), false) == true
}

test_SameAccount_NotApplicable_V2 if {
PolicyId := "MS.SHAREPOINT.1.4v1"

Tenant := json.patch(SPOTenant, [{"op": "add", "path": "RequireAcceptingAccountMatchInvitedAccount", "value": true}])

Output := sharepoint.tests with input.SPO_tenant as [Tenant]

ReportDetailsString := concat(" ", [
"This policy is only applicable if External Sharing",
"is set to any value other than Only People In Your Organization.",
"See %v for more info"
])
TestResult(PolicyId, Output, CheckedSkippedDetails(PolicyId, ReportDetailsString), false) == true
}

test_SameAccount_Correct_V1 if {
Tenant := json.patch(SPOTenant,
[{"op": "add", "path": "RequireAcceptingAccountMatchInvitedAccount", "value": true},
{"op": "add", "path": "SharingCapability", "value": 1}])

Output := sharepoint.tests with input.SPO_tenant as [Tenant]

TestResult("MS.SHAREPOINT.1.4v1", Output, PASS, true) == true
}

test_SameAccount_Incorrect if {
Tenant := json.patch(SPOTenant,
[{"op": "add", "path": "RequireAcceptingAccountMatchInvitedAccount", "value": false},
{"op": "add", "path": "SharingCapability", "value": 1}])

Output := sharepoint.tests with input.SPO_tenant as [Tenant]

TestResult("MS.SHAREPOINT.1.4v1", Output, FAIL, false) == true
TestResult(PolicyId, Output, NotCheckedDeprecation, false) == true
}
#--
49 changes: 2 additions & 47 deletions Testing/Functional/Products/TestPlans/sharepoint.pnp.testplan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,53 +95,8 @@ TestPlan:
- PolicyId: MS.SHAREPOINT.1.4v1
TestDriver: RunScuba
Tests:
- TestDescription: MS.SHAREPOINT.1.4v1 Non-compliant - SharingCapability = ExternalUserSharingOnly (New and existing guests); RequireAcceptingAccountMatchInvitedAccount = false
Preconditions:
- Command: Set-PnPTenant
Splat:
SharingCapability: ExternalUserSharingOnly
RequireAcceptingAccountMatchInvitedAccount: false
Postconditions: []
ExpectedResult: false
- TestDescription: MS.SHAREPOINT.1.4v1 Compliant - SharingCapability = ExternalUserAndGuestSharing (Anyone); RequireAcceptingAccountMatchInvitedAccount = true
Preconditions:
- Command: Set-PnPTenant
Splat:
SharingCapability: ExternalUserAndGuestSharing
RequireAcceptingAccountMatchInvitedAccount: true
Postconditions: []
ExpectedResult: true
- TestDescription: MS.SHAREPOINT.1.4v1 Compliant - SharingCapability = ExistingExternalUserSharingOnly (Existing guests); RequireAcceptingAccountMatchInvitedAccount = true
Preconditions:
- Command: Set-PnPTenant
Splat:
SharingCapability: ExistingExternalUserSharingOnly
RequireAcceptingAccountMatchInvitedAccount: true
Postconditions: []
ExpectedResult: true
- TestDescription: MS.SHAREPOINT.1.4v1 Compliant - SharingCapability = ExternalUserSharingOnly (New and existing guests); RequireAcceptingAccountMatchInvitedAccount = true
Preconditions:
- Command: Set-PnPTenant
Splat:
SharingCapability: ExternalUserSharingOnly
RequireAcceptingAccountMatchInvitedAccount: true
Postconditions: []
ExpectedResult: true
- TestDescription: MS.SHAREPOINT.1.4v1 Non-Applicable - SharingCapability = Disabled (Only people in organization); RequireAcceptingAccountMatchInvitedAccount = true
Preconditions:
- Command: Set-PnPTenant
Splat:
SharingCapability: Disabled
RequireAcceptingAccountMatchInvitedAccount: true
Postconditions: []
IsNotChecked: true
ExpectedResult: false
- TestDescription: MS.SHAREPOINT.1.4v1 Non-Applicable - SharingCapability = Disabled (Only people in organization); RequireAcceptingAccountMatchInvitedAccount = false
Preconditions:
- Command: Set-PnPTenant
Splat:
SharingCapability: Disabled
RequireAcceptingAccountMatchInvitedAccount: false
- TestDescription: MS.SHAREPOINT.1.4v1 RequireAcceptingAccountMatchInvitedAccount Not-Implemented
Preconditions: []
Postconditions: []
IsNotChecked: true
ExpectedResult: false
Expand Down
49 changes: 2 additions & 47 deletions Testing/Functional/Products/TestPlans/sharepoint.spo.testplan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,53 +122,8 @@ TestPlan:
- PolicyId: MS.SHAREPOINT.1.4v1
TestDriver: RunScuba
Tests:
- TestDescription: MS.SHAREPOINT.1.4v1 Non-compliant - SharingCapability = ExternalUserSharingOnly (New and existing guests); RequireAcceptingAccountMatchInvitedAccount = false
Preconditions:
- Command: Set-SPOTenant
Splat:
SharingCapability: ExternalUserSharingOnly
RequireAcceptingAccountMatchInvitedAccount: false
Postconditions: []
ExpectedResult: false
- TestDescription: MS.SHAREPOINT.1.4v1 Compliant - SharingCapability = ExternalUserAndGuestSharing (Anyone); RequireAcceptingAccountMatchInvitedAccount = true
Preconditions:
- Command: Set-SPOTenant
Splat:
SharingCapability: ExternalUserAndGuestSharing
RequireAcceptingAccountMatchInvitedAccount: true
Postconditions: []
ExpectedResult: true
- TestDescription: MS.SHAREPOINT.1.4v1 Compliant - SharingCapability = ExistingExternalUserSharingOnly (Existing guests); RequireAcceptingAccountMatchInvitedAccount = true
Preconditions:
- Command: Set-SPOTenant
Splat:
SharingCapability: ExistingExternalUserSharingOnly
RequireAcceptingAccountMatchInvitedAccount: true
Postconditions: []
ExpectedResult: true
- TestDescription: MS.SHAREPOINT.1.4v1 Compliant - SharingCapability = ExternalUserSharingOnly (New and existing guests); RequireAcceptingAccountMatchInvitedAccount = true
Preconditions:
- Command: Set-SPOTenant
Splat:
SharingCapability: ExternalUserSharingOnly
RequireAcceptingAccountMatchInvitedAccount: true
Postconditions: []
ExpectedResult: true
- TestDescription: MS.SHAREPOINT.1.4v1 Non-Applicable - SharingCapability = Disabled (Only people in organization); RequireAcceptingAccountMatchInvitedAccount = true
Preconditions:
- Command: Set-SPOTenant
Splat:
SharingCapability: Disabled
RequireAcceptingAccountMatchInvitedAccount: true
Postconditions: []
IsNotChecked: true
ExpectedResult: false
- TestDescription: MS.SHAREPOINT.1.4v1 Non-Applicable - SharingCapability = Disabled (Only people in organization); RequireAcceptingAccountMatchInvitedAccount = false
Preconditions:
- Command: Set-SPOTenant
Splat:
SharingCapability: Disabled
RequireAcceptingAccountMatchInvitedAccount: false
- TestDescription: MS.SHAREPOINT.1.4v1 RequireAcceptingAccountMatchInvitedAccount Not-Implemented
Preconditions: []
Postconditions: []
IsNotChecked: true
ExpectedResult: false
Expand Down

0 comments on commit a66e4df

Please sign in to comment.