jpskill.com
🛠️ 開発・MCP コミュニティ

checkov

Checkovは、Terraformなどのインフラ構成コードを静的に分析し、セキュリティ上の問題やコンプライアンス違反を検出するツールで、CI/CDパイプラインへの統合やカスタムポリシー作成を支援するSkill。

📜 元の英語説明(参考)

Expert guidance for Checkov, the static analysis tool for infrastructure-as-code that scans Terraform, CloudFormation, Kubernetes, Helm, Dockerfile, and ARM templates for security misconfigurations and compliance violations. Helps developers integrate Checkov into CI/CD pipelines and write custom policies.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Checkovは、Terraformなどのインフラ構成コードを静的に分析し、セキュリティ上の問題やコンプライアンス違反を検出するツールで、CI/CDパイプラインへの統合やカスタムポリシー作成を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o checkov.zip https://jpskill.com/download/14736.zip && unzip -o checkov.zip && rm checkov.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14736.zip -OutFile "$d\checkov.zip"; Expand-Archive "$d\checkov.zip" -DestinationPath $d -Force; ri "$d\checkov.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して checkov.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → checkov フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Checkov — Infrastructure as Code セキュリティスキャナ

概要

Checkov は、Infrastructure as Code のための静的解析ツールであり、Terraform、CloudFormation、Kubernetes、Helm、Dockerfile、および ARM テンプレートをスキャンして、セキュリティの誤設定とコンプライアンス違反を検出します。開発者が Checkov を CI/CD パイプラインに統合し、カスタムポリシーを作成するのに役立ちます。

手順

スキャン

# インストール
pip install checkov

# Terraform ファイルのスキャン
checkov -d ./terraform/

# Kubernetes マニフェストのスキャン
checkov -d ./k8s/ --framework kubernetes

# Dockerfile のスキャン
checkov -f Dockerfile --framework dockerfile

# 特定のチェックによるスキャン
checkov -d . --check CKV_AWS_18,CKV_AWS_21   # 特定のチェックのみ

# 特定のチェックのスキップ
checkov -d . --skip-check CKV_AWS_18          # S3 ロギングチェックのスキップ

# 出力形式
checkov -d . -o json                           # CI/CD 用の JSON
checkov -d . -o sarif                          # GitHub Security タブ用の SARIF
checkov -d . -o junitxml                       # テストレポート用の JUnit

Checkov が検出するもの

# Terraform — Checkov はこれらの誤設定を検出します:

# ❌ CKV_AWS_18: アクセスロギングのない S3 バケット
resource "aws_s3_bucket" "data" {
  bucket = "my-data-bucket"
  # Missing: logging { target_bucket = "..." }
}

# ❌ CKV_AWS_145: 暗号化されていない RDS
resource "aws_db_instance" "main" {
  engine         = "postgres"
  instance_class = "db.t3.medium"
  # Missing: storage_encrypted = true
}

# ❌ CKV_AWS_24: SSH で 0.0.0.0/0 を持つセキュリティグループ
resource "aws_security_group_rule" "ssh" {
  type        = "ingress"
  from_port   = 22
  to_port     = 22
  cidr_blocks = ["0.0.0.0/0"]    # Open SSH to the world
}

# ❌ CKV_AWS_79: メタデータサービス v2 のない EC2
resource "aws_instance" "web" {
  ami           = "ami-12345"
  instance_type = "t3.micro"
  # Missing: metadata_options { http_tokens = "required" }
}
# Kubernetes — Checkov はこれらを検出します:

# ❌ CKV_K8S_1: root として実行されているコンテナ
# ❌ CKV_K8S_8: 活性プローブがない
# ❌ CKV_K8S_9: 準備プローブがない
# ❌ CKV_K8S_12: メモリ制限がない
# ❌ CKV_K8S_13: メモリリクエストがない
# ❌ CKV_K8S_20: 特権コンテナ
# ❌ CKV_K8S_28: CPU 制限がない
# ❌ CKV_K8S_37: ケーパビリティのドロップがない
apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
        - name: app
          image: myapp:latest      # ❌ CKV_K8S_14: 'latest' タグの使用
          # Missing: all security context, probes, and resource limits

カスタムポリシー

# custom_checks/s3_naming.py — Python でのカスタム Checkov ポリシー
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
from checkov.common.models.enums import CheckResult, CheckCategories

