
Tree-sitter basierter statischer Schwachstellenscanner mit Mustererkennung und Taint-Flow-Analyse für mehrsprachigen Quellcode. Gibt Ergebnisse als Text, JSON, CSV oder SARIF für CI/CD-Integration aus.
| Sprache | Erweiterungen | Parser | Mitgelieferte Regeln |
|---|---|---|---|
| Python | .py, .pyw, .pyi, .pyx | Ja | Ja |
| JavaScript | .js, .mjs, .cjs, .jsx, .vue, .svelte | Ja | Ja |
| TypeScript / TSX | .ts, .tsx, .mts, .cts | Ja | Ja (JS-Regeln) |
| Java | .java | Ja | Ja |
| PHP | .php, .phtml | Ja | Ja |
| C# | .cs, .csx | Ja | Ja |
| Go | .go | Ja | Ja |
| Ruby | .rb | Ja | Ja |
| HTML | .html, .htm, .twig, .ejs, .hbs, ... | Ja | Ja |
| Django-Vorlagen | .html (Django-Syntax) | Ja | Ja (HTML-Regeln) |
Derzeit nicht unterstützt: Razor (.cshtml), C/C++ (.c, .h).
Voraussetzungen:
Aus Quellcode erstellen:
git clone https://github.com/Corgea/Sighthound.git
cd Sighthound
cargo build --release
Binary-Pfad: target/release/sighthound
Linux-Container-kompatibler Release-Export:
DOCKER_BUILDKIT=1 docker build \
--target export \
--output type=local,dest=./sighthound_release \
.
Oder führen Sie ./build_all_platforms.sh aus.
# Sprachen automatisch erkennen und eingebettete Regeln ausführen
cargo run --bin sighthound -- /path/to/project
# Explizite Sprache + benutzerdefinierter Regelsatz-Pfad
cargo run --bin sighthound -- /path/to/project python rules/python
# Nur Taint-Scan und JSON-Ausgabe
cargo run --bin sighthound -- --taint-analysis --output-format json /path/to/project > findings.json
# SARIF-Ausgabe für GitHub Code Scanning
cargo run --bin sighthound -- --output-format sarif /path/to/project > results.sarif
CLI-Form:
sighthound [OPTIONS] <ROOT_DIR> [LANGUAGE] [RULES_PATH]
Führen Sie sighthound --help für die vollständige Optionsliste aus.
Das Ausgabeformat sarif schreibt SARIF 2.1.0, das GitHub Code Scanning direkt verarbeitet. Laden Sie es aus einem Workflow hoch, damit Ergebnisse inline im Pull-Request und im Security-Tab des Repositorys angezeigt werden:
Führen Sie den Scan aus dem Repository-Stammverzeichnis aus und verwenden Sie . (oder den absoluten Pfad des Repository-Stammverzeichnisses) als <ROOT_DIR>, damit die SARIF-Artefakt-URIs repository-relativ bleiben.
- 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
Regeln werden in RON geschrieben und unterstützen beide:
mode: "search" für Mustervergleichmode: "taint" für Quellen-/Senken-/Sanitizer-AnalyseStarten Sie hier:
Kernbefehle:
make check # fix + format + lint + test + suppression report
make pre-commit # staged Rust files (hook)
make pre-push # push gate checks
make ci # strict CI pipeline
Zusätzliche Qualitätskontrollen:
make complexity
make audit
make acceptance
cargo harness coverage --min=0
cargo harness crap --max=30