github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/kubernetes/policies/cisbenchmarks/controllermamager/profiling.rego (about)

     1  # METADATA
     2  # title: "Ensure that the --profiling argument is set to false"
     3  # description: "Disable profiling, if not needed."
     4  # scope: package
     5  # schemas:
     6  # - input: schema["kubernetes"]
     7  # related_resources:
     8  # - https://www.cisecurity.org/benchmark/kubernetes
     9  # custom:
    10  #   id: KCV0034
    11  #   avd_id: AVD-KCV-0034
    12  #   severity: LOW
    13  #   short_code: ensure-profiling-argument-is-set-to-false 
    14  #   recommended_action: "Edit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml on the Control Plane node and set the below parameter."
    15  #   input:
    16  #     selector:
    17  #     - type: kubernetes
    18  package builtin.kubernetes.KCV0034
    19  
    20  import data.lib.kubernetes
    21  
    22  checkFlag[container] {
    23  	container := kubernetes.containers[_]
    24  	kubernetes.is_controllermanager(container)
    25  	not kubernetes.command_has_flag(container.command, "--profiling=false")
    26  }
    27  
    28  deny[res] {
    29  	output := checkFlag[_]
    30  	msg := "Ensure that the --profiling argument is set to false"
    31  	res := result.new(msg, output)
    32  }