class S3BucketNamingConvention(BaseResourceCheck):
    def __init__(self):
        name = "S3 バケット名は会社プレフィックスで始まる必要があります"
        id = "CKV_CUSTOM_1"
        supported_resources = ["aws_s3_bucket"]
        categories = [CheckCategories.CONVENTION]
        super().__init__(name=name, id=id, categories=categories,
                         supported_resources=supported_resources)

    def scan_resource_conf(self, conf):
        bucket_name = conf.get("bucket", [""])[0]
        if bucket_name.startswith("mycompany-"):
            return CheckResult.PASSED
        return CheckResult.FAILED

check = S3BucketNamingConvention()
# custom_checks/require_tags.yaml — YAML でのカスタムポリシー (よりシンプル)
metadata:
  id: "CKV_CUSTOM_2"
  name: "すべてのリソースは 'team' および 'environment' タグを持つ必要があります"
  category: "CONVENTION"
definition:
  cond_type: "attribute"
  resource_types:
    - "aws_instance"
    - "aws_s3_bucket"
    - "aws_rds_cluster"
  attribute: "tags.team"
  operator: "exists"

CI/CD 統合

# .github/workflows/security.yml
- name: Checkov IaC Scan
  uses: bridgecrewio/checkov-action@v12
  with:
    directory: terraform/
    framework: terraform
    output_format: sarif
    output_file_path: checkov.sarif
    soft_fail: false                    # 検出時にパイプラインを失敗させる
    skip_check: CKV_AWS_18             # 既知の例外をスキップする

- name: Upload SARIF
  uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: checkov.sarif

インストール

pip install checkov

# または Docker 経由
docker run -v $(pwd):/tf bridgecrew/checkov -d /tf

# または Homebrew 経由
brew install checkov

例 1: マイクロサービスプロジェクトのための Checkov のセットアップ

ユーザーリクエスト:

Node.js API と React フロントエンドを Docker で実行しています。監視/デプロイのために Checkov をセットアップしてください。

エージェントは、# Install のようなパターンに基づいて必要な構成ファイルを作成し、既存の Docker セットアップとの統合をセットアップし、Node.js + React スタックに適したデフォルトを構成し、すべてが機能していることを確認するための検証コマンドを提供します。

例 2: Checkov が検出する問題のトラブルシューティング

ユーザーリクエスト:

Checkov が検出するものでエラーが表示されています。ログは次のとおりです: [エラー出力]

エージェントはエラー出力を分析し、一般的な Checkov の問題との相互参照によって根本原因を特定し、修正を適用 (構成の更新、リソース制限の調整、または構文の修正) し、適切なヘルスチェックで解決を確認します。

