Corgea/Sighthound

GitHub: Corgea/Sighthound

Sighthound 是一款基于 Tree-sitter 的规则驱动型静态漏洞扫描器,通过 AST 模式匹配与污点分析帮助团队在多种编程语言的项目中自动发现源代码安全问题。

Stars: 239 | Forks: 17

# Sighthound
![Sighthound Logo](https://static.pigsec.cn/wp-content/uploads/repos/cas/51/512ac70e7585de136c4066c63fa9eaebb320d658a49bb0d9202a4d0eb0831c2a.png) 基于 Tree-sitter 的静态漏洞扫描器,支持模式匹配和污点分析。 [![Rust](https://img.shields.io/badge/rust-1.85+-orange.svg)](https://www.rust-lang.org) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/Corgea/Sighthound/actions/workflows/ci.yml)
## 功能 - 使用感知 AST 的规则扫描源代码以查找安全问题。 - 支持模式匹配(pattern mode)和污点模式(taint mode,从 source 到 sink 的跟踪)。 - 处理多文件项目并支持并行执行。 - 将扫描结果输出为文本、JSON 或 CSV 格式。 - 根据文件扩展名加载内置规则包,并支持可选的基于文件的自定义规则。 ## 支持的语言 | 语言 | 扩展名 | 解析器 | 内置规则 | |---|---|---|---| | Python | `.py`, `.pyw`, `.pyi`, `.pyx` | Yes | Yes | | JavaScript | `.js`, `.mjs`, `.cjs`, `.jsx`, `.vue`, `.svelte` | Yes | Yes | | TypeScript / TSX | `.ts`, `.tsx`, `.mts`, `.cts` | Yes | Yes (JS rules) | | Java | `.java` | Yes | Yes | | PHP | `.php`, `.phtml` | Yes | Yes | | C# | `.cs`, `.csx` | Yes | Yes | | Go | `.go` | Yes | Yes | | Ruby | `.rb` | Yes | Yes | | HTML | `.html`, `.htm`, `.twig`, `.ejs`, `.hbs`, ... | Yes | Yes | | Django 模板 | `.html` (Django 语法) | Yes | Yes (HTML rules) | 目前不支持:Razor (`.cshtml`)、C/C++ (`.c`, `.h`)。 ## 安装 前置条件: - Rust 1.85+ - Git 从源码构建: ``` 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`。 ## 快速开始 ``` # 自动检测语言并运行 embedded rules cargo run --bin sighthound -- /path/to/project # Explicit language + 自定义规则路径 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 ``` CLI 命令结构: ``` sighthound [OPTIONS] [LANGUAGE] [RULES_PATH] ``` 运行 `sighthound --help` 获取完整的选项列表。 ## 规则 规则使用 RON 编写,并支持: - `mode: "search"` 用于模式匹配 - `mode: "taint"` 用于 source/sink/sanitizer 分析 从这里开始: - [规则编写指南](rules/RULE_WRITING_GUIDE.md) - [内置规则目录](rules) ## 开发 核心命令: ``` 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 ``` 额外的质量检查: ``` make complexity make audit make acceptance cargo harness coverage --min=0 cargo harness crap --max=30 ``` ## 限制 - 可能会遗漏动态代码路径中仅在运行时存在的漏洞。 - 超大文件可能会增加扫描时间。 - 支持多文件污点分析,但仍是一个有待进一步完善的领域。 ## 贡献 - [贡献指南](CONTRIBUTING.md) - [行为准则](CODE_OF_CONDUCT.md) - [安全政策](SECURITY.md) ## 许可证 - [MIT License](LICENSE) - [第三方声明](THIRD-PARTY-NOTICES.md)
标签:IPv6支持, Redis利用, Rust, SAST, 可视化界面, 盲注攻击, 网络流量审计, 请求拦截, 通知系统, 静态应用安全测试, 默认DNS解析器