
Static Analysis
SkillTrail of Bits 出品的静态分析技能组:用 CodeQL 做跨过程污点追踪与数据流分析,用 Semgrep 做规则扫描,并解析、去重 SARIF 结果。需本机安装 CodeQL 或 Semgrep。
Static Analysis
A comprehensive static analysis toolkit with CodeQL, Semgrep, and SARIF parsing for security vulnerability detection.
CodeQL and Semgrep skills are based on the Trail of Bits Testing Handbook:
Author: Axel Mierczuk & Paweł Płatek
Skills Included
| Skill | Purpose |
|---|---|
codeql | Deep security analysis with taint tracking and data flow |
semgrep | Fast pattern-based security scanning |
sarif-parsing | Parse and process results from static analysis tools |
When to Use
Use this plugin when you need to:
- Perform security vulnerability detection on codebases
- Run CodeQL for interprocedural taint tracking and data flow analysis
- Use Semgrep for fast pattern-based bug detection
- Parse SARIF output from security scanners
- Aggregate and deduplicate findings from multiple tools
What It Does
CodeQL
- Create databases for Python, JavaScript, Go, Java, C/C++, and more
- Run security queries with SARIF/CSV output
- Generate data extension models for project-specific APIs
- Select and combine query packs (security-extended, Trail of Bits, Community)
Semgrep
- Quick security scans using built-in rulesets (OWASP, CWE, Trail of Bits)
- Write custom YAML rules with pattern matching
- Taint mode for tracking data flow from sources to sinks
- CI/CD integration with baseline scanning
SARIF Parsing
- Understand SARIF 2.1.0 structure
- Resolve a result's severity from the rule it inherits it from, which CodeQL relies on
- Quick analysis using jq for CLI queries
- Python scripting with pysarif and sarif-tools
- Aggregate and deduplicate results from multiple files
- CI/CD integration patterns
Running a Semgrep scan
Two entry points over one implementation.
/static-analysis:semgrep-scan {"target": "/abs/path", "mode": "run-all"}
runs the scan end to end: detect languages and Pro, select rulesets, scan, merge, report. It
does not stop to have the ruleset list approved — invoking it with a target is the opt-in. That
is safe because the scan is read-only over the target: no --autofix, every write inside the
output directory, and it refuses to run when the output directory is the target.
Ask for the semgrep skill instead when the ruleset selection is the thing that matters. Its
five-step path presents the list and waits for approval before anything runs. Both paths read
the same references/, so a ruleset added to rulesets.md reaches both.
Workflows Included
| Workflow | Purpose |
|---|---|
workflows/semgrep-scan.js | Ships as /static-analysis:semgrep-scan. Four phases: Detect, Select, Scan, Report |
workflows/codeql-build.js | Ships as /static-analysis:codeql-build. Three phases: Detect, Build, Assess. Walks the build-method ladder — autobuild, custom command, multi-step, no-build — diagnosing and retrying at each rung, then enforces the quality gate |
Scripts Included
| Script | Purpose |
|---|---|
skills/semgrep/scripts/run-scans.sh | Builds every semgrep command from the selected rulesets, clones the third-party rule repos, runs the scans in batches and writes scans.json |
skills/semgrep/scripts/merge_sarif.py | Merges the per-scan SARIF into one results.sarif |
Generating the commands in one place is what makes --metrics=off, the --include scoping
rule, and the output-directory --exclude properties of the code rather than instructions a
model can drop.
No subagent runs any part of the scan — the workflow's Scan phase calls run-scans.sh. Exit
codes come from the semgrep processes and finding counts from the JSON they wrote, so nothing in
the result is a self-report that a later step has to go behind and verify.
Tests
Both suites are hermetic, reach no network, and are discovered by CI's existing shell-suite step.
| Suite | Covers |
|---|---|
tests/run_scan_tests.sh | run-scans.sh: command generation via --dry-run, plus execution, exit codes and clone failures against stub semgrep and git binaries |
tests/run_workflow_tests.sh | semgrep-scan.js, via tests/workflow-harness.js, which compiles it with stubbed globals. --self-test mutates the workflow and requires every mutation to turn a scenario red |
Installation
/plugin install trailofbits/skills/plugins/static-analysis
Related Skills
variant-analysis- Use CodeQL/Semgrep patterns to find bug variants
相關資源

Trail of Bits Skills
Skill安全公司 Trail of Bits 出品的技能合集,40 多个插件覆盖代码审计、CodeQL/Semgrep 静态分析、差异评审、智能合约与密码学审计、模糊测试等,也可作为 Claude Code / Codex 插件市场安装。
trailofbits/skills7.6k
Variant Analysis
SkillTrail of Bits 出品,从一个已确认的漏洞出发提炼根因,编写并逐步泛化 CodeQL / Semgrep 查询,在整个代码库里查找同类变体并分级报告。
trailofbits/skills7.6k
Trail of Bits Skills
Plugin安全公司 Trail of Bits 的插件市场,收录 40 多个插件,覆盖代码审计、CodeQL / Semgrep 静态分析、变体分析、供应链风险、智能合约安全与逆向分析。Codex 也可以直接加载。
trailofbits/skills7.6k
Semgrep
CLI语义化的多语言静态分析工具:用写法接近源码的规则查找漏洞与缺陷,支持 30 多种语言与自定义规则,默认在本地扫描、不上传代码。跨文件分析与 Pro 规则需登录。
semgrep/semgrep17.1k
Semgrep MCP
MCPSemgrep 官方 MCP 服务器,已并入 semgrep 主仓库,通过 semgrep mcp 启动:让 agent 对代码做静态安全扫描、用自定义规则查找问题并查看语法树。需先安装 Semgrep CLI;接入 AppSec 平台需 SEMGREP_APP_TOKEN。
semgrep/semgrep17.1k
Supply Chain Risk Auditor
SkillTrail of Bits 出品的技能:审计 npm、PyPI、Go 依赖的供应链风险——直接依赖与整棵锁文件树的已知漏洞公告、已弃用或归档的上游、npm 发布者集中度、安装期脚本执行。需要 uv,建议配置已登录的 gh。
trailofbits/skills7.6k