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

grype

Grypeは、コンテナイメージやファイルシステムなどの脆弱性を検出するオープンソースツールで、CI/CDパイプラインへの統合や脆弱性のトリアージを支援し、Syftと連携してSBOMを生成することで、開発者のセキュリティ対策を強化するSkill。

📜 元の英語説明(参考)

Expert guidance for Grype, the open-source vulnerability scanner by Anchore that finds known vulnerabilities (CVEs) in container images, filesystems, and SBOMs. Helps developers integrate Grype into CI/CD pipelines, triage findings, and combine it with Syft for SBOM generation.

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

一言でいうと

Grypeは、コンテナイメージやファイルシステムなどの脆弱性を検出するオープンソースツールで、CI/CDパイプラインへの統合や脆弱性のトリアージを支援し、Syftと連携してSBOMを生成することで、開発者のセキュリティ対策を強化するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して grype.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → grype フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Grype — コンテナ脆弱性スキャナー

概要

Grype は、Anchore 社が開発したオープンソースの脆弱性スキャナーで、コンテナイメージ、ファイルシステム、SBOM 内の既知の脆弱性 (CVE) を検出します。開発者が Grype を CI/CD パイプラインに統合し、検出結果をトリアージし、Syft と組み合わせて SBOM を生成するのに役立ちます。

手順

スキャン

# インストール
brew install grype

# コンテナイメージのスキャン
grype alpine:3.19
grype nginx:latest
grype ghcr.io/myorg/myapp:v1.2.3

# ローカルディレクトリのスキャン
grype dir:./my-project

# Dockerfile / ビルドされたイメージのスキャン
docker build -t myapp .
grype myapp

# SBOM (Syft で生成) のスキャン
syft myapp -o spdx-json > sbom.json
grype sbom:sbom.json

# 深刻度閾値で失敗
grype myapp --fail-on critical          # critical な CVE が見つかった場合、終了コード 1 を返す
grype myapp --fail-on high              # high または critical な CVE が見つかった場合、終了コード 1 を返す

# 出力形式
grype myapp -o json                     # CI 処理用の JSON
grype myapp -o table                    # 人間が読める形式 (デフォルト)
grype myapp -o sarif                    # GitHub Security タブ用の SARIF
grype myapp -o cyclonedx               # CycloneDX 形式

CI/CD 統合

# .github/workflows/security.yml — デプロイ前にイメージをスキャン
jobs:
  vulnerability-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build image
        run: docker build -t myapp:${{ github.sha }} .

      - name: Generate SBOM
        uses: anchore/sbom-action@v0
        with:
          image: myapp:${{ github.sha }}
          output-file: sbom.spdx.json

      - name: Scan for vulnerabilities
        uses: anchore/scan-action@v4
        id: scan
        with:
          image: myapp:${{ github.sha }}
          fail-build: true
          severity-cutoff: high
          output-format: sarif

      - name: Upload SARIF
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: ${{ steps.scan.outputs.sarif }}

既知の誤検出を無視する

# .grype.yaml — 設定と無視ルール
ignore:
  # 特定の CVE を無視する (理由を明記)
  - vulnerability: CVE-2023-12345
    reason: "Not exploitable in our configuration — we don't use affected feature"

  - vulnerability: CVE-2023-67890
    package:
      name: openssl
      version: 3.1.0
    reason: "Patched in our custom build"

  # テスト依存関係のすべての脆弱性を無視する
  - package:
      location: "**/test/**"

# これらの深刻度レベルのみをスキャンする
fail-on-severity: high

# DB 更新設定
db:
  auto-update: true
  validate-age: true
  max-allowed-built-age: 120h          # DB が 5 日以上古い場合は再ダウンロードする

Syft との組み合わせ

# Syft は SBOM を生成し、Grype はそれらをスキャンします — 強力な組み合わせ

# SBOM を生成
syft myapp:latest -o spdx-json > sbom.json

# SBOM をスキャンして脆弱性を検出
grype sbom:sbom.json -o json > vulnerabilities.json

# クイックパイプライン: ビルド → SBOM → スキャン → 署名
docker build -t myapp:v1.2.3 .
syft myapp:v1.2.3 -o spdx-json > sbom.json
grype sbom:sbom.json --fail-on critical
cosign attest --predicate sbom.json --type spdxjson myapp:v1.2.3

インストール

# macOS
brew install grype

# Linux
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin

# Docker
docker run anchore/grype:latest myapp:latest

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

ユーザーリクエスト:

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

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

例 2: CI/CD 統合の問題のトラブルシューティング

ユーザーリクエスト:

Grype が CI/CD 統合でエラーを表示しています。ログは次のとおりです: [error output]

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

