Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

checkov

БесплатноБез исполняемых скриптовНе проверен

Checkov is an open-source static analysis tool that scans infrastructure-as-code (Terraform, CloudFormation, Kubernetes, Helm, Dockerfile, ARM, Bicep and…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Checkov — Infrastructure as Code Security Scanner

Overview

Checkov (by Prisma Cloud / Bridgecrew, current release 3.3.x) parses IaC files and Terraform plans and evaluates them against 1,000+ built-in policies, with ids like CKV_AWS_18 or CKV_K8S_14. It needs no cloud account and no API key; results stay local unless you pass a Prisma/Bridgecrew key. Exit code is 1 when any check fails, which is what makes it a CI gate.

Instructions

Install and scan

brew install checkov                 # or: pipx install checkov  /  pip install checkov
docker run --rm -v "$(pwd)":/tf bridgecrew/checkov -d /tf   # no local Python needed

checkov -d ./terraform/                                  # scan a directory (all frameworks auto-detected)
checkov -d ./k8s/ --framework kubernetes
checkov -f Dockerfile --framework dockerfile
checkov -d . --check CKV_AWS_18,CKV_AWS_21               # run only these
checkov -d . --skip-check CKV_AWS_18                     # run everything except
checkov -d . --compact --quiet                           # only failures, no code snippets
checkov -d . -o json                                     # also: sarif, junitxml, github_failed_only, cli
checkov -d . -o cli -o sarif --output-file-path console,results.sarif
checkov -d . --soft-fail                                 # report but always exit 0
checkov -d . --config-file .checkov.yaml                 # persist flags; --create-config writes one

To evaluate plan values and module inputs, scan the plan JSON: terraform show -json tfplan > tfplan.json && checkov -f tfplan.json. Use --var-file for variable files and --download-external-modules true to resolve remote modules.

What Checkov catches

# CKV_AWS_18: S3 bucket without access logging (CKV2_AWS_6 and CKV_AWS_145 cover public access block / KMS)
resource "aws_s3_bucket" "invoices" {
  bucket = "northwind-invoices-prod"
}

# CKV_AWS_16: RDS instance without storage encryption
resource "aws_db_instance" "billing" {
  engine         = "postgres"
  instance_class = "db.t3.medium"
  # fix: storage_encrypted = true
}

# CKV_AWS_24: security group allows SSH from 0.0.0.0/0
resource "aws_security_group" "bastion" {
  ingress {
    from_port   = 22
    to_port     = 22
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

# CKV_AWS_79: EC2 allows IMDSv1
resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t3.micro"
  # fix: metadata_options { http_tokens = "required" }
}

Common Kubernetes ids: CKV_K8S_8 liveness probe, CKV_K8S_9 readiness probe, CKV_K8S_10/11 CPU request/limit, CKV_K8S_12/13 memory request/limit, CKV_K8S_14 image tag not latest, CKV_K8S_16 privileged container, CKV_K8S_20 allowPrivilegeEscalation, CKV_K8S_23 root containers, CKV_K8S_28 NET_RAW capability, CKV_K8S_37 capabilities not dropped, CKV_K8S_40 high UID. List everything with checkov --list.

Suppress a finding with a reason

resource "aws_s3_bucket" "audit_logs" {
  #checkov:skip=CKV_AWS_18:Access logging is handled by the organisation CloudTrail
  bucket = "northwind-audit-logs"
}

Custom policies

# custom_checks/s3_naming.py
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
from checkov.common.models.enums import CheckResult, CheckCategories

class S3BucketNamingConvention(BaseResourceCheck):
    def __init__(self):
        super().__init__(
            name="S3 bucket name must start with the company prefix",
            id="CKV_NORTHWIND_1",
            categories=[CheckCategories.CONVENTION],
            supported_resources=["aws_s3_bucket"],
        )

    def scan_resource_conf(self, conf):
        name = conf.get("bucket", [""])[0]
        return CheckResult.PASSED if isinstance(name, str) and name.startswith("northwind-") else CheckResult.FAILED

check = S3BucketNamingConvention()
# custom_checks/require_team_tag.yaml
metadata:
  id: "CKV2_NORTHWIND_2"
  name: "Resources must carry a 'team' tag"
  category: "CONVENTION"
definition:
  cond_type: "attribute"
  resource_types: ["aws_instance", "aws_s3_bucket", "aws_rds_cluster"]
  attribute: "tags.team"
  operator: "exists"

Load them with checkov -d . --external-checks-dir custom_checks. The directory needs an empty __init__.py for the Python check to be picked up (the YAML policy loads without it). Custom ids should not collide with built-in CKV_ ids.

CI/CD (GitHub Actions)

permissions:
  contents: read
  security-events: write
steps:
  - uses: actions/checkout@v4
  - name: Checkov IaC scan
    uses: bridgecrewio/checkov-action@v12
    with:
      directory: terraform/
      framework: terraform
      output_format: cli,sarif
      output_file_path: console,results.sarif
      baseline: .checkov.baseline
  - uses: github/codeql-action/upload-sarif@v3
    if: always()
    with:
      sarif_file: results.sarif

The action fails the job o

Полный SKILL.md на GitHub

Установить checkov в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл checkov?

Checkov is an open-source static analysis tool that scans infrastructure-as-code (Terraform, CloudFormation, Kubernetes, Helm, Dockerfile, ARM, Bicep and more) for security misconfigurations and compliance violations. Use it to scan Terraform or Kubernetes manifests before deploy, add a security gate to CI/CD with SARIF output, suppress findings with justification, or write custom policies in Python or YAML.

Как установить скилл checkov?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл checkov запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить checkov с