forked from PaloAltoNetworks/rbac-police
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproviderIAM.rego
31 lines (28 loc) · 830 Bytes
/
providerIAM.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
package policy
import data.police_builtins as pb
import data.config
import future.keywords.in
describe[{"desc": desc, "severity": severity}] {
desc := "Kubernetes ServiceAccounts assigned cloud provider IAM roles may be abused to attack the underlying cloud account (depending on the permissions of the IAM role)"
severity := "Low"
}
main[{"violations": violation}] {
config.evalSaViolations
violation := {"serviceAccounts": saViolations}
}
saViolations = violations {
violations := { violation |
some sa in input.serviceAccounts
sa.providerIAM
violation := {
"name": sa.name,
"namespace": sa.namespace,
"nodes": { shortedNode |
some node in sa.nodes
shortedNode := {node.name: node.pods}
},
"providerIAM": sa.providerIAM
}
}
count(violations) > 0
}