github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/docker/policies/no_healthcheck_instruction.rego (about)

     1  # METADATA
     2  # title: "No HEALTHCHECK defined"
     3  # description: "You should add HEALTHCHECK instruction in your docker container images to perform the health check on running containers."
     4  # scope: package
     5  # schemas:
     6  # - input: schema["dockerfile"]
     7  # related_resources:
     8  # - https://blog.khulnasoft.com/docker-security-best-practices
     9  # custom:
    10  #   id: DS026
    11  #   avd_id: AVD-DS-0026
    12  #   severity: LOW
    13  #   short_code: no-healthcheck
    14  #   recommended_action: "Add HEALTHCHECK instruction in Dockerfile"
    15  #   input:
    16  #     selector:
    17  #     - type: dockerfile
    18  package builtin.dockerfile.DS026
    19  
    20  import data.lib.docker
    21  
    22  deny[res] {
    23  	count(docker.healthcheck) == 0
    24  	msg := "Add HEALTHCHECK instruction in your Dockerfile"
    25  	res := result.new(msg, {})
    26  }