Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Infrastructure as Code (IaC) security scanning using Checkov with 750+ built-in policies for Terraform, CloudFormation, Kubernetes, Dockerfile, and ARM templates. Use when: (1) Scanning IaC files for security misconfigurations and compliance violations, (2) Validating cloud infrastructure against CIS, PCI-DSS, HIPAA, and SOC2 benchmarks, (3) Detecting secrets and hardcoded credentials in IaC, (4) Implementing policy-as-code in CI/CD pipelines, (5) Generating compliance reports with remediation g
.claude/skills/aiskillstore-iac-checkov/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 196% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 332% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 276% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 286% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 205% | 0% |
Checkov is a static code analysis tool that scans Infrastructure as Code (IaC) files for security misconfigurations and compliance violations before deployment. With 750+ built-in policies, Checkov helps prevent cloud security issues by detecting problems in Terraform, CloudFormation, Kubernetes, Dockerfiles, Helm charts, and ARM templates.
Checkov performs graph-based scanning to understand resource relationships and detect complex misconfigurations that span multiple resources, making it more powerful than simple pattern matching.
bash# Via pip pip install checkov # Via Homebrew (macOS) brew install checkov # Via Docker docker pull bridgecrew/checkov
bash# Scan all Terraform files in directory checkov -d ./terraform # Scan specific file checkov -f ./terraform/main.tf # Scan with specific framework checkov -d ./infrastructure --framework terraform
bash# Scan Kubernetes YAML files checkov -d ./k8s --framework kubernetes # Scan Helm chart checkov -d ./helm-chart --framework helm
bash# Scan CloudFormation template checkov -f ./cloudformation/template.yaml --framework cloudformation
Identify IaC files and frameworks to scan:
bash# Supported frameworks checkov --list-frameworks # Output: # terraform, cloudformation, kubernetes, dockerfile, helm, # serverless, arm, secrets, ansible, github_actions, gitlab_ci
Scope Considerations:
Execute Checkov with appropriate output format:
bash# CLI output (human-readable) checkov -d ./terraform # JSON output (for automation) checkov -d ./terraform -o json # Multiple output formats checkov -d ./terraform -o cli -o json -o sarif # Save output to file checkov -d ./terraform -o json --output-file-path ./reports
What Checkov Detects:
Focus on critical issues first:
bash# Show only high severity issues checkov -d ./terraform --check CKV_AWS_* # Skip specific checks (false positives) checkov -d ./terraform --skip-check CKV_AWS_8,CKV_AWS_21 # Check against specific compliance framework checkov -d ./terraform --compact --framework terraform \ --check CIS_AWS,CIS_AZURE # Run only checks with specific severity checkov -d ./terraform --check HIGH,CRITICAL
Severity Levels:
Use inline suppression for legitimate exceptions:
hcl# Terraform example resource "aws_s3_bucket" "example" { # checkov:skip=CKV_AWS_18:This bucket is intentionally public for static website bucket = "my-public-website" acl = "public-read" }
yaml# Kubernetes example apiVersion: v1 kind: Pod metadata: name: privileged-pod annotations: checkov.io/skip: CKV_K8S_16=Legacy application requires privileged mode spec: containers: - name: app securityContext: privileged: true
See references/suppression_guide.md for comprehensive suppression strategies.
Define organization-specific policies:
python# custom_checks/require_s3_versioning.py from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck from checkov.common.models.enums import CheckResult, CheckCategories class S3BucketVersioning(BaseResourceCheck): def __init__(self): name = "Ensure S3 bucket has versioning enabled" id = "CKV_AWS_CUSTOM_001" supported_resources = ['aws_s3_bucket'] categories = [CheckCategories.BACKUP_AND_RECOVERY] super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources) def scan_resource_conf(self, conf): if 'versioning' in conf: if conf['versioning'][0].get('enabled') == [True]: return CheckResult.PASSED return CheckResult.FAILED check = S3BucketVersioning()
Run with custom policies:
bashcheckov -d ./terraform --external-checks-dir ./custom_checks
See references/custom_policies.md for advanced policy development.
Create reports for audit and compliance:
bash# Generate comprehensive report checkov -d ./terraform \ -o cli -o json -o junitxml \ --output-file-path ./compliance-reports \ --repo-id my-infrastructure \ --branch main # CycloneDX SBOM for IaC checkov -d ./terraform -o cyclonedx # SARIF for GitHub Security checkov -d ./terraform -o sarif --output-file-path ./sarif-report.json
Report Types:
Map findings to compliance frameworks using references/compliance_mapping.md.
Add Checkov scanning to pull request checks:
yaml# .github/workflows/checkov.yml name: Checkov IaC Security Scan on: [push, pull_request] jobs: checkov-scan: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Run Checkov uses: bridgecrewio/checkov-action@master with: directory: infrastructure/ framework: terraform output_format: sarif output_file_path: checkov-results.sarif soft_fail: false - name: Upload SARIF Report if: always() uses: github/codeql-action/upload-sarif@v2 with: sarif_file: checkov-results.sarif
Prevent committing insecure IaC:
yaml# .pre-commit-config.yaml repos: - repo: https://github.com/bridgecrewio/checkov rev: 2.5.0 hooks: - id: checkov args: [--soft-fail] files: \.(tf|yaml|yml|json)$
Install pre-commit hooks:
bashpip install pre-commit pre-commit install
yaml# .gitlab-ci.yml checkov_scan: image: bridgecrew/checkov:latest stage: security script: - checkov -d ./terraform -o json -o junitxml --output-file-path $CI_PROJECT_DIR/checkov-report artifacts: reports: junit: checkov-report/results_junitxml.xml paths: - checkov-report/ when: always
groovy// Jenkinsfile pipeline { agent any stages { stage('Checkov Scan') { steps { sh 'pip install checkov' sh ''' checkov -d ./terraform \ -o cli -o junitxml \ --output-file-path ./reports ''' } } } post { always { junit 'reports/results_junitxml.xml' } } }
See assets/ directory for complete CI/CD templates.
Scan Terraform with Variable Files:
bash# Scan with tfvars checkov -d ./terraform --var-file ./terraform.tfvars # Download and scan external modules checkov -d ./terraform --download-external-modules true # Skip Terraform plan files checkov -d ./terraform --skip-path terraform.tfstate
Common Terraform Checks:
Scan Kubernetes Manifests:
bash# Scan all YAML manifests checkov -d ./k8s --framework kubernetes # Scan Helm chart checkov -d ./helm-chart --framework helm # Scan kustomize output kustomize build ./overlay/prod | checkov -f - --framework kubernetes
Common Kubernetes Checks:
Scan CloudFormation Templates:
bash# Scan CloudFormation template checkov -f ./cloudformation/stack.yaml --framework cloudformation # Scan AWS SAM template checkov -f ./sam-template.yaml --framework serverless
Scan Dockerfiles for Security Issues:
bash# Scan Dockerfile checkov -f ./Dockerfile --framework dockerfile # Common issues detected: # - Running as root user # - Using :latest tag # - Missing HEALTHCHECK # - Exposing sensitive ports
Establish baseline for existing infrastructure:
bash# Create baseline (first scan) checkov -d ./terraform --create-baseline # This creates .checkov.baseline file with current findings
Compare subsequent scans against baseline:
bash# Compare against baseline - only fail on NEW issues checkov -d ./terraform --baseline .checkov.baseline # This allows existing issues while preventing new ones
Use Cases:
Detect hardcoded secrets in IaC:
bash# Enable secrets scanning checkov -d ./terraform --framework secrets # Common secrets detected: # - AWS access keys # - API tokens # - Private keys # - Database passwords # - Generic secrets (high entropy strings)
--hard-fail-on for severity levels that should block deploymentscripts/)checkov_scan.py - Comprehensive scanning script with multiple frameworks and output formatscheckov_terraform_scan.sh - Terraform-specific scanning with variable file supportcheckov_k8s_scan.sh - Kubernetes manifest scanning with cluster comparisoncheckov_baseline_create.sh - Baseline creation and drift detection workflowcheckov_compliance_report.py - Generate compliance reports (CIS, PCI-DSS, HIPAA, SOC2)ci_integration.sh - CI/CD integration examples for multiple platformsreferences/)compliance_mapping.md - Mapping of Checkov checks to CIS, PCI-DSS, HIPAA, SOC2, NISTcustom_policies.md - Guide for writing custom Python and YAML policiessuppression_guide.md - Best practices for suppressing false positivesterraform_checks.md - Comprehensive list of Terraform checks with remediationkubernetes_checks.md - Kubernetes security checks and pod security standardscloudformation_checks.md - CloudFormation security checks with examplesassets/)checkov_config.yaml - Checkov configuration file templategithub_actions.yml - Complete GitHub Actions workflowgitlab_ci.yml - Complete GitLab CI pipelinejenkins_pipeline.groovy - Jenkins pipeline templatepre_commit_config.yaml - Pre-commit hook configurationcustom_policy_template.py - Template for custom Python policiespolicy_metadata.yaml - Policy metadata for organization-specific policiesGradually increase security posture:
bash# Phase 1: Scan without failing (awareness) checkov -d ./terraform --soft-fail # Phase 2: Fail only on CRITICAL issues checkov -d ./terraform --hard-fail-on CRITICAL # Phase 3: Fail on CRITICAL and HIGH checkov -d ./terraform --hard-fail-on CRITICAL,HIGH # Phase 4: Full enforcement with baseline checkov -d ./terraform --baseline .checkov.baseline
Scan complete infrastructure stack:
bash# Use bundled script for comprehensive scanning python3 scripts/checkov_scan.py \ --infrastructure-dir ./infrastructure \ --frameworks terraform,kubernetes,dockerfile \ --output-dir ./security-reports \ --compliance CIS,PCI-DSS
Maintain centralized policy repository:
policies/
├── custom_checks/
│ ├── aws/
│ │ ├── require_encryption.py
│ │ └── require_tags.py
│ ├── kubernetes/
│ │ └── require_psp.py
├── .checkov.yaml # Global config
└── suppression_list.txt # Approved suppressionsFocus on specific compliance requirements:
bash# CIS AWS Foundations Benchmark checkov -d ./terraform --check CIS_AWS # PCI-DSS compliance checkov -d ./terraform --framework terraform \ --check CKV_AWS_19,CKV_AWS_21,CKV_AWS_61 \ -o json --output-file-path ./pci-dss-report # HIPAA compliance checkov -d ./terraform --framework terraform \ --compact --check CKV_AWS_17,CKV_AWS_19,CKV_AWS_61,CKV_AWS_93
Solution: Use progressive adoption with baselines:
bash# Create baseline with current state checkov -d ./terraform --create-baseline # Only fail on new issues checkov -d ./terraform --baseline .checkov.baseline --soft-fail-on LOW,MEDIUM
Solution: Use inline suppressions with justification:
hcl# Provide clear business justification resource "aws_security_group" "allow_office" { # checkov:skip=CKV_AWS_23:Office IP range needs SSH access for developers ingress { from_port = 22 to_port = 22 protocol = "tcp" cidr_blocks = ["203.0.113.0/24"] # Office IP range } }
Solution: Optimize scan scope:
bash# Skip unnecessary paths checkov -d ./terraform \ --skip-path .terraform/ \ --skip-path modules/vendor/ \ --skip-framework secrets # Use compact output checkov -d ./terraform --compact --quiet
Solution: Verify policy structure and loading:
bash# Check policy syntax python3 custom_checks/my_policy.py # Ensure proper directory structure checkov -d ./terraform \ --external-checks-dir ./custom_checks \ --list # Debug with verbose output checkov -d ./terraform --external-checks-dir ./custom_checks -v
Solution: Configure module access:
bash# Set up Terraform credentials export TF_TOKEN_app_terraform_io="your-token" # Download external modules checkov -d ./terraform --download-external-modules true # Or scan after terraform init cd ./terraform && terraform init checkov -d .
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→fail | 19,283 | 11,493 | -40% | 1 | 1 | 0% | 3,705 | 6,833 | +84% | 0 | 0 | — |
case-02 | fail→pass | 11,707 | 9,948 | -15% | 1 | 1 | 0% | 2,125 | 6,285 | +196% | 0 | 0 | — |
case-03 | pass→pass | 13,503 | 15,584 | +15% | 1 | 1 | 0% | 2,728 | 7,598 | +179% | 0 | 0 | — |
case-04 | pass→pass | 39,125 | 18,533 | -53% | 1 | 1 | 0% | 4,301 | 8,560 | +99% | 0 | 0 | — |
case-05 | pass→pass | 12,326 | 10,541 | -14% | 1 | 1 | 0% | 2,485 | 6,834 | +175% | 0 | 0 | — |
case-06 | fail→fail | 3,701 | 4,894 | +32% | 1 | 1 | 0% | 739 | 5,377 | +628% | 0 | 0 | — |
case-07 | fail→pass | 7,874 | 7,994 | +2% | 1 | 1 | 0% | 1,411 | 6,090 | +332% | 0 | 0 | — |
case-08 | pass→pass | 12,049 | 12,205 | +1% | 1 | 1 | 0% | 2,479 | 6,990 | +182% | 0 | 0 | — |
case-22 | pass→pass | 9,820 | 4,275 | -56% | 1 | 1 | 0% | 1,802 | 5,273 | +193% | 0 | 0 | — |
case-09 | pass→pass | 6,033 | 4,723 | -22% | 1 | 1 | 0% | 1,170 | 5,505 | +371% | 0 | 0 | — |
case-10 | fail→fail | 23,715 | 10,902 | -54% | 1 | 1 | 0% | 2,188 | 6,408 | +193% | 0 | 0 | — |
case-11 | fail→pass | 9,142 | 8,294 | -9% | 1 | 1 | 0% | 1,581 | 5,937 | +276% | 0 | 0 | — |
case-12 | pass→pass | 16,109 | 10,841 | -33% | 1 | 1 | 0% | 2,720 | 6,536 | +140% | 0 | 0 | — |
case-13 | pass→pass | 15,188 | 3,918 | -74% | 1 | 1 | 0% | 1,270 | 5,186 | +308% | 0 | 0 | — |
case-14 | fail→fail | 6,033 | 4,870 | -19% | 1 | 1 | 0% | 1,101 | 5,074 | +361% | 0 | 0 | — |
case-15 | fail→fail | 6,299 | 3,855 | -39% | 1 | 1 | 0% | 1,171 | 4,917 | +320% | 0 | 0 | — |
case-16 | pass→pass | 9,027 | 4,785 | -47% | 1 | 1 | 0% | 1,717 | 5,381 | +213% | 0 | 0 | — |
case-17 | fail→pass | 7,430 | 4,230 | -43% | 1 | 1 | 0% | 1,348 | 5,199 | +286% | 0 | 0 | — |
case-18 | pass→pass | 2,424 | 3,537 | +46% | 1 | 1 | 0% | 451 | 5,163 | +1045% | 0 | 0 | — |
case-19 | fail→pass | 10,607 | 7,413 | -30% | 1 | 1 | 0% | 1,933 | 5,902 | +205% | 0 | 0 | — |
case-20 | pass→pass | 4,599 | 4,151 | -10% | 1 | 1 | 0% | 860 | 4,821 | +461% | 0 | 0 | — |
case-21 | pass→pass | 8,785 | 2,905 | -67% | 1 | 1 | 0% | 1,578 | 5,033 | +219% | 0 | 0 | — |
case-23 | fail→pass | 3,592 | 3,457 | -4% | 1 | 1 | 0% | 604 | 4,903 | +712% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +22 percentage points is the difference between those two pass rates over the 23 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.