
| 言語 | 拡張子 | パーサー | バンドルルール |
|---|---|---|---|
| Python | .py, .pyw, .pyi, .pyx | はい | はい |
| JavaScript | .js, .mjs, .cjs, .jsx, .vue, .svelte | はい | はい |
| TypeScript / TSX | .ts, .tsx, .mts, .cts | はい | はい (JSルール) |
| Java | .java | はい | はい |
| PHP | .php, .phtml | はい | はい |
| C# | .cs, .csx | はい | はい |
| Go | .go | はい | はい |
| Ruby | .rb | はい | はい |
| HTML | .html, .htm, .twig, .ejs, .hbs, ... | はい | はい |
| Django テンプレート | .html (Django 構文) | はい | はい (HTMLルール) |
現在サポートされていないもの: Razor (.cshtml), C/C++ (.c, .h)。
前提条件:
ソースからビルド:
git clone https://github.com/Corgea/Sighthound.git
cd Sighthound
cargo build --release
バイナリパス: target/release/sighthound
Linux コンテナ互換のリリースエクスポート:
DOCKER_BUILDKIT=1 docker build \
--target export \
--output type=local,dest=./sighthound_release \
.
または ./build_all_platforms.sh を実行します。
# 言語を自動検出し、バンドルルールを実行
cargo run --bin sighthound -- /path/to/project
# 言語を明示的に指定 + カスタムルールパス
cargo run --bin sighthound -- /path/to/project python rules/python
# Taint 分析のみ + JSON 出力
cargo run --bin sighthound -- --taint-analysis --output-format json /path/to/project > findings.json
# GitHub Code Scanning 向け SARIF 出力
cargo run --bin sighthound -- --output-format sarif /path/to/project > results.sarif
CLI の形式:
sighthound [オプション] <ROOT_DIR> [言語] [ルールパス]
完全なオプション一覧は sighthound --help を実行してください。
sarif 出力形式は SARIF 2.1.0 を書き出します。これは GitHub Code Scanning が直接取り込むことができます。ワークフローからアップロードすることで、プルリクエスト上やリポジトリの Security タブに検出結果がインライン表示されます。
リポジトリルートからスキャンを実行し、<ROOT_DIR> として .(またはリポジトリルートの絶対パス)を使用すると、SARIF アーティファクト URI がリポジトリ相対のままになります。
- name: Run Sighthound
run: sighthound --output-format sarif . > results.sarif
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
ルールは RON で記述し、次の両方をサポートします:
mode: "search" パターンマッチング用mode: "taint" ソース/シンク/サニタイザー分析用こちらから始めてください:
コアコマンド:
make check # 修正 + フォーマット + lint + テスト + 抑制レポート
make pre-commit # ステージングされた Rust ファイル (フック)
make pre-push # プッシュゲートチェック
make ci # 厳格な CI パイプライン
追加の品質ゲート:
make complexity
make audit
make acceptance
cargo harness coverage --min=0
cargo harness crap --max=30