forked from plexsystems/konstraint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
security_test.rego
49 lines (33 loc) · 1.24 KB
/
security_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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package lib.security
test_added_capabilities_container_match {
input := {"securityContext": {"capabilities": {"add": ["CAP_SYS_ADMIN"]}}}
added_capability(input, "CAP_SYS_ADMIN")
}
test_added_capabilities_container_nomatch {
input := {"securityContext": {"capabilities": {"add": ["CAP_SYS_ADMIN"]}}}
not added_capability(input, "test")
}
test_added_capabilities_psp_match {
input := {"spec": {"allowedCapabilities": ["CAP_SYS_ADMIN"]}}
added_capability(input, "CAP_SYS_ADMIN")
}
test_added_capabilities_psp_nomatch {
input := {"spec": {"allowedCapabilities": ["CAP_SYS_ADMIN"]}}
not added_capability(input, "test")
}
test_dropped_capabilities_container_match {
input := {"securityContext": {"capabilities": {"drop": ["CAP_SYS_ADMIN"]}}}
dropped_capability(input, "CAP_SYS_ADMIN")
}
test_dropped_capabilities_container_nomatch {
input := {"securityContext": {"capabilities": {"drop": ["CAP_SYS_ADMIN"]}}}
not dropped_capability(input, "test")
}
test_dropped_capabilities_psp_match {
input := {"spec": {"requiredDropCapabilities": ["CAP_SYS_ADMIN"]}}
dropped_capability(input, "CAP_SYS_ADMIN")
}
test_dropped_capabilities_psp_nomatch {
input := {"spec": {"requiredDropCapabilities": ["CAP_SYS_ADMIN"]}}
not dropped_capability(input, "test")
}