
파이프라인 구성에서 보안 취약점을 식별하기 위한 다중 플랫폼 CI/CD 취약점 탐지 및 공격 자동화 도구입니다.
Trajan은 공격자가 소프트웨어 공급망을 손상시키는 데 사용하는 CI/CD 파이프라인의 보안 취약점을 스캔합니다. GitHub Actions, GitLab CI, Azure DevOps, Jenkins 및 JFrog를 지원합니다.
Trajan은 워크플로 YAML 파일을 파싱하고, 종속성 그래프를 구축하며, 탐지 플러그인을 실행하고, 내장된 공격 기능을 통해 악용 가능성을 검증합니다.
[!NOTE] Trajan은 활발히 개발 중입니다. 일부 기능은 불완전하거나 미흡할 수 있습니다. 문제가 발생하면 이슈를 열어주세요.
사전 빌드된 바이너리는 릴리스 페이지에서 확인할 수 있습니다.
go install github.com/praetorian-inc/trajan/cmd/trajan@latest
또는 소스에서 빌드:
git clone https://github.com/praetorian-inc/trajan.git
cd trajan && make build
repo 범위: 비공개 리포지토리, public_repo 범위: 공개 리포지토리 전용)pkg/lib)Trajan은 프로그래매틱 CI/CD 보안 스캐닝을 위해 Go 라이브러리로 임베드될 수 있습니다. pkg/lib 패키지는 Trajan의 내부 플랫폼 레지스트리, 탐지 엔진 및 스캐너를 단일 고수준 API로 래핑하는 공개 SDK를 제공합니다.
import "github.com/praetorian-inc/trajan/pkg/lib"
result, err := lib.Scan(ctx, lib.ScanConfig{
Platform: "github",
Token: os.Getenv("GH_TOKEN"),
Org: "myorg",
Repo: "myrepo",
Concurrency: 10,
Timeout: 5 * time.Minute,
})
if err != nil {
log.Fatal(err)
}
for _, f := range result.Findings {
fmt.Printf("[%s] %s in %s: %s\n", f.Severity, f.Type, f.WorkflowFile, f.Evidence)
}
type ScanConfig struct {
Platform string // CI/CD platform (required)
Token string // API authentication token
BaseURL string // Custom base URL for self-hosted instances
Org string // Organization/owner name
Repo string // Repository name (empty = scan all org repos)
Concurrency int // Parallel detection workers (default: 10)
Timeout time.Duration // Max scan duration (default: 5m)
LocalPath string // Local filesystem path (file or dir) for offline scan
}
type ScanResult struct {
Findings []detections.Finding // Security vulnerabilities detected
Workflows []platforms.Workflow // CI/CD workflow files discovered
Errors []error // Non-fatal errors during scanning
SkippedDetections []string // Detection names skipped in LocalPath mode (API-only); always empty in API-mode scans
}
SDK는 Chariot 공격 표면 관리 플랫폼에서 CI/CD 보안 스캔을 기능으로 실행하는 데 사용됩니다:
import trajanlib "github.com/praetorian-inc/trajan/pkg/lib"
result, err := trajanlib.Scan(ctx, trajanlib.ScanConfig{
Platform: platformName,
Token: token,
Org: repo.Org,
Repo: repo.Name,
})
// Convert result.Findings → capmodel.Risk emissions
# Scan a GitHub repo
export GH_TOKEN=ghp_your_token
trajan github scan --repo owner/repo
# Scan a GitHub org
trajan github scan --org myorg --concurrency 20
# Scan GitLab projects
export GITLAB_TOKEN=glpat_your_token
trajan gitlab scan --group mygroup
# Scan Azure DevOps
export AZURE_DEVOPS_PAT=your_pat
trajan ado scan --org myorg --repo myproject/myrepo
# Offline scan: scan local workflow files without API access
trajan github scan --path ./my-repo
trajan github scan --path ./.github/workflows/ci.yml
# JSON output
trajan github scan --repo owner/repo -o json > results.json
자세한 사용법, 탐지 설명 및 공격 워크스루는 Wiki를 참조하세요.
Trajan은 또한 단일 HTML 파일로 브라우저에서 완전히 실행되는 WebAssembly 바이너리로 컴파일됩니다. CLI와 동일한 탐지 엔진, 공격 플러그인 및 열거 로직을 사용하며 WASM으로 컴파일됩니다. Trajan의 웹 버전은 평가의 일환으로 대상 환경에 대한 장벽 없는 전달을 가능하게 합니다.
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 플랫폼 지원이 활발히 개발 중입니다:
개발 지침, 플러그인 작성 및 프로젝트 구조는 CONTRIBUTING.md를 참조하세요.
연구는 Gato, Glato, Adnan Khan의 Gato-X 및 GitHub Security Lab을 기반으로 합니다.
Apache 2.0. LICENSE를 참조하세요.
| 함수 | 설명 |
|---|
lib.Scan(ctx, cfg) | 전체 스캔: 플랫폼 초기화 → 워크플로 검색 → 탐지 실행 |
lib.GetPlatform(name) | 이름으로 플랫폼 어댑터 가져오기 (github, gitlab, azuredevops, bitbucket, jenkins, jfrog) |
lib.ListPlatforms() | 등록된 모든 플랫폼 이름 나열 |
lib.GetDetections(platform) | 특정 플랫폼의 탐지 플러그인 가져오기 |
lib.GetDetectionsForPlatform(platform) | 플랫폼별 + 교차 플랫폼 탐지 가져오기 |
lib.ListDetectionPlatforms() | 등록된 탐지가 있는 플랫폼 나열 |
| 플랫폼 | 탐지 | 공격 | 열거 |
|---|
| GitHub Actions | 11 | 9 | 토큰, 리포지토리, 시크릿 |
| GitLab CI | 8 | 3 | 토큰, 프로젝트, 그룹, 시크릿, 러너, 브랜치 보호 |
| Azure DevOps | 6 | 9 | 토큰, 프로젝트, 리포지토리, 파이프라인, 연결, 에이전트 풀, 사용자, 그룹 등 |
| Jenkins | 7 | 3 | 액세스, 작업, 노드, 플러그인 |
| JFrog | 스캔 전용 | - | - |