praetorian-inc/trajan
GitHub: praetorian-inc/trajan
一款多平台 CI/CD 安全检测与攻击自动化工具,支持主流流水线平台的漏洞发现与可利用性验证。
Stars: 12 | Forks: 1
# Trajan: CI/CD 安全扫描器
Trajan 用于扫描 CI/CD 流水线中的安全漏洞,攻击者通常利用这些漏洞破坏软件供应链。它支持 GitHub Actions、GitLab CI、Azure DevOps、Jenkins 和 JFrog。
[](https://go.dev/)
[](LICENSE)
## 功能介绍
Trajan 解析工作流 YAML 文件,构建依赖图,运行检测插件,并通过内置的攻击能力验证可利用性。
- 跨多个 CI/CD 平台的 32 个检测插件
- 跨多个 CI/CD 平台的 24 个攻击插件
- 基于图的分析,包含污点追踪和门控检测
- 通过 WebAssembly 实现的基于浏览器的扫描器(无需后端)
- 支持多阶段序列的攻击链,可自动传递上下文
## 安装
预编译的二进制文件可在 [发布页面](https://github.com/praetorian-inc/trajan/releases) 获取。
```
go install github.com/praetorian-inc/trajan/cmd/trajan@latest
```
或从源代码构建:
```
git clone https://github.com/praetorian-inc/trajan.git
cd trajan && make build
```
## 快速使用
```
# 扫描 GitHub repo
export GH_TOKEN=ghp_your_token
trajan github scan --repo owner/repo
# 扫描 GitHub org
trajan github scan --org myorg --concurrency 20
# 扫描 GitLab projects
export GITLAB_TOKEN=glpat_your_token
trajan gitlab scan --group mygroup
# 扫描 Azure DevOps
export AZURE_DEVOPS_PAT=your_pat
trajan ado scan --org myorg --repo myproject/myrepo
# JSON output
trajan github scan --repo owner/repo -o json > results.json
```
有关详细用法、检测说明和攻击演示,请参阅 [Wiki](https://github.com/praetorian-inc/trajan/wiki)。
## 平台覆盖范围
| 平台 | 检测 | 攻击 | 枚举 |
|----------|-----------|---------|-----------|
| GitHub Actions | 11 | 9 | token, repos, secrets |
| GitLab CI | 8 | 3 | token, projects, groups, secrets, runners, branch-protections |
| Azure DevOps | 6 | 9 | token, projects, repos, pipelines, connections, agent-pools, users, groups, 及更多 |
| Jenkins | 7 | 3 | access, jobs, nodes, plugins |
| JFrog | 仅扫描 | - | - |
## 浏览器扩展
Trajan 还可以编译为 WebAssembly 二进制文件,作为单个 HTML 文件完全在浏览器中运行。它使用与 CLI 相同的检测引擎、攻击插件和枚举逻辑,只是编译成了 WASM。Trajan 的 Web 版本可在评估过程中以低摩擦的方式交付到目标环境中。
```
make wasm # build browser/trajan.wasm
make wasm-dist # build self-contained trajan-standalone.html
```
## 架构
```
graph TD
subgraph CLI
CMD[Cobra Commands]
end
subgraph Platforms
GH[GitHub]
GL[GitLab]
ADO[Azure DevOps]
JK[Jenkins]
JF[JFrog]
end
CMD --> GH & GL & ADO & JK & JF
subgraph SF[Scan Flow]
API[Platform API] --> |fetch workflows| YAML[Workflow YAML]
YAML --> P
subgraph P[Parser]
direction LR
GHP[GitHub] ~~~ GLP[GitLab] ~~~ ADP[Azure] ~~~ JKP[Jenkins]
end
P --> NW[Normalized Workflow]
NW --> GB[Graph Builder]
GB --> Graph[Workflow → Job → Step Graph]
end
subgraph AE[Analysis Engine]
direction LR
TT[Taint Tracker] --> Tagged[Tagged Graph]
Tagged --> DP[Detection Plugins]
DP --> GA[Gate Analysis]
GA --> Findings
end
subgraph AF[Attack Flow]
direction LR
AP[Attack Plugins] --> |artifacts| Session[Session Tracker]
Session --> Cleanup
end
Graph --> AE
AE --> AF
```
## 路线图
正在积极开发对更多 CI/CD 平台的支持:
- Bitbucket Pipelines
- CircleCI
- AWS CodePipeline
- Google Cloud Build
## 致谢
基于 Adnan Khan 的 [Gato](https://github.com/praetorian-inc/gato)、[Glato](https://github.com/praetorian-inc/glato)、[Gato-X](https://github.com/AdnaneKhan/gato-x) 以及 [GitHub Security Lab](https://securitylab.github.com/research/) 的研究构建。
## 许可证
Apache 2.0。详见 [LICENSE](LICENSE)。标签:AI工具, Azure DevOps, CI/CD 安全, DevSecOps, EVTX分析, GitHub Actions, GitLab CI, Go, Jenkins, JFrog, RCE 检测, Ruby工具, StruQ, WebAssembly, YAML 解析, 上游代理, 云安全监控, 人体姿态估计, 依赖图分析, 加密, 威胁建模, 安全合规, 攻击自动化, 数据投毒防御, 文档安全, 日志审计, 漏洞扫描器, 管道配置审计, 网络代理, 自动化攻击, 自动笔记, 软件工厂, 静态分析