From 1d6869c242dac1dcc3647290390c35ccbeecc10e Mon Sep 17 00:00:00 2001 From: Roy Lane Date: Fri, 3 Jan 2025 10:30:58 -0500 Subject: [PATCH] drive rego: remove log event implementation for 1.1 - 4.1 & 6.1 --- .../Testing/RegoTests/drive/drive01_test.rego | 2118 ----------------- .../Testing/RegoTests/drive/drive02_test.rego | 1040 -------- .../Testing/RegoTests/drive/drive03_test.rego | 372 --- .../Testing/RegoTests/drive/drive04_test.rego | 248 -- .../Testing/RegoTests/drive/drive06_test.rego | 373 --- scubagoggles/rego/Drive.rego | 1036 +------- 6 files changed, 63 insertions(+), 5124 deletions(-) delete mode 100644 scubagoggles/Testing/RegoTests/drive/drive01_test.rego delete mode 100644 scubagoggles/Testing/RegoTests/drive/drive02_test.rego delete mode 100644 scubagoggles/Testing/RegoTests/drive/drive03_test.rego delete mode 100644 scubagoggles/Testing/RegoTests/drive/drive04_test.rego delete mode 100644 scubagoggles/Testing/RegoTests/drive/drive06_test.rego diff --git a/scubagoggles/Testing/RegoTests/drive/drive01_test.rego b/scubagoggles/Testing/RegoTests/drive/drive01_test.rego deleted file mode 100644 index e9e36c50..00000000 --- a/scubagoggles/Testing/RegoTests/drive/drive01_test.rego +++ /dev/null @@ -1,2118 +0,0 @@ -package drive - -import future.keywords -import data.utils.FailTestNoEvent -import data.utils.FailTestOUNonCompliant -import data.utils.PassTestResult - -# -# GWS.DRIVEDOCS.1.1 -#-- -test_Sharing_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId1_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Sharing_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId1_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Sharing_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId1_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Sharing_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId1_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_Sharing_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId1_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_1(GetFriendlyValue1_1("SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Sharing_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId1_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_1(GetFriendlyValue1_1("SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Sharing_Incorrect_V4 if { - # Test sharing setting when there are multiple OUs and secondary is wrong - PolicyId := DriveId1_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage1_1(GetFriendlyValue1_1("SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Sharing_Incorrect_V5 if { - # Test sharing setting when the top OU is not present but there is another - PolicyId := DriveId1_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} -#-- - -# -# GWS.DRIVEDOCS.1.2 -#-- -test_Receiving_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId1_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Receiving_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId1_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Receiving_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId1_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Receiving_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId1_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_Receiving_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId1_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": EventNonComplianceMessage1_2(EventGetFriendlyValue1_2("SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Receiving_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId1_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": EventNonComplianceMessage1_2(EventGetFriendlyValue1_2("SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Receiving_Incorrect_V4 if { - # Test sharing setting when there are multiple OUs, top OU is compliant but secondary isn't - PolicyId := DriveId1_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": EventNonComplianceMessage1_2(EventGetFriendlyValue1_2("SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Receiving_Incorrect_V5 if { - # Test sharing setting when top level OU is not present - PolicyId := DriveId1_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -# -# GWS.DRIVEDOCS.1.3 -#-- - -test_Warnings_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId1_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Warnings_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId1_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Warnings_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId1_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Warnings_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId1_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} - -test_Warnings_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId1_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": EventNonComplianceMessage1_3(EventGetFriendlyValue1_3("SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Warnings_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId1_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": EventNonComplianceMessage1_3(EventGetFriendlyValue1_3("SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Warnings_Incorrect_V4 if { - # Test sharing setting when Top OU is correct but not secondary OU - PolicyId := DriveId1_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": EventNonComplianceMessage1_3(EventGetFriendlyValue1_3("SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Warnings_Incorrect_V5 if { - # Test sharing setting when Top OU is not present - PolicyId := DriveId1_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-27-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} - -# -# GWS.DRIVEDOCS.1.4 -#-- - -test_NonGoogle_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId1_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_NonGoogle_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId1_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_NonGoogle_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId1_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_NonGoogle_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId1_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_NonGoogle_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId1_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "ANONYMOUS_PREVIEW"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": EventNonComplianceMessage1_4(EventGetFriendlyValue1_4("ANONYMOUS_PREVIEW", - "SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_NonGoogle_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId1_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "ANONYMOUS_PREVIEW"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-13-23T00:02:28.672Z"}, # incorrect timestamp?? - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-14-24T00:02:28.672Z"}, # incorrect timestamp?? - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": EventNonComplianceMessage1_4(EventGetFriendlyValue1_4("ANONYMOUS_PREVIEW", - "SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_NonGoogle_Incorrect_V4 if { - # Test sharing setting when Top OU is correct but not secondary OU - PolicyId := DriveId1_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-24T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_OUTSIDE_DOMAIN"}, - {"name": "NEW_VALUE", "value": "SHARING_NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": EventNonComplianceMessage1_4(EventGetFriendlyValue1_4("ALLOWED", - "SHARING_ALLOWED"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_NonGoogle_Incorrect_V5 if { - # Test sharing setting when Top OU is not present - PolicyId := DriveId1_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId] - count(RuleOutput) == 1 - not RuleOutput[0].RequirementMet - RuleOutput[0].NoSuchEvent - RuleOutput[0].ReportDetails == concat("", [ - "No relevant event in the current logs for the top-level OU, Test Top-Level OU. ", - "While we are unable to determine the state from the logs, the default setting ", - "is non-compliant; manual check recommended." - ]) -} - -# -# GWS.DRIVEDOCS.1.5 -#-- - -test_Link_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId1_5 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Link_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId1_5 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Link_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId1_5 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Link_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId1_5 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_Link_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId1_5 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_5}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Link_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId1_5 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_5}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Link_Incorrect_V4 if { - # Test sharing setting when Top OU is correct but not secondary OU - PolicyId := DriveId1_5 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage1_5}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Link_Incorrect_V5 if { - # Test sharing setting when Top OU is not present - PolicyId := DriveId1_5 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "PUBLISHING_TO_WEB"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} -#-- - -# -# GWS.DRIVEDOCS.1.6 -#-- -test_SharingChecker_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId1_6 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "NAMED_PARTIES_ONLY"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_SharingChecker_Correct_V2 if { - # Test setting when there's multiple events and the most most recent is correct - PolicyId := DriveId1_6 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "NAMED_PARTIES_ONLY"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "DOMAIN_OR_NAMED_PARTIES"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_SharingChecker_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId1_6 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "NAMED_PARTIES_ONLY"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "NAMED_PARTIES_ONLY"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_SharingChecker_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId1_6 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "NOT_ALLOWED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_SharingChecker_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId1_6 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "ALL"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_6(GetFriendlyValue1_6("ALL"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_SharingChecker_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId1_6 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "ALL"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "NAMED_PARTIES_ONLY"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_6(GetFriendlyValue1_6("ALL"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_SharingChecker_Incorrect_V4 if { - # Test sharing setting when Top OU is correct but not secondary OU - PolicyId := DriveId1_6 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "NAMED_PARTIES_ONLY"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "DOMAIN_OR_NAMED_PARTIES"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage1_6(GetFriendlyValue1_6("DOMAIN_OR_NAMED_PARTIES"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_SharingChecker_Incorrect_V5 if { - # Test sharing setting when Top OU is not present - PolicyId := DriveId1_6 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_ACCESS_CHECKER_OPTIONS"}, - {"name": "NEW_VALUE", "value": "NAMED_PARTIES_ONLY"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -# -# GWS.DRIVEDOCS.1.7 -#-- - -test_CrossDomain_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId1_7 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_MOVES_BLOCKED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_CrossDomain_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId1_7 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_MOVES_BLOCKED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_FROM_INTERNAL_OR_EXTERNAL"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_CrossDomain_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId1_7 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_MOVES_BLOCKED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_MOVES_BLOCKED"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_CrossDomain_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId1_7 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_MOVES_BLOCKED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_CrossDomain_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId1_7 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_FROM_INTERNAL_OR_EXTERNAL"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_7("Anyone")}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_CrossDomain_Incorrect_V3 if { - # Test sharing setting when there are multiple events and - # the most recent is wrong, set to anyone can distribute content. - PolicyId := DriveId1_7 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_FROM_INTERNAL_OR_EXTERNAL"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_MOVES_BLOCKED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_7("Anyone")}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_CrossDomain_Incorrect_V4 if { - # Test sharing setting when Top OU is correct but not secondary OU, - # which is set to Anyone in the Organization - PolicyId := DriveId1_7 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_MOVES_BLOCKED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_FROM_INTERNAL_OR_EXTERNAL"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage1_7("Anyone")}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_CrossDomain_Incorrect_V5 if { - # Test sharing setting when Top OU is not present - PolicyId := DriveId1_7 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_MOVES_BLOCKED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_CrossDomain_Incorrect_V6 if { - # Test sharing setting when there are multiple events and - # the most recent event is wrong, set to only users in the organization - PolicyId := DriveId1_7 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_FROM_INTERNAL_ONLY"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS"}, - {"name": "NEW_VALUE", "value": "CROSS_DOMAIN_MOVES_BLOCKED"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_7("Only users inside the organization")}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} -#-- - -# -# GWS.DRIVEDOCS.1.8 -#-- - -test_Default_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId1_8 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PRIVATE"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Default_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId1_8 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PRIVATE"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PUBLIC"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Default_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId1_8 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PRIVATE"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PRIVATE"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Default_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId1_8 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "PRIVATE"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} - -test_Default_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId1_8 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PUBLIC"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_8(GetFriendlyValue1_8("PUBLIC"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Default_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId1_8 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PUBLIC"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PRIVATE"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage1_8(GetFriendlyValue1_8("PUBLIC"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Default_Incorrect_V4 if { - # Test sharing setting when Top OU is correct but not secondary OU - PolicyId := DriveId1_8 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PRIVATE"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PUBLIC"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage1_8(GetFriendlyValue1_8("PUBLIC"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Default_Incorrect_V5 if { - # Test sharing setting when Top OU is not present - PolicyId := DriveId1_8 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PRIVATE"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} - -test_Default_Incorrect_V6 if { - # Test sharing setting when Top OU is correct but not secondary OU - PolicyId := DriveId1_8 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PRIVATE"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DEFAULT_LINK_SHARING_FOR_NEW_DOCS"}, - {"name": "NEW_VALUE", "value": "PEOPLE_WITH_LINK"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage1_8(GetFriendlyValue1_8("PEOPLE_WITH_LINK"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} diff --git a/scubagoggles/Testing/RegoTests/drive/drive02_test.rego b/scubagoggles/Testing/RegoTests/drive/drive02_test.rego deleted file mode 100644 index d05bef03..00000000 --- a/scubagoggles/Testing/RegoTests/drive/drive02_test.rego +++ /dev/null @@ -1,1040 +0,0 @@ -package drive - -import future.keywords -import data.utils.FailTestNoEvent -import data.utils.FailTestOUNonCompliant -import data.utils.PassTestResult - -# -# GWS.DRIVEDOCS.2.1 -#-- - -test_Managers_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId2_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Managers_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId2_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Managers_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId2_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Managers_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId2_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_Managers_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId2_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage2_1}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Managers_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId2_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage2_1}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Managers_Incorrect_V4 if { - # Test sharing setting when top OU is correct but secondary isn't - PolicyId := DriveId2_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage2_1}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Managers_Incorrect_V5 if { - # Test sharing setting when top OU is missing - PolicyId := DriveId2_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_admin_only"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -# -# GWS.DRIVEDOCS.2.2 -#-- - -test_Outside_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId2_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Outside_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId2_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Outside_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId2_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Outside_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId2_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_Outside_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId2_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage2_2}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Outside_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId2_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage2_2}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Outside_Incorrect_V4 if { - # Test sharing setting when top OU is correct but secondary isn't - PolicyId := DriveId2_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage2_2}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Outside_Incorrect_V5 if { - # Test sharing setting when top OU is missing - PolicyId := DriveId2_2 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -# -# GWS.DRIVEDOCS.2.3 -#-- - -test_SharedDrive_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId2_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_SharedDrive_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId2_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_SharedDrive_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId2_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_SharedDrive_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId2_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} - -test_SharedDrive_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId2_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage2_3}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_SharedDrive_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId2_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage2_3}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_SharedDrive_Incorrect_V4 if { - # Test sharing setting when top OU is correct but secondary isn't - PolicyId := DriveId2_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage2_3}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_SharedDrive_Incorrect_V5 if { - # Test sharing setting when top OU is missing - PolicyId := DriveId2_3 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Shared Drive Creation new_team_drive_restricts_direct_access" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} - -# -# GWS.DRIVEDOCS.2.4 -#-- - -test_Viewers_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId2_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Viewers_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId2_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Viewers_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId2_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Viewers_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId2_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} - -test_Viewers_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId2_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage2_4}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Viewers_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId2_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage2_4}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Viewers_Incorrect_V4 if { - # Test sharing setting when top OU is correct but secondary isn't - PolicyId := DriveId2_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage2_4}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Viewers_Incorrect_V5 if { - # Test sharing setting when top OU is missing - PolicyId := DriveId2_4 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Shared Drive Creation new_team_drive_restricts_download"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} diff --git a/scubagoggles/Testing/RegoTests/drive/drive03_test.rego b/scubagoggles/Testing/RegoTests/drive/drive03_test.rego deleted file mode 100644 index 430d547e..00000000 --- a/scubagoggles/Testing/RegoTests/drive/drive03_test.rego +++ /dev/null @@ -1,372 +0,0 @@ -package drive - -import future.keywords -import data.utils.FailTestNoEvent -import data.utils.FailTestOUNonCompliant -import data.utils.PassTestResult - -# -# GWS.DRIVEDOCS.3.1 -#-- - -test_Sharing_Correct_V1 if { - # Test sharing setting when there's only one event - PolicyId := DriveId3_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Link Security Update Settings less_secure_link_option"}, - {"name": "NEW_VALUE", "value": "REMOVE_LESS_SECURE_LINKS"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Sharing_Correct_V2 if { - # Test sharing setting when there's multiple events and the most most recent is correct - PolicyId := DriveId3_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Link Security Update Settings less_secure_link_option"}, - {"name": "NEW_VALUE", "value": "REMOVE_LESS_SECURE_LINKS"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Sharing_Correct_V3 if { - # Test sharing setting when there's multiple OUs - PolicyId := DriveId3_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Link Security Update Settings less_secure_link_option"}, - {"name": "NEW_VALUE", "value": "REMOVE_LESS_SECURE_LINKS"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Link Security Update Settings less_secure_link_option"}, - {"name": "NEW_VALUE", "value": "REMOVE_LESS_SECURE_LINKS"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Sharing_Incorrect_V1 if { - # Test sharing setting when there are no relevant events - PolicyId := DriveId3_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} - -test_Sharing_Incorrect_V2 if { - # Test sharing setting when there's only one event and it's wrong - PolicyId := DriveId3_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Link Security Update Settings less_secure_link_option"}, - {"name": "NEW_VALUE", "value": "LESS_SECURE_LINKS"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage3_1("", "true")}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Sharing_Incorrect_V3 if { - # Test sharing setting when there are multiple events and the most recent is wrong - PolicyId := DriveId3_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Link Security Update Settings less_secure_link_option"}, - {"name": "NEW_VALUE", "value": "LESS_SECURE_LINKS"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage3_1("", "true")}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Sharing_Incorrect_V4 if { - # Test sharing setting when top level ou is correct but secondary isn't - PolicyId := DriveId3_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Link Security Update Settings less_secure_link_option"}, - {"name": "NEW_VALUE", "value": "REMOVE_LESS_SECURE_LINKS"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Link Security Update Settings less_secure_link_option"}, - {"name": "NEW_VALUE", "value": "LESS_SECURE_LINKS"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:27.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage3_1("", "true")}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Sharing_Incorrect_V5 if { - # Test sharing setting when top level ou is missing - PolicyId := DriveId3_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - { - "name": "SETTING_NAME", - "value": "Link Security Update Settings allow_less_secure_link_user_restore" - }, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Link Security Update Settings less_secure_link_option"}, - {"name": "NEW_VALUE", "value": "REMOVE_LESS_SECURE_LINKS"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", true) -} diff --git a/scubagoggles/Testing/RegoTests/drive/drive04_test.rego b/scubagoggles/Testing/RegoTests/drive/drive04_test.rego deleted file mode 100644 index 8c249e06..00000000 --- a/scubagoggles/Testing/RegoTests/drive/drive04_test.rego +++ /dev/null @@ -1,248 +0,0 @@ -package drive - -import future.keywords -import data.utils.FailTestNoEvent -import data.utils.FailTestOUNonCompliant -import data.utils.PassTestResult - -# -# GWS.DRIVEDOCS.4.1 -#-- - -test_Security_Correct_V1 if { - # Test security setting when there's only one event - PolicyId := DriveId4_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Security_Correct_V2 if { - # Test security setting when there's multiple events and the most most recent is correct - PolicyId := DriveId4_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Security_Correct_V3 if { - # Test security setting when there's multiple OUs - PolicyId := DriveId4_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_Security_Incorrect_V1 if { - # Test security setting when there are no relevant events - PolicyId := DriveId4_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "Something else"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} - -test_Security_Incorrect_V2 if { - # Test security setting when there's only one event and it's wrong - PolicyId := DriveId4_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage4_1}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Security_Incorrect_V3 if { - # Test security setting when there are multiple events and the most recent is wrong - PolicyId := DriveId4_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - }, - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage4_1}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Security_Incorrect_V4 if { - # Test security setting when top level OU is right but secondary isn't - PolicyId := DriveId4_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - failedOU := [{"Name": "Test Secondary OU", - "Value": NonComplianceMessage4_1}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_Security_Incorrect_V5 if { - # Test security setting when top level OU is missing - PolicyId := DriveId4_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2021-12-20T00:02:28.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "ENABLE_DRIVE_APPS"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Secondary OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - }, - } - - FailTestNoEvent(PolicyId, Output, "Test Top-Level OU", false) -} diff --git a/scubagoggles/Testing/RegoTests/drive/drive06_test.rego b/scubagoggles/Testing/RegoTests/drive/drive06_test.rego deleted file mode 100644 index b4fbdaa3..00000000 --- a/scubagoggles/Testing/RegoTests/drive/drive06_test.rego +++ /dev/null @@ -1,373 +0,0 @@ -package drive - -import future.keywords -import data.utils.FailTestOUNonCompliant -import data.utils.PassTestResult - -# -# GWS.DRIVE.6.1 -#-- - -test_DriveFs_Setting_Correct_V1 if { - # Test Drive setting when there's OU inhertitence setting - PolicyId := DriveId6_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:22.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-13-20T00:02:23.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-14-20T00:02:24.672Z"}, - "events": [{ - "name": "DELETE_APPLICATION_SETTING", - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "ORG_UNIT_NAME", "value": "Test Second-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-15-20T00:02:25.672Z"}, - "events": [{ - "name": "DELETE_APPLICATION_SETTING", - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "ORG_UNIT_NAME", "value": "Test Second-Level OU"} - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_DriveFs_Setting_Correct_V2 if { - # Test Drive setting when there's multiple events - PolicyId := DriveId6_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:22.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-13-20T00:02:23.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-14-20T00:02:22.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_DriveFs_Setting_Correct_V3 if { - # Test Drive setting when there's multiple events and inherited OU setting - PolicyId := DriveId6_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:22.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-13-20T00:02:23.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-17-20T00:02:24.672Z"}, - "events": [{ - "name": "DELETE_APPLICATION_SETTING", - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "ORG_UNIT_NAME", "value": "Test Second-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-18-20T00:02:25.672Z"}, - "events": [{ - "name": "DELETE_APPLICATION_SETTING", - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "ORG_UNIT_NAME", "value": "Test Second-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-14-20T00:02:22.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - PassTestResult(PolicyId, Output) -} - -test_DriveFs_Setting_Correct_V4 if { - # Test Drive setting when there's multiple events - PolicyId := DriveId6_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:22.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-13-20T00:02:23.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"} - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - PassTestResult(PolicyId, Output) -} - -test_DriveFs_Setting_InCorrect_V1 if { - # Test Drive setting when there's only one event - PolicyId := DriveId6_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:24.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:25.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage6_1(GetFriendlyValue6_1("false", "true"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_DriveFs_Setting_InCorrect_V2 if { - # Test Drive setting when there's multiple events - PolicyId := DriveId6_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:24.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:25.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-22-20T00:02:24.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-21-20T00:02:25.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary-Level OU"}, - ] - }] - } - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage6_1(GetFriendlyValue6_1("false", "true"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} - -test_DriveFs_Setting_InCorrect_V3 if { - # Test Drive setting when there's multiple events - PolicyId := DriveId6_1 - Output := tests with input as { - "drive_logs": {"items": [ - { - "id": {"time": "2022-12-20T00:02:24.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-12-20T00:02:25.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Test Top-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-05-20T00:02:24.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "NEW_VALUE", "value": "true"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-05-20T00:02:25.672Z"}, - "events": [{ - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "NEW_VALUE", "value": "false"}, - {"name": "ORG_UNIT_NAME", "value": "Secondary-Level OU"}, - ] - }] - }, - { - "id": {"time": "2022-17-20T00:02:24.672Z"}, - "events": [{ - "name": "DELETE_APPLICATION_SETTING", - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto company_owned_only_enabled"}, - {"name": "ORG_UNIT_NAME", "value": "Test Second-Level OU"} - ] - }] - }, - { - "id": {"time": "2022-18-20T00:02:25.672Z"}, - "events": [{ - "name": "DELETE_APPLICATION_SETTING", - "parameters": [ - {"name": "SETTING_NAME", "value": "DriveFsSettingsProto drive_fs_enabled"}, - {"name": "ORG_UNIT_NAME", "value": "Test Second-Level OU"} - ] - }] - }, - ]}, - "tenant_info": { - "topLevelOU": "Test Top-Level OU" - } - } - - failedOU := [{"Name": "Test Top-Level OU", - "Value": NonComplianceMessage6_1(GetFriendlyValue6_1("false", "true"))}] - FailTestOUNonCompliant(PolicyId, Output, failedOU) -} diff --git a/scubagoggles/rego/Drive.rego b/scubagoggles/rego/Drive.rego index 0ecf7955..53ce8bd7 100644 --- a/scubagoggles/rego/Drive.rego +++ b/scubagoggles/rego/Drive.rego @@ -2,7 +2,6 @@ package drive import future.keywords import data.utils -import data.utils.PolicyApiInUse LogEvents := utils.GetEvents("drive_logs") @@ -18,55 +17,15 @@ DriveEnabled(orgunit) := utils.AppEnabled(input.policies, "drive_and_docs", orgu DriveId1_1 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.1.1") -LogMessage1_1 := "SHARING_OUTSIDE_DOMAIN" - -Check1_1_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage1_1, utils.TopLevelOU) - count(events) > 0 -} - -Check1_1_OK if {PolicyApiInUse} - GetFriendlyValue1_1(Value) := "with Google accounts in compatible allowlisted domains" if { - Value in {"TRUSTED_DOMAINS", "ALLOWLISTED_DOMAINS"} + Value == "ALLOWLISTED_DOMAINS" } else := "outside of the organization" if { - Value in {"SHARING_ALLOWED", "ALLOWED"} + Value == "ALLOWED" } else := Value NonComplianceMessage1_1(value) := sprintf("Files owned by users or shared drives can be shared %s", [value]) -NonCompliantOUs1_1 contains { - "Name": OU, - "Value": NonComplianceMessage1_1(GetFriendlyValue1_1(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage1_1, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - AcceptableValues := {"SHARING_NOT_ALLOWED", "INHERIT_FROM_PARENT", - "SHARING_NOT_ALLOWED_BUT_MAY_RECEIVE_FILES"} - not LastEvent.NewValue in AcceptableValues -} - -NonCompliantGroups1_1 contains { - "Name": Group, - "Value": NonComplianceMessage1_1(GetFriendlyValue1_1(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage1_1, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - AcceptableValues := {"SHARING_NOT_ALLOWED", "INHERIT_FROM_PARENT", - "SHARING_NOT_ALLOWED_BUT_MAY_RECEIVE_FILES"} - not LastEvent.NewValue in AcceptableValues -} - # There are subsequent baselines that apply only if external sharing is # allowed. For a given OU, sharing is enabled if either it's enabled in # the top-level OU or it has been enabled explicitly in the OU. First, @@ -95,29 +54,13 @@ if { tests contains { "PolicyId": DriveId1_1, "Criticality": "Should", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := false - not Check1_1_OK -} - -tests contains { - "PolicyId": DriveId1_1, - "Criticality": "Should", - "ReportDetails": utils.ReportDetails(NonCompliantOUs1_1, NonCompliantGroups1_1), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_1, "NonCompliantGroups": NonCompliantGroups1_1}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs1_1, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_1}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check1_1_OK - Conditions := {count(NonCompliantOUs1_1) == 0, count(NonCompliantGroups1_1) == 0 } - Status := (false in Conditions) == false + Status := count(NonCompliantOUs1_1) == 0 } #-- @@ -127,18 +70,8 @@ if { DriveId1_2 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.1.2") -LogMessage1_2 := "SHARING_OUTSIDE_DOMAIN" - -Check1_2_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage1_2, utils.TopLevelOU) - count(events) > 0 -} - -Check1_2_OK if {PolicyApiInUse} - EventGetFriendlyValue1_2(Value) := "cannot" if { - Value in {"SHARING_NOT_ALLOWED INHERIT_FROM_PARENT", false} + Value == false } else := "can" EventNonComplianceMessage1_2(value) := sprintf("Users %s receive files outside the domain", @@ -155,36 +88,6 @@ GetSharingValue(ShareSetting) := "allowlisted" if { NonComplianceMessage1_2(Value) := sprintf("File sharing with %s domains, %s", [Value, "receiving files permitted."]) -NonCompliantOUs1_2 contains { - "Name": OU, - "Value": EventNonComplianceMessage1_2(EventGetFriendlyValue1_2(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage1_2, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - AcceptableValues = {"SHARING_NOT_ALLOWED", "INHERIT_FROM_PARENT", - "TRUSTED_DOMAINS_ALLOWED", "TRUSTED_DOMAINS_ALLOWED_WITH_WARNING"} - not LastEvent.NewValue in AcceptableValues -} - -NonCompliantGroups1_2 contains { - "Name": Group, - "Value": EventNonComplianceMessage1_2(EventGetFriendlyValue1_2(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage1_2, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - AcceptableValues = {"SHARING_NOT_ALLOWED", "INHERIT_FROM_PARENT", - "TRUSTED_DOMAINS_ALLOWED", "TRUSTED_DOMAINS_ALLOWED_WITH_WARNING"} - not LastEvent.NewValue in AcceptableValues - } - NonCompliantOUs1_2 contains { "Name": OU, "Value": NonComplianceMessage1_2(GetSharingValue("DISALLOWED")) @@ -219,30 +122,13 @@ if { tests contains { "PolicyId": DriveId1_2, "Criticality": "Should", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := false - not Check1_2_OK -} - -tests contains { - "PolicyId": DriveId1_2, - "Criticality": "Should", - "ReportDetails": utils.ReportDetails(NonCompliantOUs1_2, NonCompliantGroups1_2), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_2, - "NonCompliantGroups": NonCompliantGroups1_2}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs1_2, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_2}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check1_2_OK - Conditions := {count(NonCompliantOUs1_2) == 0, count(NonCompliantGroups1_2) == 0 } - Status := (false in Conditions) == false + Status := count(NonCompliantOUs1_2) == 0 } #-- @@ -252,59 +138,9 @@ if { DriveId1_3 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.1.3") -LogMessage1_3 := "SHARING_OUTSIDE_DOMAIN" - -Check1_3_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage1_3, utils.TopLevelOU) - count(events) > 0 -} - -Check1_3_OK if {PolicyApiInUse} - -AcceptableValues1_3 := {"SHARING_ALLOWED_WITH_WARNING", - "SHARING_NOT_ALLOWED", - "INHERIT_FROM_PARENT", - "SHARING_NOT_ALLOWED_BUT_MAY_RECEIVE_FILES", - "TRUSTED_DOMAINS_ALLOWED_WITH_WARNING", - "TRUSTED_DOMAINS_ALLOWED_WITH_WARNING_MAY_RECEIVE_FILES_FROM_ANYONE"} - -EventGetFriendlyValue1_3(Value) := "enabled" if { - Value in AcceptableValues1_3 == true -} else := "disabled" - -EventNonComplianceMessage1_3(value) := sprintf("External Sharing Warning is %s", - [value]) - NonComplianceMessage1_3(Value) := sprintf("File sharing with %s domains, %s", [Value, "without warnings."]) -NonCompliantOUs1_3 contains { - "Name": OU, - "Value": EventNonComplianceMessage1_3(EventGetFriendlyValue1_3(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage1_3, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - not LastEvent.NewValue in AcceptableValues1_3 -} - -NonCompliantGroups1_3 contains { - "Name": Group, - "Value": EventNonComplianceMessage1_3(EventGetFriendlyValue1_3(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage1_3, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - not LastEvent.NewValue in AcceptableValues1_3 -} - NonCompliantOUs1_3 contains { "Name": OU, "Value": NonComplianceMessage1_3(GetSharingValue(extShare)) @@ -346,30 +182,13 @@ if { tests contains { "PolicyId": DriveId1_3, "Criticality": "Shall", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := true - not Check1_3_OK -} - -tests contains { - "PolicyId": DriveId1_3, - "Criticality": "Shall", - "ReportDetails": utils.ReportDetails(NonCompliantOUs1_3, NonCompliantGroups1_3), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_3, - "NonCompliantGroups": NonCompliantGroups1_3}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs1_3, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_3}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check1_3_OK - Conditions := {count(NonCompliantOUs1_3) == 0, count(NonCompliantGroups1_3) == 0} - Status := (false in Conditions) == false + Status := count(NonCompliantOUs1_3) == 0 } #-- @@ -380,85 +199,9 @@ if { DriveId1_4 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.1.4") -LogMessage1_4_A := "SHARING_INVITES_TO_NON_GOOGLE_ACCOUNTS" - -LogMessage1_4_B := "SHARING_OUTSIDE_DOMAIN" - -default NoSuchEvent1_4(_) := false - -NoSuchEvent1_4(TopLevelOU) := true if { - Events_A := utils.FilterEvents(LogEvents, LogMessage1_4_A, TopLevelOU) - count(Events_A) == 0 -} - -NoSuchEvent1_4(TopLevelOU) := true if { - Events_B := utils.FilterEvents(LogEvents, LogMessage1_4_B, TopLevelOU) - count(Events_B) == 0 -} - -Check1_4_OK if { - not PolicyApiInUse - not NoSuchEvent1_4(utils.TopLevelOU) -} - -Check1_4_OK if {PolicyApiInUse} - -AcceptableValues1_4_A := {"NOT_ALLOWED", "INHERIT_FROM_PARENT", true} - -AcceptableValues1_4_B := {"SHARING_NOT_ALLOWED", "INHERIT_FROM_PARENT"} - -EventGetFriendlyValue1_4(Value_A, Value_B) := "disabled" if { - Value_B in AcceptableValues1_4_B -} else := "enabled but sharing items to non-google accounts is disabled" if { - Value_A in AcceptableValues1_4_A -} else := "enabled and items can be shared to non-google accounts" - -EventNonComplianceMessage1_4(value) := sprintf("External Sharing is %s", - [value]) - NonComplianceMessage1_4(Value) := sprintf("File sharing with %s domains, %s", [Value, "with non-Google users."]) -NonCompliantOUs1_4 contains { - "Name": OU, - "Value": EventNonComplianceMessage1_4(EventGetFriendlyValue1_4(LastEvent_A.NewValue, - LastEvent_B.NewValue)) -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events_A := utils.FilterEventsOU(LogEvents, LogMessage1_4_A, OU) - count(Events_A) > 0 - LastEvent_A := utils.GetLastEvent(Events_A) - - Events_B := utils.FilterEventsOU(LogEvents, LogMessage1_4_B, OU) - count(Events_B) > 0 - LastEvent_B := utils.GetLastEvent(Events_B) - - not LastEvent_A.NewValue in AcceptableValues1_4_A - not LastEvent_B.NewValue in AcceptableValues1_4_B -} - -NonCompliantGroups1_4 contains { - "Name": Group, - "Value": EventNonComplianceMessage1_4(EventGetFriendlyValue1_4(LastEvent_A.NewValue, - LastEvent_B.NewValue)) -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events_A := utils.FilterEventsGroup(LogEvents, LogMessage1_4_A, Group) - count(Events_A) > 0 - LastEvent_A := utils.GetLastEvent(Events_A) - - Events_B := utils.FilterEventsGroup(LogEvents, LogMessage1_4_B, Group) - count(Events_B) > 0 - LastEvent_B := utils.GetLastEvent(Events_B) - - not LastEvent_A.NewValue in AcceptableValues1_4_A - not LastEvent_B.NewValue in AcceptableValues1_4_B -} - NonCompliantOUs1_4 contains { "Name": OU, "Value": NonComplianceMessage1_4(GetSharingValue(extShare)) @@ -500,30 +243,13 @@ if { tests contains { "PolicyId": DriveId1_4, "Criticality": "Shall", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := false - not Check1_4_OK -} - -tests contains { - "PolicyId": DriveId1_4, - "Criticality": "Shall", - "ReportDetails": utils.ReportDetails(NonCompliantOUs1_4, NonCompliantGroups1_4), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_4, - "NonCompliantGroups": NonCompliantGroups1_4}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs1_4, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_4}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check1_4_OK - Conditions := {count(NonCompliantOUs1_4) == 0, count(NonCompliantGroups1_4) == 0} - Status := (false in Conditions) == false + Status := count(NonCompliantOUs1_4) == 0 } #-- @@ -534,44 +260,8 @@ if { DriveId1_5 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.1.5") -LogMessage1_5 := "PUBLISHING_TO_WEB" - -Check1_5_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage1_5, utils.TopLevelOU) - count(events) > 0 -} - -Check1_5_OK if {PolicyApiInUse} - NonComplianceMessage1_5 := "Published web content can be made visible to anyone with a link" -NonCompliantOUs1_5 contains { - "Name": OU, - "Value": NonComplianceMessage1_5 -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage1_5, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("ALLOWED", LastEvent.NewValue) == true -} - -NonCompliantGroups1_5 contains { - "Name": Group, - "Value": NonComplianceMessage1_5 -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage1_5, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("ALLOWED", LastEvent.NewValue) == true -} - NonCompliantOUs1_5 contains { "Name": OU, "Value": NonComplianceMessage1_5 @@ -594,30 +284,13 @@ if { tests contains { "PolicyId": DriveId1_5, "Criticality": "Shall", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := false - not Check1_5_OK -} - -tests contains { - "PolicyId": DriveId1_5, - "Criticality": "Shall", - "ReportDetails": utils.ReportDetails(NonCompliantOUs1_5, NonCompliantGroups1_5), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_5, - "NonCompliantGroups": NonCompliantGroups1_5}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs1_5, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_5}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check1_5_OK - Conditions := {count(NonCompliantOUs1_5) == 0, count(NonCompliantGroups1_5) == 0} - Status := (false in Conditions) == false + Status := count(NonCompliantOUs1_5) == 0 } #-- @@ -627,54 +300,16 @@ if { DriveId1_6 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.1.6") -LogMessage1_6 := "SHARING_ACCESS_CHECKER_OPTIONS" - -Check1_6_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage1_6, utils.TopLevelOU) - count(events) > 0 -} - -Check1_6_OK if {PolicyApiInUse} - NonComplianceMessage1_6(value) := sprintf("Access Checker allows users to share files to %s", [value]) GetFriendlyValue1_6(Value) := "recipients only, suggested target audience, or public (no Google account required)" if { - Value in {"ALL", "RECIPIENTS_OR_AUDIENCE_OR_PUBLIC"} + Value == "RECIPIENTS_OR_AUDIENCE_OR_PUBLIC" } else := "recipients only, or suggested target audience" if { - Value in {"DOMAIN_OR_NAMED_PARTIES", "RECIPIENTS_OR_AUDIENCE"} + Value == "RECIPIENTS_OR_AUDIENCE" } else := Value -NonCompliantOUs1_6 contains { - "Name": OU, - "Value": NonComplianceMessage1_6(GetFriendlyValue1_6(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage1_6, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - AcceptableValues := {"NAMED_PARTIES_ONLY", "INHERIT_FROM_PARENT"} - not LastEvent.NewValue in AcceptableValues -} - -NonCompliantGroups1_6 contains { - "Name":Group, - "Value": NonComplianceMessage1_6(GetFriendlyValue1_6(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage1_6, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - AcceptableValues := {"NAMED_PARTIES_ONLY", "INHERIT_FROM_PARENT"} - not LastEvent.NewValue in AcceptableValues -} - NonCompliantOUs1_6 contains { "Name": OU, "Value": NonComplianceMessage1_6(GetFriendlyValue1_6(accessCheck)) @@ -689,30 +324,13 @@ if { tests contains { "PolicyId": DriveId1_6, "Criticality": "Shall", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := false - not Check1_6_OK -} - -tests contains { - "PolicyId": DriveId1_6, - "Criticality": "Shall", - "ReportDetails": utils.ReportDetails(NonCompliantOUs1_6, NonCompliantGroups1_6), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_6, - "NonCompliantGroups": NonCompliantGroups1_6}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs1_6, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_6}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check1_6_OK - Conditions := {count(NonCompliantOUs1_6) == 0, count(NonCompliantGroups1_6) == 0} - Status := (false in Conditions) == false + Status := count(NonCompliantOUs1_6) == 0 } #-- @@ -722,55 +340,17 @@ if { DriveId1_7 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.1.7") -LogMessage1_7 := "SHARING_TEAM_DRIVE_CROSS_DOMAIN_OPTIONS" - -Check1_7_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage1_7, utils.TopLevelOU) - count(events) > 0 -} - -Check1_7_OK if {PolicyApiInUse} - NonComplianceMessage1_7(value) := sprintf("%s can distribute content outside of the organization", [value]) GetFriendlyValue1_7(Value):= "Setting is compliant." if { - Value in {"CROSS_DOMAIN_MOVES_BLOCKED", "NONE"} + Value == "NONE" } else := "Only users inside the organization" if { - Value in {"CROSS_DOMAIN_FROM_INTERNAL_ONLY", "ELIGIBLE_INTERNAL_USERS"} + Value == "ELIGIBLE_INTERNAL_USERS" } else := "Anyone" if { - Value in {"CROSS_DOMAIN_FROM_INTERNAL_OR_EXTERNAL", "ALL_ELIGIBLE_USERS"} + Value == "ALL_ELIGIBLE_USERS" } else := Value -NonCompliantOUs1_7 contains { - "Name": OU, - "Value": NonComplianceMessage1_7(GetFriendlyValue1_7(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage1_7, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - SettingValue := "CROSS_DOMAIN_MOVES_BLOCKED INHERIT_FROM_PARENT" - contains(SettingValue, LastEvent.NewValue) == false -} - -NonCompliantGroups1_7 contains { - "Name": Group, - "Value": GetFriendlyValue1_7(LastEvent.NewValue) -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage1_7, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - SettingValue := "CROSS_DOMAIN_MOVES_BLOCKED INHERIT_FROM_PARENT" - contains(SettingValue, LastEvent.NewValue) == false -} - NonCompliantOUs1_7 contains { "Name": OU, "Value": NonComplianceMessage1_7(GetFriendlyValue1_7(moveContent)) @@ -793,31 +373,15 @@ if { tests contains { "PolicyId": DriveId1_7, "Criticality": "Shall", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true + "ReportDetails": utils.ReportDetails(NonCompliantOUs1_7, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_7}, + "RequirementMet": Status, + "NoSuchEvent": false } if { - not PolicyApiInUse - DefaultSafe := false - not Check1_7_OK + Status := count(NonCompliantOUs1_7) == 0 } - -tests contains { - "PolicyId": DriveId1_7, - "Criticality": "Shall", - "ReportDetails": utils.ReportDetails(NonCompliantOUs1_7, NonCompliantGroups1_7), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_7, "NonCompliantGroups": NonCompliantGroups1_7}, - "RequirementMet": Status, - "NoSuchEvent": false -} -if { - Check1_7_OK - Conditions := {count(NonCompliantOUs1_7) == 0, count(NonCompliantGroups1_7) == 0} - Status := (false in Conditions) == false -} -#-- +#-- # # Baseline GWS.DRIVEDOCS.1.8 @@ -825,55 +389,17 @@ if { DriveId1_8 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.1.8") -LogMessage1_8 := "DEFAULT_LINK_SHARING_FOR_NEW_DOCS" - -Check1_8_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage1_8, utils.TopLevelOU) - count(events) > 0 -} - -Check1_8_OK if {PolicyApiInUse} - NonComplianceMessage1_8(value) := sprintf("When users create items, the default access is set to: %s", [value]) GetFriendlyValue1_8(Value):= "private to the owner." if { - Value in {"PRIVATE", "PRIVATE_TO_OWNER"} + Value == "PRIVATE_TO_OWNER" } else := "the primary target audience can access the item if they have the link" if { - Value in {"PEOPLE_WITH_LINK", "PRIMARY_AUDIENCE_WITH_LINK"} + Value == "PRIMARY_AUDIENCE_WITH_LINK" } else := "the primary target audience can search and find the item." if { - Value in {"PUBLIC", "PRIMARY_AUDIENCE_WITH_LINK_OR_SEARCH"} + Value == "PRIMARY_AUDIENCE_WITH_LINK_OR_SEARCH" } else := Value -NonCompliantOUs1_8 contains { - "Name": OU, - "Value": NonComplianceMessage1_8(GetFriendlyValue1_8(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage1_8, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - LastEvent.NewValue != "PRIVATE" - LastEvent.NewValue != "INHERIT_FROM_PARENT" -} - -NonCompliantGroups1_8 contains { - "Name": Group, - "Value": NonComplianceMessage1_8(GetFriendlyValue1_8(LastEvent.NewValue)) -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage1_8, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - LastEvent.NewValue != "PRIVATE" - LastEvent.NewValue != "INHERIT_FROM_PARENT" -} - NonCompliantOUs1_8 contains { "Name": OU, "Value": NonComplianceMessage1_8(GetFriendlyValue1_8(defaultAccess)) @@ -888,29 +414,13 @@ if { tests contains { "PolicyId": DriveId1_8, "Criticality": "Shall", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := true - not Check1_8_OK -} - -tests contains { - "PolicyId": DriveId1_8, - "Criticality": "Shall", - "ReportDetails": utils.ReportDetails(NonCompliantOUs1_8, NonCompliantGroups1_8), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_8, "NonCompliantGroups": NonCompliantGroups1_8}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs1_8, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs1_8}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check1_8_OK - Conditions := {count(NonCompliantOUs1_8) == 0, count(NonCompliantGroups1_8) == 0} - Status := (false in Conditions) == false + Status := count(NonCompliantOUs1_8) == 0 } #-- @@ -924,46 +434,8 @@ if { DriveId2_1 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.2.1") -LogMessage2_1 := "Shared Drive Creation new_team_drive_admin_only" - -Check2_1_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage2_1, utils.TopLevelOU) - count(events) > 0 -} - -Check2_1_OK if {PolicyApiInUse} - NonComplianceMessage2_1 := "Members with manager access can override shared drive settings." -NonCompliantOUs2_1 contains { - "Name": OU, - "Value": NonComplianceMessage2_1 -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage2_1, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("true", LastEvent.NewValue) == false - LastEvent.NewValue != "DELETE_APPLICATION_SETTING" -} - -NonCompliantGroups2_1 contains { - "Name": Group, - "Value": NonComplianceMessage2_1 -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage2_1, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("true", LastEvent.NewValue) == false - LastEvent.NewValue != "DELETE_APPLICATION_SETTING" -} - NonCompliantOUs2_1 contains { "Name": OU, "Value": NonComplianceMessage2_1 @@ -978,29 +450,13 @@ if { tests contains { "PolicyId": DriveId2_1, "Criticality": "Should", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := false - not Check2_1_OK -} - -tests contains { - "PolicyId": DriveId2_1, - "Criticality": "Should", - "ReportDetails": utils.ReportDetails(NonCompliantOUs2_1, NonCompliantGroups2_1), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs2_1, "NonCompliantGroups": NonCompliantGroups2_1}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs2_1, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs2_1}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check2_1_OK - Conditions := {count(NonCompliantOUs2_1) == 0, count(NonCompliantGroups2_1) == 0 } - Status := (false in Conditions) == false + Status := count(NonCompliantOUs2_1) == 0 } #-- @@ -1010,46 +466,8 @@ if { DriveId2_2 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.2.2") -LogMessage2_2 := "Shared Drive Creation new_team_drive_restricts_cross_domain_access" - -Check2_2_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage2_2, utils.TopLevelOU) - count(events) > 0 -} - -Check2_2_OK if {PolicyApiInUse} - NonComplianceMessage2_2 := "Users outside the organization can access files in shared drives." -NonCompliantOUs2_2 contains { - "Name": OU, - "Value": NonComplianceMessage2_2 -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage2_2, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("true", LastEvent.NewValue) == false - LastEvent.NewValue != "DELETE_APPLICATION_SETTING" -} - -NonCompliantGroups2_2 contains { - "Name": Group, - "Value": NonComplianceMessage2_2 -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage2_2, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("true", LastEvent.NewValue) == false - LastEvent.NewValue != "DELETE_APPLICATION_SETTING" -} - NonCompliantOUs2_2 contains { "Name": OU, "Value": NonComplianceMessage2_2 @@ -1064,29 +482,13 @@ if { tests contains { "PolicyId": DriveId2_2, "Criticality": "Should", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := false - not Check2_2_OK -} - -tests contains { - "PolicyId": DriveId2_2, - "Criticality": "Should", - "ReportDetails": utils.ReportDetails(NonCompliantOUs2_2, NonCompliantGroups2_2), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs2_2, "NonCompliantGroups": NonCompliantGroups2_2}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs2_2, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs2_2}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check2_2_OK - Conditions := {count(NonCompliantOUs2_2) == 0, count(NonCompliantGroups2_2) == 0 } - Status := (false in Conditions) == false + Status := count(NonCompliantOUs2_2) == 0 } #-- @@ -1096,45 +498,8 @@ if { DriveId2_3 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.2.3") -LogMessage2_3 := "Shared Drive Creation new_team_drive_restricts_direct_access" - -Check2_3_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage2_3, utils.TopLevelOU) - count(events) > 0 -} - -Check2_3_OK if {PolicyApiInUse} - NonComplianceMessage2_3 := "Users who aren't shared drive members are not allowed to be added to files." -NonCompliantOUs2_3 contains { - "Name": OU, - "Value": NonComplianceMessage2_3 -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage2_3, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("true", LastEvent.NewValue) == false - LastEvent.NewValue != "DELETE_APPLICATION_SETTING" -} -NonCompliantGroups2_3 contains { - "Name": Group, - "Value": NonComplianceMessage2_3 -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage2_3, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("true", LastEvent.NewValue) == false - LastEvent.NewValue != "DELETE_APPLICATION_SETTING" -} - NonCompliantOUs2_3 contains { "Name": OU, "Value": NonComplianceMessage2_3 @@ -1149,30 +514,13 @@ if { tests contains { "PolicyId": DriveId2_3, "Criticality": "Shall", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := true - not Check2_3_OK -} - -tests contains { - "PolicyId": DriveId2_3, - "Criticality": "Shall", - "ReportDetails": utils.ReportDetails(NonCompliantOUs2_3, NonCompliantGroups2_3), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs2_3, - "NonCompliantGroups": NonCompliantGroups2_3}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs2_3, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs2_3}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check2_3_OK - Conditions := {count(NonCompliantOUs2_3) == 0, count(NonCompliantGroups2_3) == 0 } - Status := (false in Conditions) == false + Status := count(NonCompliantOUs2_3) == 0 } #-- @@ -1182,46 +530,8 @@ if { DriveId2_4 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.2.4") -LogMessage2_4 := "Shared Drive Creation new_team_drive_restricts_download" - -Check2_4_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage2_4, utils.TopLevelOU) - count(events) > 0 -} - -Check2_4_OK if {PolicyApiInUse} - NonComplianceMessage2_4 := "Viewers and commenters are allowed to download, print, and copy files." -NonCompliantOUs2_4 contains { - "Name": OU, - "Value": NonComplianceMessage2_4 -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage2_4, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("false", LastEvent.NewValue) == true - LastEvent.NewValue != "DELETE_APPLICATION_SETTING" -} - -NonCompliantGroups2_4 contains { - "Name": Group, - "Value": NonComplianceMessage2_4 -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage2_4, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - contains("false", LastEvent.NewValue) == true - LastEvent.NewValue != "DELETE_APPLICATION_SETTING" -} - NonCompliantOUs2_4 contains { "Name": OU, "Value": NonComplianceMessage2_4 @@ -1236,30 +546,13 @@ if { tests contains { "PolicyId": DriveId2_4, "Criticality": "Shall", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := true - not Check2_4_OK -} - -tests contains { - "PolicyId": DriveId2_4, - "Criticality": "Shall", - "ReportDetails": utils.ReportDetails(NonCompliantOUs2_4, NonCompliantGroups2_4), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs2_4, - "NonCompliantGroups": NonCompliantGroups2_4}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs2_4, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs2_4}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check2_4_OK - Conditions := {count(NonCompliantOUs2_4) == 0, count(NonCompliantGroups2_4) == 0 } - Status := (false in Conditions) == false + Status := count(NonCompliantOUs2_4) == 0 } #-- @@ -1273,54 +566,11 @@ if { DriveId3_1 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.3.1") -LogMessage3_1a := "Link Security Update Settings allow_less_secure_link_user_restore" -LogMessage3_1b := "Link Security Update Settings less_secure_link_option" - -default NoSuchEvent3_1(_) := false - -NoSuchEvent3_1(TopLevelOU) := true if { - Events_A := utils.FilterEventsOU(LogEvents, LogMessage3_1a, TopLevelOU) - count(Events_A) == 0 -} - -NoSuchEvent3_1(TopLevelOU) := true if { - Events := utils.FilterEventsOU(LogEvents, LogMessage3_1b, TopLevelOU) - count(Events) == 0 -} - -Check3_1_OK if { - not PolicyApiInUse - not NoSuchEvent3_1(utils.TopLevelOU) -} - -Check3_1_OK if {PolicyApiInUse} - NonComplianceMessage3_1(securityUpdate, userUpdate) := "The security update is removed from all impacted files." if { - securityUpdate in {"REQUIRE_LESS_SECURE_LINKS", "REMOVE_FROM_IMPACTED_FILES"} + securityUpdate == "REMOVE_FROM_IMPACTED_FILES" } else := "Users are allowed to remove/apply the security update for files they own or manage." if { - userUpdate in {"true", true} -} - -NonCompliantOUs3_1 contains { - "Name": OU, - "Value": NonComplianceMessage3_1(LastEvent_B.NewValue, LastEvent_A.NewValue) -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events_A := utils.FilterEventsOU(LogEvents, LogMessage3_1a, OU) - count(Events_A) > 0 - LastEvent_A := utils.GetLastEvent(Events_A) - - Events_B := utils.FilterEventsOU(LogEvents, LogMessage3_1b, OU) - count(Events_B) > 0 - LastEvent_B := utils.GetLastEvent(Events_B) - - true in { - LastEvent_A.NewValue != "false", - LastEvent_B.NewValue != "REMOVE_LESS_SECURE_LINKS" - } + userUpdate == true } NonCompliantOUs3_1 contains { @@ -1339,20 +589,6 @@ if { } } -tests contains { - "PolicyId": DriveId3_1, - "Criticality": "Shall", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := true - not Check3_1_OK -} - tests contains { "PolicyId": DriveId3_1, "Criticality": "Shall", @@ -1362,7 +598,6 @@ tests contains { "NoSuchEvent": false } if { - Check3_1_OK Status := count(NonCompliantOUs3_1) == 0 } #-- @@ -1377,45 +612,8 @@ if { DriveId4_1 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.4.1") -LogMessage4_1 := "ENABLE_DRIVE_APPS" - -Check4_1_OK if { - not PolicyApiInUse - events := utils.FilterEventsOU(LogEvents, LogMessage4_1, utils.TopLevelOU) - count(events) > 0 -} - -Check4_1_OK if {PolicyApiInUse} - NonComplianceMessage4_1 := "Drive SDK is enabled." -NonCompliantOUs4_1 contains { - "Name": OU, - "Value": NonComplianceMessage4_1 -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - Events := utils.FilterEventsOU(LogEvents, LogMessage4_1, OU) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - LastEvent.NewValue != "false" - LastEvent.NewValue != "INHERIT_FROM_PARENT" -} -NonCompliantGroups4_1 contains { - "Name": Group, - "Value": NonComplianceMessage4_1 -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - Events := utils.FilterEventsGroup(LogEvents, LogMessage4_1, Group) - count(Events) > 0 - LastEvent := utils.GetLastEvent(Events) - LastEvent.NewValue != "false" - LastEvent.NewValue != "INHERIT_FROM_PARENT" -} - NonCompliantOUs4_1 contains { "Name": OU, "Value": NonComplianceMessage4_1 @@ -1430,29 +628,13 @@ if { tests contains { "PolicyId": DriveId4_1, "Criticality": "Should", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := false - not Check4_1_OK -} - -tests contains { - "PolicyId": DriveId4_1, - "Criticality": "Should", - "ReportDetails": utils.ReportDetails(NonCompliantOUs4_1, NonCompliantGroups4_1), - "ActualValue": {"NonCompliantOUs": NonCompliantOUs4_1, "NonCompliantGroups": NonCompliantGroups4_1}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs4_1, []), + "ActualValue": {"NonCompliantOUs": NonCompliantOUs4_1}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check4_1_OK - Conditions := {count(NonCompliantOUs4_1) == 0, count(NonCompliantGroups4_1) == 0} - Status := (false in Conditions) == false + Status := count(NonCompliantOUs4_1) == 0 } #-- @@ -1470,13 +652,10 @@ DriveId5_1 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.5.1") LogMessage5_1 := "ENABLE_DOCS_ADD_ONS" Check5_1_OK if { - # not PolicyApiInUse events := utils.FilterEventsOU(LogEvents, LogMessage5_1, utils.TopLevelOU) count(events) > 0 } -# Check5_1_OK if {PolicyApiInUse} - NonComplianceMessage5_1 := "Users can install Google Docs add-ons from add-ons store." NonCompliantOUs5_1 contains { @@ -1484,7 +663,6 @@ NonCompliantOUs5_1 contains { "Value": NonComplianceMessage5_1 } if { - # not PolicyApiInUse some OU in utils.OUsWithEvents Events := utils.FilterEventsOU(LogEvents, LogMessage5_1, OU) count(Events) > 0 @@ -1498,7 +676,6 @@ NonCompliantGroups5_1 contains { "Value": NonComplianceMessage5_1 } if { - # not PolicyApiInUse some Group in utils.GroupsWithEvents Events := utils.FilterEventsGroup(LogEvents, LogMessage5_1, Group) count(Events) > 0 @@ -1528,7 +705,6 @@ tests contains { "NoSuchEvent": true } if { - # not PolicyApiInUse DefaultSafe := false not Check5_1_OK } @@ -1559,88 +735,18 @@ if { DriveId6_1 := utils.PolicyIdWithSuffix("GWS.DRIVEDOCS.6.1") -LogMessage6_1 := "ENABLE_DOCS_ADD_ONS" - -LogMessage6_1a := "DriveFsSettingsProto drive_fs_enabled" -LogMessage6_1b := "DriveFsSettingsProto company_owned_only_enabled" - -default NoSuchEvent6_1(_) := true - -NoSuchEvent6_1(TopLevelOU) := false if { - Events := utils.FilterEventsOU(LogEvents, LogMessage6_1a, TopLevelOU) - count(Events) != 0 -} - -NoSuchEvent6_1(TopLevelOU) := false if { - Events := utils.FilterEventsOU(LogEvents, LogMessage6_1b, TopLevelOU) - count(Events) != 0 -} - -Check6_1_OK if { - not PolicyApiInUse - not NoSuchEvent6_1(utils.TopLevelOU) -} - -Check6_1_OK if {PolicyApiInUse} - NonComplianceMessage6_1(Value) := sprintf("Drive for Desktop is %s.", [Value]) GetFriendlyValue6_1(CompanyOnly, DesktopEnabled) := "enabled and can be used on any device" if { - CompanyOnly in {"false", false} - DesktopEnabled in {"true", true} + CompanyOnly == false + DesktopEnabled == true } else := "disabled" if { - DesktopEnabled in {"false", false} + DesktopEnabled == false } else := "enabled but only on approved devices" if { - CompanyOnly in {"true", true} - DesktopEnabled in {"true", true} - } - -NonCompliantOUs6_1 contains { - "Name": OU, - "Value": NonComplianceMessage6_1(GetFriendlyValue6_1(LastCompanyOnlyEvent.NewValue, - LastDriveEnabledEvent.NewValue)) -} -if { - not PolicyApiInUse - some OU in utils.OUsWithEvents - - DriveEnabledEvents := utils.FilterEventsOU(LogEvents, LogMessage6_1a, OU) - count(DriveEnabledEvents) > 0 - LastDriveEnabledEvent := utils.GetLastEvent(DriveEnabledEvents) - LastDriveEnabledEvent.NewValue != "DELETE_APPLICATION_SETTING" - - CompanyOnlyEvents := utils.FilterEventsOU(LogEvents, LogMessage6_1b, OU) - count(CompanyOnlyEvents) > 0 - LastCompanyOnlyEvent := utils.GetLastEvent(CompanyOnlyEvents) - LastCompanyOnlyEvent.NewValue != "DELETE_APPLICATION_SETTING" - - LastDriveEnabledEvent.NewValue == "true" - LastCompanyOnlyEvent.NewValue != "true" - } - -NonCompliantGroups6_1 contains { - "Name": Group, - "Value": NonComplianceMessage6_1(GetFriendlyValue6_1(LastCompanyOnlyEvent.NewValue, - LastDriveEnabledEvent.NewValue)) -} -if { - not PolicyApiInUse - some Group in utils.GroupsWithEvents - - DriveEnabledEvents := utils.FilterEventsGroup(LogEvents, LogMessage6_1a, Group) - count(DriveEnabledEvents) > 0 - LastDriveEnabledEvent := utils.GetLastEvent(DriveEnabledEvents) - LastDriveEnabledEvent.NewValue != "DELETE_APPLICATION_SETTING" - - CompanyOnlyEvents := utils.FilterEventsGroup(LogEvents, LogMessage6_1b, Group) - count(CompanyOnlyEvents) > 0 - LastCompanyOnlyEvent := utils.GetLastEvent(CompanyOnlyEvents) - LastCompanyOnlyEvent.NewValue != "DELETE_APPLICATION_SETTING" - - LastDriveEnabledEvent.NewValue == "true" - LastCompanyOnlyEvent.NewValue != "true" + CompanyOnly == true + DesktopEnabled == true } NonCompliantOUs6_1 contains { @@ -1666,28 +772,12 @@ if { tests contains { "PolicyId": DriveId6_1, "Criticality": "Should", - "ReportDetails": utils.NoSuchEventDetails(DefaultSafe, utils.TopLevelOU), - "ActualValue": "No relevant event for the top-level OU in the current logs", - "RequirementMet": DefaultSafe, - "NoSuchEvent": true -} -if { - not PolicyApiInUse - DefaultSafe := false - not Check6_1_OK -} - -tests contains { - "PolicyId": DriveId6_1, - "Criticality": "Should", - "ReportDetails": utils.ReportDetails(NonCompliantOUs6_1, NonCompliantGroups6_1), - "ActualValue" : {"NonCompliantOUs": NonCompliantOUs6_1, "NonCompliantGroups": NonCompliantGroups6_1}, + "ReportDetails": utils.ReportDetails(NonCompliantOUs6_1, []), + "ActualValue" : {"NonCompliantOUs": NonCompliantOUs6_1}, "RequirementMet": Status, "NoSuchEvent": false } if { - Check6_1_OK - Conditions := {count(NonCompliantOUs6_1) == 0, count(NonCompliantGroups6_1) == 0} - Status := (false in Conditions) == false + Status := count(NonCompliantOUs6_1) == 0 } #--