ガイドライン

  1. CI/CD でスキャン — すべての PR で Checkov を実行します。本番環境に到達する前に誤設定を検出します。
  2. 寛容に開始し、徐々に厳しくする--soft-fail で開始して、ブロックせずに検出結果を確認します。問題を修正したら、徐々にハードフェイルを有効にします。
  3. 正当な理由でスキップ — チェックをスキップする場合は、なぜスキップするのかを説明するインラインコメントを追加します: #checkov:skip=CKV_AWS_18:Logging handled by org-level trail
  4. 組織向けのカスタムポリシー — 命名規則、タグ付け要件、および組織標準のポリシーを作成します。
  5. GitHub 用の SARIF — SARIF を出力し、GitHub Security タブにアップロードします。検出結果はプルリクエストにインラインで表示されます。
  6. ベースラインファイル — `--ba
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Checkov — Infrastructure as Code Security Scanner

Overview

Checkov, the static analysis tool for infrastructure-as-code that scans Terraform, CloudFormation, Kubernetes, Helm, Dockerfile, and ARM templates for security misconfigurations and compliance violations. Helps developers integrate Checkov into CI/CD pipelines and write custom policies.

Instructions

Scanning

# Install
pip install checkov

# Scan Terraform files
checkov -d ./terraform/

# Scan Kubernetes manifests
checkov -d ./k8s/ --framework kubernetes

# Scan Dockerfiles
checkov -f Dockerfile --framework dockerfile

# Scan with specific checks
checkov -d . --check CKV_AWS_18,CKV_AWS_21   # Only specific checks

# Skip specific checks
checkov -d . --skip-check CKV_AWS_18          # Skip S3 logging check

# Output formats
checkov -d . -o json                           # JSON for CI/CD
checkov -d . -o sarif                          # SARIF for GitHub Security tab
checkov -d . -o junitxml                       # JUnit for test reports

What Checkov Catches

# Terraform — Checkov flags these misconfigurations:

# ❌ CKV_AWS_18: S3 bucket without access logging
resource "aws_s3_bucket" "data" {
  bucket = "my-data-bucket"
  # Missing: logging { target_bucket = "..." }
}

# ❌ CKV_AWS_145: RDS without encryption
resource "aws_db_instance" "main" {
  engine         = "postgres"
  instance_class = "db.t3.medium"
  # Missing: storage_encrypted = true
}

# ❌ CKV_AWS_24: Security group with 0.0.0.0/0 on SSH
resource "aws_security_group_rule" "ssh" {
  type        = "ingress"
  from_port   = 22
  to_port     = 22
  cidr_blocks = ["0.0.0.0/0"]    # Open SSH to the world
}

# ❌ CKV_AWS_79: EC2 without metadata service v2
resource "aws_instance" "web" {
  ami           = "ami-12345"
  instance_type = "t3.micro"
  # Missing: metadata_options { http_tokens = "required" }
}
# Kubernetes — Checkov flags these:

# ❌ CKV_K8S_1: Container running as root
# ❌ CKV_K8S_8: No liveness probe
# ❌ CKV_K8S_9: No readiness probe
# ❌ CKV_K8S_12: No memory limit
# ❌ CKV_K8S_13: No memory request
# ❌ CKV_K8S_20: Privileged container
# ❌ CKV_K8S_28: No CPU limit
# ❌ CKV_K8S_37: No capabilities drop
apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
        - name: app
          image: myapp:latest      # ❌ CKV_K8S_14: Using 'latest' tag
          # Missing: all security context, probes, and resource limits

Custom Policies

# custom_checks/s3_naming.py — Custom Checkov policy in Python
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
from checkov.common.models.enums import CheckResult, CheckCategories

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

    def scan_resource_conf(self, conf):
        bucket_name = conf.get("bucket", [""])[0]
        if bucket_name.startswith("mycompany-"):
            return CheckResult.PASSED
        return CheckResult.FAILED

check = S3BucketNamingConvention()
# custom_checks/require_tags.yaml — Custom policy in YAML (simpler)
metadata:
  id: "CKV_CUSTOM_2"
  name: "All resources must have 'team' and 'environment' tags"
  category: "CONVENTION"
definition:
  cond_type: "attribute"
  resource_types:
    - "aws_instance"
    - "aws_s3_bucket"
    - "aws_rds_cluster"
  attribute: "tags.team"
  operator: "exists"

CI/CD Integration

# .github/workflows/security.yml
- name: Checkov IaC Scan
  uses: bridgecrewio/checkov-action@v12
  with:
    directory: terraform/
    framework: terraform
    output_format: sarif
    output_file_path: checkov.sarif
    soft_fail: false                    # Fail the pipeline on findings
    skip_check: CKV_AWS_18             # Skip known exceptions

- name: Upload SARIF
  uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: checkov.sarif

Installation

pip install checkov

# Or via Docker
docker run -v $(pwd):/tf bridgecrew/checkov -d /tf

# Or via Homebrew
brew install checkov

Examples

Example 1: Setting up Checkov for a microservices project

User request:

I have a Node.js API and a React frontend running in Docker. Set up Checkov for monitoring/deployment.

The agent creates the necessary configuration files based on patterns like # Install, sets up the integration with the existing Docker setup, configures appropriate defaults for a Node.js + React stack, and provides verification commands to confirm everything is working.

Example 2: Troubleshooting what checkov catches issues

User request:

Checkov is showing errors in our what checkov catches. Here are the logs: [error output]

The agent analyzes the error output, identifies the root cause by cross-referencing with common Checkov issues, applies the fix (updating configuration, adjusting resource limits, or correcting syntax), and verifies the resolution with appropriate health checks.

Guidelines

  1. Scan in CI/CD — Run Checkov on every PR; catch misconfigurations before they reach production
  2. Start permissive, tighten gradually — Begin with --soft-fail to see findings without blocking; gradually enable hard-fail as you fix issues
  3. Skip with justification — When skipping checks, add inline comments explaining why: #checkov:skip=CKV_AWS_18:Logging handled by org-level trail
  4. Custom policies for your org — Write policies for naming conventions, tagging requirements, and organizational standards
  5. SARIF for GitHub — Output SARIF and upload to GitHub Security tab; findings appear inline on pull requests
  6. Baseline file — Use --baseline to establish a baseline of existing findings; only flag new issues in PRs
  7. Multiple frameworks — Scan Terraform, Kubernetes, Dockerfiles, and Helm charts in the same pipeline
  8. Bridgecrew platform — Use the Bridgecrew platform for centralized policy management and drift detection across teams