National Cyber Warfare Foundation (NCWF)login

Sighthound for tree-sitter based static vulnerability scanning across polyglot codebases


0 user ratings
2026-11-07 19:26:57
milo
Red Team (CNA)
"Sighthound

Sighthound is a Rust-built SAST scanner that combines tree-sitter AST pattern matching with taint-flow analysis to find vulnerabilities in Python, JavaScript, Go, Java and more during authorized code review and CI pipelines.








ToolCorgea/Sighthound — tree-sitter based static vulnerability scanner with pattern matching and taint-flow analysis, written in Rust
CategoryStatic application security testing (SAST) / source code analysis
Primary UseScanning your own codebases for injection, taint-flow and pattern-based vulnerabilities with JSON, CSV, SARIF or text output, wired into CI and GitHub Code Scanning
Safe UseDesigned for authorized security review: developers and AppSec teams scanning codebases they own, in CI pipelines, security research labs and defensive audit workflows
Telemetry NotePurely a local file-scanning tool; it performs no network activity and leaves no footprint beyond findings files and build artifacts under target/, making its use invisible to defenders of scanned systems

Sighthound, open-sourced by Corgea as an MIT-licensed Rust project, is a static application security testing engine built around tree-sitter parsing rather than fragile regex heuristics. The core idea is straightforward but consequential: instead of pattern-matching raw text, the tool parses each supported file into a concrete syntax tree and evaluates rules against AST nodes. That gives it two operating modes — mode: "search" for AST-aware pattern matching and mode: "taint" for source-to-sink tracking with sanitizer — and the two can be combined in a single pass over a codebase.


Language breadth is one of the project's strongest selling points. The README documents parsers and bundled rule packs for Python (.py, .pyw, .pyi, .pyx), JavaScript and its framework dialects (.js, .mjs, .cjs, .jsx, .vue, .svelte), TypeScript (.ts, .tsx, .mts, .cts, reusing the JS rules), Java, PHP, C#, Go, Ruby, ObjectScript class and routine grammars, and HTML plus Django templates. That is an unusually wide net for a young open-source scanner, and the topic list on the repository mirrors it: appsec, sast, static-analysis, tree-sitter, vulnerability-scanner across a dozen language tags.


What sets Sighthound apart architecturally is the honest engineering note in its README about SQL. Rather than quietly overclaiming, the authors state plainly that SQL is matched textually, not parsed: no grammar is compiled, no dataflow runs, and patterns are substring or anchored-glob matches against the whole file. A glob pattern containing * is anchored at byte zero, so EXEC(@sql); on line 1 is caught while the same statement on line 2 is not. Dynamic SQL inside stored-procedure bodies, CREATE USER … IDENTIFIED BY '…' and GRANT ALL … TO PUBLIC are explicitly listed as undetected. This candor is rare and useful — it tells an operator exactly where not to trust the tool.


The taint side of the house deserves equal scrutiny. The bundled SQL, .html and ObjectScript packs ship no mode: "taint" rules at all, so running with --taint-analysis on those file types succeeds with zero findings while the text output warns that taint analysis was skipped. The README also flags expected false positives (a benign || concatenation reported at Low severity) and false negatives (non-first-line dynamic SQL). Multi-file taint is supported but described as an area still being hardened, and runtime-only vulnerabilities in dynamic code paths may be missed — the standard SAST caveat, stated upfront.


Installation is a from-source affair reflecting the project's relative youth: you need Rust 1.88+ and Git, then git clone https://github.com/Corgea/Sighthound.git, cd Sighthound, and cargo build --release, which drops the binary at target/release/sighthound. For container-native workflows the README provides a DOCKER_BUILDKIT=1 multi-stage export target and a ./build_all_platforms.sh script for cross-platform builds, which suggests the team cares about shipping portable binaries into locked-down build environments — a common requirement in enterprise CI.


The CLI shape is clean: sighthound [OPTIONS] [LANGUAGE] [RULES_PATH]. With no language argument it auto-detects languages by extension and runs embedded rule packs; pass an explicit language and rules directory and it runs your own ruleset instead. Output formats are text, JSON, CSV and SARIF, and flags like --taint-analysis and --output-format json compose naturally, e.g. sighthound --taint-analysis --output-format json . > findings.json. For GitHub Code Scanning, the sarif mode emits SARIF 2.0.0-compatible output that the github/codeql-action/upload-sarif@v3 action ingests directly, surfacing findings inline on pull requests and in the repository's Security tab.


Rule extensibility is where the tool earns its keep for teams with custom coding standards. Rules are written in RON (Rusty Object Notation) and documented in a dedicated rules/RULE_WRITING_GUIDE.md, with a browsable bundled rules directory under rules/. A file-based custom ruleset loaded via RULES_PATH or --rules-dir lets you target dialects or house patterns the embedded packs don't cover — for instance, the README notes that .ddl and .dml files are scanned but every bundled rule is scoped to .sql, so you must supply custom rules whose file_types include those extensions to get coverage there.


Noise reduction starts with sensible default exclusions: whole path components matching tests/, test/, vendor/, build/, dist/ and target/ are skipped before language detection, and --include-test-fixtures reopens only tests/ and test/ when you deliberately want fixture coverage. Parallel execution across multi-file projects is built in, which matters for scanning large monorepos where serial AST parsing would dominate wall-clock time. The authors warn that very large individual files can still inflate scan duration.


An interesting modern touch is the agent-skill distribution model: npx skills add corgea/skills --skill sighthound installs a skill for Claude Code, Cursor or Codex coding agents so the agent itself knows how to install, invoke and triage the scanner. That positions Sighthound as a component in AI-assisted secure development loops rather than a standalone gate only — a pragmatic bet on where remediation workflows are heading.


The development workflow signals a project that takes quality seriously for its age: make check chains fix, format, lint, test and a suppression report; make ci runs the strict pipeline; and additional gates include make complexity, make audit, make acceptance, plus coverage thresholds (cargo harness coverage --min=0) and complexity budgets (cargo harness crap --max=30). With 283 stars, an active CI badge on main, and MIT licensing with third-party notices, it reads as a genuinely maintained tool rather than a weekend dump.


It is worth noting the commercial framing: Sighthound is the engine behind Corgea's paid corgea.app platform, which layers AI SAST, secrets, container, dependency and IaC scanning plus false-positive reduction on top. The open-source core is fully usable standalone, but the relationship explains the polish of the rule packs and the emphasis on SARIF integration. There is nothing hostile here — it is a vendor open-sourcing the scanning engine, which is a net positive for the defensive community.


For authorized professionals, the operational fit is clear: point Sighthound at repositories you own or are contracted to assess, wire the SARIF output into GitHub Code Scanning so findings ride alongside pull requests, and treat the SQL textual mode as a tripwire rather than a guarantee. It is a defensive instrument — a local, non-networked analyzer that helps engineers find and fix their own vulnerabilities before anyone else does, and its documented limitations make it easy to reason about where its findings are trustworthy and where human review must fill the gap.



Official project repository for Corgea/Sighthound.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/sighthound-for-tree-sitter-based-static.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.