Skip to content

Checkov Executor

Category: IaC, Containers and Kubernetes Script: checkov.py Integration: CLI Faraday Plugin: SarifPlugin Website: https://www.checkov.io/

Description

Runs Checkov on a directory or Git repository of infrastructure-as-code files (Terraform, CloudFormation, Kubernetes, Dockerfiles and more) and imports the misconfigurations it finds into Faraday.

Prerequisites

  • checkov installed and available in the agent's PATH (checked with checkov --version)
  • git, if you scan a repository by URL
  • Read access to the code, either as a local path or a Git repository

Configuration

Environment Variables (Setup)

Variable Required Description
GIT_USERNAME No Username for cloning private repositories over HTTPS (default: oauth2)
GIT_TOKEN No Access token for cloning private repositories over HTTPS

Execution Arguments

Parameter Type Mandatory Description
CHECKOV_TARGET string No* Directory to scan. When CHECKOV_GIT_URL is set, it is a subpath inside the cloned repository (e.g., terraform/).
CHECKOV_FRAMEWORK list No Only run these frameworks (e.g., ["terraform", "kubernetes"]). By default Checkov runs all frameworks it detects.
CHECKOV_SKIP_CHECK list No Check IDs to skip (e.g., ["CKV_AWS_18"])
CHECKOV_CHECK list No Run only these check IDs (e.g., ["CKV_AWS_20"])
CHECKOV_GIT_URL url No* Git repository to clone and scan
CHECKOV_GIT_REF string No Branch or tag to clone (default: the repository's default branch)

* You must set CHECKOV_TARGET, CHECKOV_GIT_URL, or both.

YAML Configuration Example

executors:
  checkov:
    repo_executor: checkov.py
    max_size: 65536
    varenvs:
      GIT_USERNAME: "<git_username>"
      GIT_TOKEN: "<git_token>"
    params:
      CHECKOV_TARGET:
        mandatory: false
        type: string
        base: string
      CHECKOV_FRAMEWORK:
        mandatory: false
        type: list
        base: list
      CHECKOV_SKIP_CHECK:
        mandatory: false
        type: list
        base: list
      CHECKOV_CHECK:
        mandatory: false
        type: list
        base: list
      CHECKOV_GIT_URL:
        mandatory: false
        type: url
        base: string
      CHECKOV_GIT_REF:
        mandatory: false
        type: string
        base: string

How It Works

  1. If CHECKOV_GIT_URL is set, makes a shallow clone of the repository (at CHECKOV_GIT_REF, if given) into a temporary directory. For HTTPS URLs it authenticates with GIT_USERNAME/GIT_TOKEN.
  2. Runs checkov --directory <target> --output sarif --soft-fail with the framework and check filters you set
  3. Parses the SARIF report with SarifPlugin and sends the results to Faraday
  4. Deletes the temporary clone when the run ends

Notes

  • CHECKOV_TARGET must point inside the cloned repository. Paths that escape it (e.g., ../) are rejected.
  • Checkov is run in soft-fail mode, so findings do not make the run fail. The run fails only if Checkov produces no SARIF report.
  • The token is hidden in the agent log if the clone fails.
  • Supports the shared agent parameters (AGENT_CONFIG_* tags and severity filters).