github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/kubernetes/policies/pss/baseline/10_windows_host_process.rego (about) 1 # METADATA 2 # title: "Access to host process" 3 # description: "Windows pods offer the ability to run HostProcess containers which enable privileged access to the Windows node." 4 # scope: package 5 # schemas: 6 # - input: schema["kubernetes"] 7 # related_resources: 8 # - https://kubernetes.io/docs/concepts/security/pod-security-standards/#baseline 9 # custom: 10 # id: KSV103 11 # avd_id: AVD-KSV-0103 12 # severity: MEDIUM 13 # short_code: no-hostprocess-containers 14 # recommended_action: "Do not enable 'hostProcess' on any securityContext" 15 # input: 16 # selector: 17 # - type: kubernetes 18 package builtin.kubernetes.KSV103 19 20 import data.lib.kubernetes 21 import data.lib.utils 22 23 failHostProcess[spec] { 24 spec := input.spec 25 spec.securityContext.windowsOptions.hostProcess == true 26 } 27 28 failHostProcess[options] { 29 container := kubernetes.containers[_] 30 options := container.securityContext.windowsOptions 31 options.hostProcess == true 32 } 33 34 deny[res] { 35 cause := failHostProcess[_] 36 msg := "You should not enable hostProcess." 37 res := result.new(msg, cause) 38 }