
コードベースをスキャンしてLLMのプロンプトインジェクションやマルチモーダルセキュリティの脆弱性を検出する静的解析ツールです。オフラインで動作し、APIコールは不要です。
ContextHoundは、開発・ブラウジングのワークフロー全体で利用可能です。
| ツール | 機能 | インストール方法 |
|---|---|---|
| CLI / npm パッケージ | コードベースをスキャンしてプロンプトインジェクションの脆弱性を検出。GitHub Actionsと統合し、SARIF、JSON、HTMLなどを出力。 | npm install -g context-hound |
| VS Code 拡張機能 | コーディング中のインラインファインディング、コードアクション、出力チャンネル、ステータスバー。 | VS Code Marketplace |
| ブラウザ拡張機能 | AIチャットインターフェース上のリアルタイムスキャンピル、LLM APIトラフィック用DevToolsパネル、ポップアップスキャナー。ChromeとFirefox対応。 | Firefox: 無料インストール · Chrome: 審査中 · ソース |
LLMを活用したアプリケーションがプロダクションコードベースで一般的になるにつれ、プロンプトインジェクションは最も悪用されやすい攻撃対象の一つとして浮上しています。しかし、ほとんどのセキュリティスキャナーはこれを認識していません。
ContextHoundは、プロンプトレイヤーに静的解析をもたらします。
既存のワークフローに、CLIコマンド、npmスクリプト、またはGitHub Actionとして適合し、外部依存関係はゼロです。
| 95のセキュリティルール | 14カテゴリにわたる:インジェクション、不正送信、脱獄、安全でないツール使用、コマンドインジェクション、RAGポイズニング、エンコーディング、出力処理、マルチモーダル、スキルマーケットプレイス、エージェント、MCP、サプライチェーン、DoS |
| 数値リスクスコア(0-100) | リポジトリレベルの正規化スコア(低・中・高・重大のしきい値あり) |
| 緩和策の検出 | プロンプト内の明示的な安全な表現によりスコアが低下 |
| 7つの出力形式 | コンソール、JSON、SARIF、GitHub Annotations、Markdown、JSONLストリーミング、インタラクティブHTML |
| GitHub Action内蔵 | 高リスク時にCIを失敗させ、SARIF結果を自動アップロード |
| 多言語スキャン | Python、Go、Rust、Java、C#、PHP、Ruby、Swift、Kotlin、Vue、BashでのLLM API使用を検出(TypeScript/JavaScriptだけでない) |
| ルールフィルタリング | excludeRules/includeRules(プレフィックスグロブ構文 CMD-*); minConfidenceフィルター |
| インクリメンタルキャッシュ | .hound-cache.json で再実行時に変更のないファイルをスキップ; --no-cache で無効化 |
| プラグインシステム | 設定ファイルの "plugins": ["./my-rule.js"] により、ローカルの .js ファイルからカスタムルールを読み込み |
| ベースライン / 差分モード | --baseline results.json — 以前のスキャンに存在しないファインディングのみ報告・失敗 |
| ウォッチモード | --watch でファイル変更時に再スキャンし、差分ファインディングを表示 |
| 並列スキャン | 同時ファイル処理(--concurrency <n>、デフォルト8) |
| 完全オフライン | APIコールなし、テレメトリーなし、有料依存関係なし |
グローバルインストール — hound コマンドをPATHに追加:```bash
npm install -g context-hound
**プロジェクトごとのインストール** — 1つのリポジトリにスコープされ、`npx hound` または npmスクリプト経由で実行します:```bash
npm install --save-dev context-hound
Zero-install — インストール不要、キャッシュされたnpmレジストリのコピーを使用:```bash npx context-hound scan --dir .
## クイックスタート```bash
# Scaffold a config file
hound init
# Scan your project
hound scan --dir ./my-ai-project
# Or via npm script (scans current directory)
npm run hound
# Verbose output, shows remediations and confidence levels
hound scan --verbose
# Fail the build on any critical finding
hound scan --fail-on critical
# Export JSON and SARIF reports
hound scan --format console,json,sarif --out results
# GitHub Annotations (for CI step summaries)
hound scan --format github-annotations
# Markdown report with findings tables
hound scan --format markdown --out report
# Stream findings as JSONL (one JSON object per line)
hound scan --format jsonl | jq '.severity'
# List all rules
hound scan --list-rules
# Explain a rule (or a rule family by prefix)
hound explain INJ-001
hound explain PST --format json
# Fast PR gate — scan only files changed vs. origin/main
hound scan --diff
# Interactive HTML report (self-contained, open in browser)
hound scan --format html --out report
# Re-scan on file changes
hound scan --watch
# Parallel scanning (default is 8; tune for your machine)
hound scan --concurrency 16
# Disable incremental cache for a clean run
hound scan --no-cache
# Baseline mode — only report findings new since the last saved scan
hound scan --format json --out baseline # save a baseline
hound scan --baseline baseline.json # compare future scans against it
# Load a custom rule from a local plugin file
hound scan # plugin declared in .contexthoundrc.json "plugins" field
# Only run high-confidence rules
hound scan --config .contexthoundrc.json # set minConfidence: "high"
# Fail if any single file scores >= 40
hound scan --fail-file-threshold 40
終了コード:
| コード | 意味 |
|---|---|
0 | 合格 — スコアがしきい値を下回り、failOn違反なし |
1 | 未処理のエラーまたは不正な引数 |
2 | しきい値違反 — リポジトリのスコアがしきい値以上、またはファイルのしきい値を超過 |
3 | --fail-on違反 — 指定された重要度の検出があった |
ワークフローに追加して、プロンプトのリスクが高すぎる場合のマージをブロックします:```yaml
name: Prompt Audit
on: [push, pull_request]
jobs: hound: runs-on: ubuntu-latest permissions: contents: read security-events: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install -g context-hound
- run: hound scan --format console,sarif,github-annotations --out results.sarif
- name: Upload to GitHub Code Scanning
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
結果はリポジトリの **Security > Code scanning** タブに表示されます。`github-annotations` 形式は、PRにインラインコメントを投稿し、GitHubステップサマリーにサマリーテーブルを書き込みます。
---
## 設定