mcpField
D
dependency-scan

dependency-scan

github.com/jwyniaセキュリティ179357 回インストール35 週間前に更新
リポジトリ

dependency-scan について

Dependency Scanは、プロジェクトの依存関係に既知の脆弱性がないか調べるスキルです。パッケージマネージャーを識別して深刻度と修正案を報告し、修正の試行や依存関係の健全性確認も行います。

主な機能

  1. 01プロジェクトのパッケージマネージャー識別
  2. 02既知の脆弱性の検査
  3. 03深刻度による結果の絞り込み
  4. 04修正案の提示
  5. 05依存関係の自動修正の試行
  6. 06古さ・非推奨・ライセンス問題の確認

活用シーン

  1. 01プロジェクト依存関係のCVEスキャン
  2. 02CIでの深刻度しきい値の設定
  3. 03依存関係の修正内容のプレビューや適用
  4. 04依存関係の保守状況とライセンスの確認

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/jwynia/agent-skills --skill dependency-scan

インストール後、Claude Code で/dependency-scanを入力して読み込まれたか確認します。

詳細

依存関係スキャン

パッケージの依存関係を分析し、既知の脆弱性を検出します。

クイックスタート

/dependency-scan                  # Scan all detected package managers
/dependency-scan --npm            # Node.js packages only
/dependency-scan --pip            # Python packages only
/dependency-scan --fix            # Auto-fix where possible

このスキルでできること

  1. プロジェクト内のパッケージマネージャーを特定します
  2. 依存関係マニフェストを解析します(package.json、requirements.txt など)
  3. 脆弱性データベースを確認し、既知の CVE を検出します
  4. 重要度と修正方法の選択肢を報告します
  5. オプションで自動修正し、修正済みバージョンに更新します

対応パッケージマネージャー

エコシステムファイル使用ツール
Node.jspackage.json, package-lock.jsonnpm audit
Pythonrequirements.txt, Pipfile, pyproject.tomlpip-audit, safety
RubyGemfile, Gemfile.lockbundler-audit
Javapom.xml, build.gradledependency-check
Gogo.mod, go.sumgovulncheck
RustCargo.toml, Cargo.lockcargo-audit
PHPcomposer.json, composer.lockcomposer audit
.NET*.csproj, packages.configdotnet list --vulnerable

スキャンモード

フルスキャン
/dependency-scan

検出されたすべてのパッケージマネージャーをスキャンし、すべての重要度レベルを報告します。

特定のエコシステム
/dependency-scan --npm
/dependency-scan --pip
/dependency-scan --go
重要度フィルター
/dependency-scan --severity critical,high
/dependency-scan --severity medium
自動修正モード
/dependency-scan --fix
/dependency-scan --fix --dry-run    # Preview changes

脆弱なパッケージを修正済みバージョンに更新します。

出力形式

概要表示
DEPENDENCY SCAN RESULTS
=======================

Scanned: package.json, requirements.txt
Packages analyzed: 127 (78 npm, 49 pip)

VULNERABILITIES BY SEVERITY
  Critical: 2
  High: 4
  Medium: 8
  Low: 12

TOP ISSUES

[!] CRITICAL: lodash < 4.17.21
    CVE-2021-23337: Command Injection
    Affected: [email protected]
    Fix: npm update lodash

[!] CRITICAL: urllib3 < 2.0.6
    CVE-2023-43804: Cookie Leak
    Affected: [email protected]
    Fix: pip install urllib3>=2.0.6

[H] HIGH: express < 4.19.2
    CVE-2024-29041: Open Redirect
    Affected: [email protected]
    Fix: npm update express
詳細表示
/dependency-scan --details
DETAILED VULNERABILITY REPORT
=============================

CVE-2021-23337
--------------
Package: lodash
Installed: 4.17.19
Patched: 4.17.21
Severity: CRITICAL (CVSS 9.8)

Description:
  Command Injection in lodash template function allows
  arbitrary command execution via crafted template strings.

Attack Vector: Remote, no auth required
Exploitability: Public exploit available

