Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Each Control Is Included in the Reports #158

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions Testing/RegoTests/gmail/gmail03_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,31 @@ import future.keywords
#
# GWS.GMAIL.3.1v0.1
#--
test_MaintainList_Correct_V1 if {
# Test not implemented
PolicyId := "GWS.GMAIL.17.1v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
]},
"tenant_info": {
"topLevelOU": ""
}
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
count(RuleOutput) == 1
not RuleOutput[0].RequirementMet
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Currently not able to be tested automatically; please manually check."
}
#--

#
# GWS.GMAIL.3.2v0.1
#--
test_SPF_Correct_V1 if {
# Test SPF when there's only one domain
PolicyId := "GWS.GMAIL.3.1v0.1"
PolicyId := "GWS.GMAIL.3.2v0.1"
Output := tests with input as {
"dkim_records": [
{
Expand All @@ -32,7 +54,7 @@ test_SPF_Correct_V1 if {

test_SPF_Correct_V2 if {
# Test SPF when there's multiple domains
PolicyId := "GWS.GMAIL.3.1v0.1"
PolicyId := "GWS.GMAIL.3.2v0.1"
Output := tests with input as {
"dkim_records": [
{
Expand Down Expand Up @@ -65,7 +87,7 @@ test_SPF_Correct_V2 if {

test_SPF_Incorrect_V1 if {
# Test SPF when there's multiple domains and only one is correct
PolicyId := "GWS.GMAIL.3.1v0.1"
PolicyId := "GWS.GMAIL.3.2v0.1"
Output := tests with input as {
"dkim_records": [
{
Expand Down Expand Up @@ -98,7 +120,7 @@ test_SPF_Incorrect_V1 if {

test_SPF_Incorrect_V2 if {
# Test SPF when there's only one domain and it's wrong
PolicyId := "GWS.GMAIL.3.1v0.1"
PolicyId := "GWS.GMAIL.3.2v0.1"
Output := tests with input as {
"dkim_records": [
{
Expand Down
21 changes: 21 additions & 0 deletions Testing/RegoTests/gmail/gmail10_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,26 @@ test_GoogleWorkspaceSync_Incorrect_V5 if {
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Requirement failed in Secondary OU."
}
#--

#
# GWS.GMAIL.10.2v0.1
#--
test_May_Correct_V1 if {
# Test not implemented
PolicyId := "GWS.GMAIL.10.2v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
]},
"tenant_info": {
"topLevelOU": ""
}
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
count(RuleOutput) == 1
not RuleOutput[0].RequirementMet
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Currently not able to be tested automatically; please manually check."
}
#--
22 changes: 22 additions & 0 deletions Testing/RegoTests/gmail/gmail15_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,26 @@ test_EnhancedPreDeliveryMessageScanning_Incorrect_V5 if {
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Requirement failed in Secondary OU."
}
#--

#
# GWS.GMAIL.15.2v0.1
#--
test_Other_Correct_V1 if {
# Test not implemented
PolicyId := "GWS.GMAIL.15.2v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
]},
"tenant_info": {
"topLevelOU": ""
}
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
count(RuleOutput) == 1
not RuleOutput[0].RequirementMet
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Currently not able to be tested automatically; please manually check."
}
#--
22 changes: 22 additions & 0 deletions Testing/RegoTests/gmail/gmail16_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,26 @@ test_SecuritySandbox_Incorrect_V5 if {
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Requirement failed in Secondary OU."
}
#--

#
# GWS.GMAIL.16.2v0.1
#--
test_Other_Correct_V1 if {
# Test not implemented
PolicyId := "GWS.GMAIL.16.2v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
]},
"tenant_info": {
"topLevelOU": ""
}
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
count(RuleOutput) == 1
not RuleOutput[0].RequirementMet
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Currently not able to be tested automatically; please manually check."
}
#--
44 changes: 44 additions & 0 deletions Testing/RegoTests/gmail/gmail18_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,48 @@ test_AdvanvedEmailContentFitlering_Correct_V1 if {
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Currently not able to be tested automatically; please manually check."
}
#--

#
# GWS.GMAIL.18.2v0.1
#--
test_Other_Correct_V1 if {
# Test not implemented
PolicyId := "GWS.GMAIL.18.2v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
]},
"tenant_info": {
"topLevelOU": ""
}
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
count(RuleOutput) == 1
not RuleOutput[0].RequirementMet
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Currently not able to be tested automatically; please manually check."
}
#--

#
# GWS.GMAIL.18.3v0.1
#--
test_PII_Correct_V1 if {
# Test not implemented
PolicyId := "GWS.GMAIL.18.3v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
]},
"tenant_info": {
"topLevelOU": ""
}
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
count(RuleOutput) == 1
not RuleOutput[0].RequirementMet
not RuleOutput[0].NoSuchEvent
RuleOutput[0].ReportDetails == "Currently not able to be tested automatically; please manually check."
}
#--
85 changes: 83 additions & 2 deletions rego/Gmail.rego
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,28 @@ if {
#
# Baseline GWS.GMAIL.3.1v0.1
#--
# No implementation steps provided for this policy
tests contains {
"PolicyId": "GWS.GMAIL.3.1v0.1",
"Criticality": "Shall/Not-Implemented",
"ReportDetails": "Currently not able to be tested automatically; please manually check.",
"ActualValue": "",
"RequirementMet": false,
"NoSuchEvent": false
}
#--

#
# Baseline GWS.GMAIL.3.2v0.1
#--
DomainsWithSpf contains SpfRecord.domain if {
some SpfRecord in input.spf_records
some Rdata in SpfRecord.rdata
startswith(Rdata, "v=spf1 ")
}

tests contains {
"PolicyId": "GWS.GMAIL.3.1v0.1",
"PolicyId": "GWS.GMAIL.3.2v0.1",
"Criticality": "Shall",
"ReportDetails": ReportDetailsArray(Status, DomainsWithoutSpf, AllDomains),
"ActualValue": DomainsWithoutSpf,
Expand Down Expand Up @@ -517,7 +531,8 @@ tests contains {
"ReportDetails": "Currently not able to be tested automatically; please manually check.",
"ActualValue": "",
"RequirementMet": false,
"NoSuchEvent": false}
"NoSuchEvent": false
}
#--

###############
Expand Down Expand Up @@ -1349,6 +1364,19 @@ if {
}
#--

#
# Baseline GWS.GMAIL.10.2v0.1
#--
# No implementation steps provided for this policy
tests contains {
"PolicyId": "GWS.GMAIL.10.2v0.1",
"Criticality": "May/Not-Implemented",
"ReportDetails": "Currently not able to be tested automatically; please manually check.",
"ActualValue": "",
"RequirementMet": false,
"NoSuchEvent": false
}
#--

################
# GWS.GMAIL.11 #
Expand Down Expand Up @@ -1608,6 +1636,19 @@ if {
}
#--

#
# Baseline GWS.GMAIL.15.2v0.1
#--
# No implementation steps provided for this policy
tests contains {
"PolicyId": "GWS.GMAIL.15.2v0.1",
"Criticality": "Should/Not-Implemented",
"ReportDetails": "Currently not able to be tested automatically; please manually check.",
"ActualValue": "",
"RequirementMet": false,
"NoSuchEvent": false
}
#--

################
# GWS.GMAIL.16 #
Expand Down Expand Up @@ -1660,6 +1701,19 @@ if {
}
#--

#
# Baseline GWS.GMAIL.16.2v0.1
#--
# No implementation steps provided for this policy
tests contains {
"PolicyId": "GWS.GMAIL.16.2v0.1",
"Criticality": "Should/Not-Implemented",
"ReportDetails": "Currently not able to be tested automatically; please manually check.",
"ActualValue": "",
"RequirementMet": false,
"NoSuchEvent": false
}
#--

################
# GWS.GMAIL.17 #
Expand Down Expand Up @@ -1700,6 +1754,33 @@ tests contains {
}
#--

#
# Baseline GWS.GMAIL.18.2v0.1
#--
# No implementation steps provided for this policy
tests contains {
"PolicyId": "GWS.GMAIL.18.2v0.1",
"Criticality": "Should/Not-Implemented",
"ReportDetails": "Currently not able to be tested automatically; please manually check.",
"ActualValue": "",
"RequirementMet": false,
"NoSuchEvent": false
}
#--

#
# Baseline GWS.GMAIL.18.3v0.1
#--
# No implementation steps provided for this policy
tests contains {
"PolicyId": "GWS.GMAIL.18.3v0.1",
"Criticality": "Shall/Not-Implemented",
"ReportDetails": "Currently not able to be tested automatically; please manually check.",
"ActualValue": "",
"RequirementMet": false,
"NoSuchEvent": false
}
#--

################
# GWS.GMAIL.19 #
Expand Down
Loading