forked from elastic/csp-security-policies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.rego
35 lines (27 loc) · 1.13 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
24
25
26
27
28
29
30
31
32
33
34
35
package compliance.cis_k8s.rules.cis_1_2_32
import data.compliance.cis_k8s.data_adapter
import data.kubernetes_common.test_data
import data.lib.test
test_violation {
eval_fail with input as rule_input("")
eval_fail with input as rule_input("--tls-cipher-suites=SOME_CIPHER")
eval_fail with input as rule_input("--tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,SOME_CIPHER")
}
test_pass {
eval_pass with input as rule_input("--tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")
eval_pass with input as rule_input("--tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384")
eval_pass with input as rule_input("--tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384")
}
test_not_evaluated {
not_eval with input as test_data.process_input("some_process", [])
}
rule_input(argument) = test_data.process_input("kube-apiserver", [argument])
eval_fail {
test.assert_fail(finding) with data.benchmark_data_adapter as data_adapter
}
eval_pass {
test.assert_pass(finding) with data.benchmark_data_adapter as data_adapter
}
not_eval {
not finding with data.benchmark_data_adapter as data_adapter
}