
コードベースをスキャンして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スクリプト、pre-commitフック、またはGitHub Actionとして既存のワークフローに適合します。ネットワーク呼び出しを行わず、4つの小さなランタイム依存関係を持ちます。
| 122のセキュリティルール | 15のファミリーにわたる:インジェクション、エクスフィルトレーション、ジェイルブレイク、安全でないツール使用、コマンドインジェクション、RAGポイズニング、エンコーディングと隠しコンテンツ、出力処理、マルチモーダル、エージェントスキル、エージェント、MCP、サプライチェーン、リソース消費、永続化 |
| OWASPマッピング | すべてのルールがOWASP Top 10 for LLM Applications (2025)およびAgentic Applications (2026)のIDを持ち、hound explain、--verbose、SARIFタグ、すべてのレポートに表示されます |
| 数値リスクスコア (0-100) | 低、中、高、クリティカルのしきい値を持つ正規化されたリポジトリレベルのスコア |
| 緩和策の検出 | プロンプト内の明示的な安全言語がスコアを下げます |
| 9つの出力形式 | コンソール、JSON、SARIF、GitHub Annotations、Markdown、JSONLストリーミング、インタラクティブHTML、CSV、JUnit XML |
| GitHub Action同梱 | リスクのある変更でCIを失敗させ、SARIFをCode Scanningにアップロードし、プルリクエストにサマリーコメントを保持できます |
| 自動修正 | hound fixは隠しUnicode文字(ENC-002からENC-005)をプレビューして削除します |
| マルチ言語スキャン | TypeScriptとJavaScriptだけでなく、Python、Go、Rust、Java、C#、PHP、Ruby、Swift、Kotlin、Vue、BashでのLLM API使用を検出 |
| ルールフィルタリング | プレフィックスグロブ構文(CMD-*)を持つexcludeRules/includeRules;minConfidenceフィルター |
| インクリメンタルキャッシュ | .hound-cache.jsonは再実行時に変更されていないファイルをスキップします;--no-cacheで無効化 |
.gitignoreを尊重 | gitが無視するファイルはスキップされます;.houndignoreは同じ構文で除外を追加します |
| プラグインシステム | 設定の"plugins": ["./my-rule.js"]を介してローカルの.jsファイルからカスタムルールを読み込み |
| ベースライン / diffモード | --baseline results.jsonは以前のスキャンに存在しない検出結果のみを報告して失敗させます;--diffは変更されたファイルのみをスキャン |
| ウォッチモード | --watchはファイル変更時に再スキャンし、差分の検出結果を表示 |
| 並列スキャン | 同時ファイル処理(--concurrency <n>、デフォルト8) |
| 完全オフライン | API呼び出しもテレメトリもなし |
グローバルインストールはhoundコマンドをPATHに追加します:
npm install -g context-hound
プロジェクト単位のインストールは1つのリポジトリにスコープされ、npx hound または npm スクリプト経由で実行されます:
npm install --save-dev context-hound
インストールせずに、npx がパッケージを取得して実行します:
npx context-hound scan --dir .
# 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
# Also scan files that git ignores (skipped by default)
hound scan --no-gitignore
# Preview, then remove, hidden Unicode characters flagged by ENC-002 to ENC-005
hound fix
hound fix --write
# 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
# Scan files up to 5 MB (default limit is 1 MiB; 0 = no limit)
hound scan --max-file-size 5242880
終了コード:
| コード | 意味 |
|---|---|
0 | 合格: スコアがしきい値を下回り、failOn 違反なし |
1 | 未処理のエラーまたは不正な引数 |
2 | しきい値超過: リポジトリのスコアがしきい値以上、またはファイルが failFileThreshold を超過 |
3 | --fail-on 違反: その重大度以上の検出結果 |
ContextHound Action を使用して、プッシュとプルリクエストのたびにスキャンし、検出結果を GitHub Code Scanning にアップロードし、リスクのある変更のマージをブロックします:
# .github/workflows/contexthound.yml
name: Prompt Audit
on: [push, pull_request]
jobs:
hound:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write # SARIF upload to Code Scanning
steps:
- uses: actions/checkout@v7
- uses: IulianVOStrut/ContextHound@v2
with:
fail-on: high
検出結果はリポジトリの Security > Code scanning タブに表示され、プルリクエスト上のアノテーションとしても表示されます。
| 入力 | デフォルト | 説明 |
|---|---|---|
version | Action に対応するリリース | 実行する context-hound npm バージョンを正確に指定 |
dir | . | スキャンするディレクトリ |
config | .contexthoundrc.json へのパス | |
threshold | config または 60 | リポジトリのスコアがこの値以上の場合に失敗とする |
fail-on | この重大度以上の検出結果で失敗とする: critical、high、medium | |
min-confidence | low、medium、high の信頼度以上のルールのみを報告する | |
diff | この git ref と比較して変更されたファイルのみをスキャンする。例: origin/${{ github.base_ref }}(checkout で fetch-depth: 0 が必要) | |
preset | カンマ区切りのルールプリセット。例: owasp-llm-top10 | |
sarif-out | results.sarif | SARIF レポートの出力先 |
upload-sarif | true | レポートを Code Scanning にアップロードする |
node-version | 最初にこの Node.js バージョンをセットアップする(デフォルト: ランナーの Node.js を使用) | |
comment | false | プルリクエストで、サマリーコメントを投稿し、以降の実行で更新する(pull-requests: write が必要) |
github-token | github.token | プルリクエストコメントに使用するトークン |
出力: score、findings、passed、sarif-file。以降のステップで使用できます。