-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest.rego
23 lines (19 loc) · 1.42 KB
/
test.rego
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package compliance.cis_aws.rules.cis_4_15
import data.cis_aws.test_data
import data.compliance.cis_aws.data_adapter
import data.lib.test
test_pass {
eval_pass with input as rule_input([{
"TrailInfo": {
"Trail": {"IsMultiRegionTrail": true},
"Status": {"IsLogging": true},
"EventSelectors": [{"IncludeManagementEvents": true, "ReadWriteType": "All"}],
},
"MetricFilters": [{"FilterName": "filter_1", "FilterPattern": "{ ($.eventSource = organizations.amazonaws.com) && (($.eventName = \"AcceptHandshake\") || ($.eventName = \"AttachPolicy\") || ($.eventName = \"CreateAccount\") || ($.eventName = \"CreateOrganizationalUnit\") || ($.eventName = \"CreatePolicy\") || ($.eventName = \"DeclineHandshake\") || ($.eventName = \"DeleteOrganization\") || ($.eventName = \"DeleteOrganizationalUnit\") || ($.eventName = \"DeletePolicy\") || ($.eventName = \"DetachPolicy\") || ($.eventName = \"DisablePolicyType\") || ($.eventName = \"EnablePolicyType\") || ($.eventName = \"InviteAccountToOrganization\") || ($.eventName = \"LeaveOrganization\") || ($.eventName = \"MoveAccount\") || ($.eventName = \"RemoveAccountFromOrganization\") || ($.eventName = \"UpdatePolicy\") || ($.eventName = \"UpdateOrganizationalUnit\")) }"}],
"MetricTopicBinding": {"filter_1": ["arn:aws:...sns"]},
}])
}
rule_input(entry) = test_data.generate_monitoring_resources(entry)
eval_pass {
test.assert_pass(finding) with data.benchmark_data_adapter as data_adapter
}