Checkov fetchers scan Terraform and Kubernetes manifests for IaC security issues. In this repo, the Checkov fetchers commonly pull source code from GitLab (via API download or git clone) using GitLab credentials, then run the local checkov CLI.
These fetchers use GitLab to retrieve IaC source files.
| Variable | Required | Description | Example |
|---|---|---|---|
GITLAB_URL |
Yes | GitLab base URL | https://gitlab.example.com |
GITLAB_API_TOKEN |
Yes | GitLab token used for API downloads and clone auth | glpat-... |
GITLAB_PROJECT_ID |
Yes | GitLab project path or numeric ID | group/project |
GITLAB_BRANCH |
No | Branch/ref (default main) |
main |
CHECKOV_CLONE_REPO |
No | true to clone full repo; default false uses API downloads |
false |
| Variable | Required | Description |
|---|---|---|
CHECKOV_REPO_ID |
No | Repo ID label used in Checkov output |
CHECKOV_BRANCH |
No | Branch label used in Checkov output |
CHECKOV_SOFT_FAIL |
No | If true, Checkov won’t exit non-zero on findings |
CHECKOV_COMPACT |
No | Compact output |
CHECKOV_DOWNLOAD_EXTERNAL_MODULES |
No | Download external Terraform modules |
CHECKOV_EVALUATE_VARIABLES |
No | Evaluate variables during scan |
CHECKOV_TERRAFORM_CHECKS |
No | Comma-separated Terraform check IDs to run |
CHECKOV_K8S_CHECKS |
No | Comma-separated Kubernetes check IDs to run |
CHECKOV_CHECKS |
No | Combined checks (auto-filtered by framework) |
CHECKOV_SKIP_CHECKS |
No | Additional checks to skip (merged with defaults) |
CHECKOV_SKIP_RESOURCES |
No | Resource patterns to skip (merged with defaults) |
CHECKOV_SKIP_PATHS |
No | Paths to skip during scan |
CHECKOV_EXTERNAL_CHECKS_DIR |
No | Path to custom checks directory |
CHECKOV_TERRAFORM_PLAN_FILE |
No | Terraform plan JSON file to scan instead of directory |
CHECKOV_REPO_ROOT |
No | Repo root for plan enrichment / skip comments |
CHECKOV_DEEP_ANALYSIS |
No | Enable deep analysis (requires plan + repo root) |
checkov_terraform.shcheckov_kubernetes.sh
The scripts use GitLab API v4 to enumerate and download files:
| Purpose | Endpoint(s) | Method(s) |
|---|---|---|
| List repository tree | /api/v4/projects/:id/repository/tree |
GET |
| Download raw file | /api/v4/projects/:id/repository/files/:path/raw |
GET |
If CHECKOV_CLONE_REPO=true, the scripts also use git clone with the token embedded in the clone URL.
- GitLab token scopes:
read_api(andread_repositoryif required by your GitLab instance). - Project access: read-only access to the target repo.
Follow the GitLab guidance in fetchers/gitlab/API_KEY_SETUP.md.
Rotate GITLAB_API_TOKEN per the GitLab guide, then re-run a Checkov fetcher as a smoke test.
# Ensure checkov is installed
python -c "import shutil; assert shutil.which('checkov'), 'checkov not found (pip install checkov)'"
# Run one of the fetchers (expects GitLab env vars to be set)
bash fetchers/checkov/checkov_terraform.sh --output-dir /tmp/evidence- See
fetchers/checkov/README.mdfor detailed configuration examples and skip lists.