Skip to content

Commit

Permalink
Remove deleted controls from the Rego
Browse files Browse the repository at this point in the history
  • Loading branch information
adhilto committed Jan 15, 2024
1 parent 015cbe8 commit cb6db95
Show file tree
Hide file tree
Showing 13 changed files with 487 additions and 946 deletions.
78 changes: 39 additions & 39 deletions Testing/RegoTests/gmail/gmail12_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import future.keywords
#
# GWS.GMAIL.12.1v0.1
#--
test_ImageUrlProxyWhitelist_Correct_V1 if {
# Test Image URL Proxy Allowlist when there's only one event
test_PerUserOutboundGateway_Correct_V1 if {
# Test Per-User Outbound Gateway when there's only one event
PolicyId := "GWS.GMAIL.12.1v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
{
"id": {"time": "2022-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "1"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "false"},
{"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"},
]
}]
Expand All @@ -33,17 +33,17 @@ test_ImageUrlProxyWhitelist_Correct_V1 if {
RuleOutput[0].ReportDetails == "Requirement met in all OUs."
}

test_ImageUrlProxyWhitelist_Correct_V2 if {
# Test Image URL Proxy Allowlist when there's multiple events and the most recent is correct
test_PerUserOutboundGateway_Correct_V2 if {
# Test Per-User Outbound Gateway when there's multiple events and the most recent is correct
PolicyId := "GWS.GMAIL.12.1v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
{
"id": {"time": "2022-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "1"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "false"},
{"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"},
]
}]
Expand All @@ -52,8 +52,8 @@ test_ImageUrlProxyWhitelist_Correct_V2 if {
"id": {"time": "2021-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "DEFAULT"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "true"},
{"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"},
]
}]
Expand All @@ -71,17 +71,17 @@ test_ImageUrlProxyWhitelist_Correct_V2 if {
RuleOutput[0].ReportDetails == "Requirement met in all OUs."
}

test_ImageUrlProxyWhitelist_Correct_V3 if {
# Test Image URL Proxy Allowlist when there's correct events in multiple OUs
test_PerUserOutboundGateway_Correct_V3 if {
# Test Per-User Outbound Gateway when there's correct events in multiple OUs
PolicyId := "GWS.GMAIL.12.1v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
{
"id": {"time": "2022-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "1"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "false"},
{"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"},
]
}]
Expand All @@ -90,8 +90,8 @@ test_ImageUrlProxyWhitelist_Correct_V3 if {
"id": {"time": "2022-12-21T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "1"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "false"},
{"name": "ORG_UNIT_NAME", "value": "Secondary OU"},
]
}]
Expand All @@ -109,8 +109,8 @@ test_ImageUrlProxyWhitelist_Correct_V3 if {
RuleOutput[0].ReportDetails == "Requirement met in all OUs."
}

test_ImageUrlProxyWhitelist_Incorrect_V1 if {
# Test Image URL Proxy Allowlist when there are no relevant events
test_PerUserOutboundGateway_Incorrect_V1 if {
# Test Per-User Outbound Gateway when there are no relevant events
PolicyId := "GWS.GMAIL.12.1v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
Expand All @@ -119,7 +119,7 @@ test_ImageUrlProxyWhitelist_Incorrect_V1 if {
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "Something else"},
{"name": "NEW_VALUE", "value": "1"},
{"name": "NEW_VALUE", "value": "false"},
{"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"},
]
}]
Expand All @@ -141,17 +141,17 @@ test_ImageUrlProxyWhitelist_Incorrect_V1 if {
])
}

test_ImageUrlProxyWhitelist_Incorrect_V2 if {
# Test Image URL Proxy Allowlist when there's only one event and it's wrong
test_PerUserOutboundGateway_Incorrect_V2 if {
# Test Per-User Outbound Gateway when there's only one event and it's wrong
PolicyId := "GWS.GMAIL.12.1v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
{
"id": {"time": "2022-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "DEFAULT"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "true"},
{"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"},
]
}]
Expand All @@ -169,17 +169,17 @@ test_ImageUrlProxyWhitelist_Incorrect_V2 if {
RuleOutput[0].ReportDetails == "Requirement failed in Test Top-Level OU."
}

test_ImageUrlProxyWhitelist_Incorrect_V3 if {
# Test Image URL Proxy Allowlist when there are multiple events and the most recent is wrong
test_PerUserOutboundGateway_Incorrect_V3 if {
# Test Per-User Outbound Gateway when there are multiple events and the most recent is wrong
PolicyId := "GWS.GMAIL.12.1v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
{
"id": {"time": "2022-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "DEFAULT"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "true"},
{"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"},
]
}]
Expand All @@ -188,8 +188,8 @@ test_ImageUrlProxyWhitelist_Incorrect_V3 if {
"id": {"time": "2021-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "1"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "false"},
{"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"},
]
}]
Expand All @@ -207,17 +207,17 @@ test_ImageUrlProxyWhitelist_Incorrect_V3 if {
RuleOutput[0].ReportDetails == "Requirement failed in Test Top-Level OU."
}

test_ImageUrlProxyWhitelist_Incorrect_V4 if {
# Test Image URL Proxy Allowlist when there's only one event and it's wrong
test_PerUserOutboundGateway_Incorrect_V4 if {
# Test Per-User Outbound Gateway when there's only one event and it's wrong
PolicyId := "GWS.GMAIL.12.1v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
{
"id": {"time": "2022-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "DEFAULT"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "true"},
{"name": "ORG_UNIT_NAME", "value": "Secondary OU"},
]
}]
Expand All @@ -235,17 +235,17 @@ test_ImageUrlProxyWhitelist_Incorrect_V4 if {
RuleOutput[0].ReportDetails == "Requirement failed in Secondary OU."
}

test_ImageUrlProxyWhitelist_Incorrect_V5 if {
# Test Image URL Proxy Allowlist when there are multiple events and the most recent is wrong
test_PerUserOutboundGateway_Incorrect_V5 if {
# Test Per-User Outbound Gateway when there are multiple events and the most recent is wrong
PolicyId := "GWS.GMAIL.12.1v0.1"
Output := tests with input as {
"gmail_logs": {"items": [
{
"id": {"time": "2022-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "DEFAULT"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "true"},
{"name": "ORG_UNIT_NAME", "value": "Secondary OU"},
]
}]
Expand All @@ -254,8 +254,8 @@ test_ImageUrlProxyWhitelist_Incorrect_V5 if {
"id": {"time": "2021-12-20T00:02:28.672Z"},
"events": [{
"parameters": [
{"name": "SETTING_NAME", "value": "NUMBER_OF_EMAIL_IMAGE_URL_WHITELIST_PATTERNS"},
{"name": "NEW_VALUE", "value": "1"},
{"name": "SETTING_NAME", "value": "OUTBOUND_RELAY_ENABLED"},
{"name": "NEW_VALUE", "value": "false"},
{"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"},
]
}]
Expand Down
Loading

0 comments on commit cb6db95

Please sign in to comment.