ガイドライン

  1. CI/CD でスキャン — すべてのビルドで Grype を実行します。脆弱性が本番環境に到達する前に検出します。
  2. high/critical で失敗 — CI で --fail-on high を使用します。既知の重大度の高い CVE があるイメージはデプロイしないでください。
  3. SBOM + スキャン — Syft で SBOM を生成し、Grype でスキャンし、Cosign で両方をイメージにアタッチします。
  4. 理由を明記して無視 — CVE を無視する場合は、.grype.yaml に理由を文書化します。監査人はその理由を確認する必要があります。
  5. 脆弱性 DB を更新 — Grype はローカルの脆弱性データベースを使用します。CI で毎日更新されていることを確認してください。
  6. GitHub 用の SARIF — SARIF 形式で出力し、GitHub Security タブにアップロードします。開発者は PR で CVE をインラインで確認できます。
  7. ベースイメージが重要 — ほとんどの CVE はベースイメージから発生します。攻撃対象領域を減らすために、最小限のベース (distroless、alpine、scratch) を使用してください。
  8. 実行中のコンテナをスキャン — デプロイされたイメージを定期的にスキャンします。既存のパッケージに対して、新しい CVE が毎日発見されています。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Grype — Container Vulnerability Scanner

Overview

Grype, the open-source vulnerability scanner by Anchore that finds known vulnerabilities (CVEs) in container images, filesystems, and SBOMs. Helps developers integrate Grype into CI/CD pipelines, triage findings, and combine it with Syft for SBOM generation.

Instructions

Scanning

# Install
brew install grype

# Scan a container image
grype alpine:3.19
grype nginx:latest
grype ghcr.io/myorg/myapp:v1.2.3

# Scan a local directory
grype dir:./my-project

# Scan a Dockerfile / built image
docker build -t myapp .
grype myapp

# Scan an SBOM (generated by Syft)
syft myapp -o spdx-json > sbom.json
grype sbom:sbom.json

# Fail on severity threshold
grype myapp --fail-on critical          # Exit 1 if critical CVEs found
grype myapp --fail-on high              # Exit 1 if high or critical

# Output formats
grype myapp -o json                     # JSON for CI processing
grype myapp -o table                    # Human-readable (default)
grype myapp -o sarif                    # SARIF for GitHub Security tab
grype myapp -o cyclonedx               # CycloneDX format

CI/CD Integration

# .github/workflows/security.yml — Scan images before deployment
jobs:
  vulnerability-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build image
        run: docker build -t myapp:${{ github.sha }} .

      - name: Generate SBOM
        uses: anchore/sbom-action@v0
        with:
          image: myapp:${{ github.sha }}
          output-file: sbom.spdx.json

      - name: Scan for vulnerabilities
        uses: anchore/scan-action@v4
        id: scan
        with:
          image: myapp:${{ github.sha }}
          fail-build: true
          severity-cutoff: high
          output-format: sarif

      - name: Upload SARIF
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: ${{ steps.scan.outputs.sarif }}

Ignore Known False Positives

# .grype.yaml — Configuration and ignore rules
ignore:
  # Ignore specific CVEs (with justification)
  - vulnerability: CVE-2023-12345
    reason: "Not exploitable in our configuration — we don't use affected feature"

  - vulnerability: CVE-2023-67890
    package:
      name: openssl
      version: 3.1.0
    reason: "Patched in our custom build"

  # Ignore all vulnerabilities in test dependencies
  - package:
      location: "**/test/**"

# Only scan for these severity levels
fail-on-severity: high

# DB update settings
db:
  auto-update: true
  validate-age: true
  max-allowed-built-age: 120h          # Re-download if DB is older than 5 days

Combining with Syft

# Syft generates SBOMs, Grype scans them — powerful combination

# Generate SBOM
syft myapp:latest -o spdx-json > sbom.json

# Scan the SBOM for vulnerabilities
grype sbom:sbom.json -o json > vulnerabilities.json

# Quick pipeline: build → SBOM → scan → sign
docker build -t myapp:v1.2.3 .
syft myapp:v1.2.3 -o spdx-json > sbom.json
grype sbom:sbom.json --fail-on critical
cosign attest --predicate sbom.json --type spdxjson myapp:v1.2.3

Installation

# macOS
brew install grype

# Linux
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin

# Docker
docker run anchore/grype:latest myapp:latest

Examples

Example 1: Setting up Grype for a microservices project

User request:

I have a Node.js API and a React frontend running in Docker. Set up Grype 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 ci/cd integration issues

User request:

Grype is showing errors in our ci/cd integration. Here are the logs: [error output]

The agent analyzes the error output, identifies the root cause by cross-referencing with common Grype 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 Grype on every build; catch vulnerabilities before they reach production
  2. Fail on high/critical — Use --fail-on high in CI; don't deploy images with known high-severity CVEs
  3. SBOM + scan — Generate SBOM with Syft, scan with Grype, attach both to the image with Cosign
  4. Ignore with justification — When ignoring CVEs, document why in .grype.yaml; auditors need to see the reasoning
  5. Update the vulnerability DB — Grype uses a local vulnerability database; ensure it's updated daily in CI
  6. SARIF for GitHub — Output SARIF format and upload to GitHub Security tab; developers see CVEs inline on PRs
  7. Base image matters — Most CVEs come from the base image; use minimal bases (distroless, alpine, scratch) to reduce attack surface
  8. Scan running containers — Periodically scan deployed images; new CVEs are discovered daily against existing packages