References:
  - https://nvd.nist.gov/vuln/detail/CVE-2021-23337
  - https://github.com/lodash/lodash/issues/5085

Remediation:
  npm update lodash
  # or
  npm install [email protected]

脆弱性の情報源

参照するデータベース
データベース対象範囲
NVD(National Vulnerability Database)すべての CVE
GitHub Advisory DatabaseGitHub で報告された脆弱性
OSV(Open Source Vulnerabilities)複数のエコシステム
npm Security AdvisoriesNode.js 固有
PyPI Advisory DatabasePython 固有
RustSec Advisory DatabaseRust 固有
CVSS スコア
スコア重要度
9.0-10.0緊急
7.0-8.9高
4.0-6.9中
0.1-3.9低

使用するコマンド

Node.js(npm)
npm audit --json
npm audit fix           # Auto-fix
npm audit fix --force   # Breaking changes OK
Python(pip-audit)
pip-audit
pip-audit --fix
pip-audit -r requirements.txt
Python(safety)
safety check
safety check -r requirements.txt
Ruby(bundler-audit)
bundle-audit check
bundle-audit update     # Update advisory DB
Go(govulncheck)
govulncheck ./...
Rust(cargo-audit)
cargo audit
cargo audit fix         # Auto-fix

自動修正の動作

安全な修正

semver 互換の範囲内で更新します。

  • パッチバージョン(1.2.3 → 1.2.4)
  • メジャーバージョンを固定している場合のマイナーバージョン(^1.2.3 → ^1.3.0)
破壊的変更を伴う修正

破壊的変更が発生する可能性があります。

  • メジャーバージョンの更新
  • --force フラグが必要です
修正レポート
AUTO-FIX REPORT
===============

Fixed: 8 vulnerabilities
  lodash: 4.17.19 → 4.17.21
  axios: 0.21.0 → 0.21.1
  minimist: 1.2.5 → 1.2.6

Unable to fix: 2 vulnerabilities
  react-scripts: No patch available (major version required)
  webpack-dev-server: Conflicts with other dependencies

Review package.json changes before committing.

設定

既知の問題を無視する

.dependency-scan-ignore を作成します。

# Ignore specific CVEs (document reason!)
ignore:
  - id: CVE-2021-23337
    reason: "Not exploitable in our usage, lodash template not used"
    expires: 2024-12-31

  - id: GHSA-xxx-xxx
    reason: "Development dependency only"

# Ignore packages
packages:
  - name: lodash
    versions: ["< 4.17.0"]  # Only old versions
重要度のしきい値
# .dependency-scan.yaml
thresholds:
  fail_on: critical         # Fail CI on critical
  warn_on: high            # Warn on high
  ignore_below: low        # Don't report low

fix:
  auto_fix: true
  allow_major: false       # No major version bumps

CI/CD への統合

GitHub Actions
- name: Dependency Scan
  run: |
    /dependency-scan --severity critical,high --fail-on-findings

- name: Auto-fix and PR
  if: failure()
  run: |
    /dependency-scan --fix
    git add .
    gh pr create --title "Security: Update vulnerable dependencies"
Pre-Commit
#!/bin/sh
# Run on package.json changes
if git diff --cached --name-only | grep -q "package.json\|requirements.txt"; then
  /dependency-scan --severity critical,high
fi

依存関係の健全性

CVE 以外の確認項目
/dependency-scan --health

追加の確認項目:

  • 古いパッケージ:メジャーバージョンが遅れています
  • 非推奨のパッケージ:メンテナンスが終了しています
  • ライセンスの問題:互換性のないライセンスです
  • メンテナンス状況:最終更新日、未解決の問題
健全性レポート
DEPENDENCY HEALTH
=================

Outdated (major behind): 5
  react: 17.0.2 → 18.2.0
  typescript: 4.9.5 → 5.3.3

Deprecated: 1
  request: Use got, axios, or node-fetch

Unmaintained (>2 years): 2
  moment: Consider dayjs or date-fns

License Issues: 0

関連スキル

  • /security-scan - セキュリティの包括的な分析
  • /secrets-scan - 認証情報の検出
  • /config-scan - 設定のセキュリティ

コメント