BACO uses a data-driven PhaseGraph (src/scanner/pipeline/orchestrator.rs) that defines phase execution order, dependencies, and metadata in a single source of truth. This eliminates duplication across the codebase and enables:
- Centralized phase ordering - All phases defined in one place with execution metadata
- Checkpoint/resume support - Stable phase indices for reliable restart
- Extensibility - New phases can be added without modifying multiple files
- Runtime validation - Phase consistency checked on startup
Core Pipeline (29 phases):
- Indexing: Build file list and call graph
- Semgrep: Static analysis with predefined rules
- CWE Routing: Mixture-of-experts routing to appropriate analyzers
- CPG Slicing: CPG-guided code slicing for precise analysis
- LLM Static Analysis: Independent LLM-based code analysis
- Hunt: Targeted vulnerability hunting
- Validate: Validate findings with context
- Independent Verify: Independent verification pass
- Exploit Synthesis: Generate exploit proofs
- LLM Discovery: Multi-model vulnerability detection with CVE enrichment
- LLM Verification: Validation with PoC generation and mitigation code
- SecurityAgent Verification: Tool-based agent verification using file_read, pattern_search, file_write, run_test
- Ticket Cross-Ref: Search GitHub/GitLab for existing reports
- Git Analysis: Check commit history for related fixes
- Cross-File Analysis: Trace data flow between files
- Confidence Scoring: Calculate composite reliability score
- AI Aggregation: Generate executive summary, semantic deduplication, and LLM-enriched descriptions
- Reporting: Generate JSON, HTML, and SARIF outputs
- Threat Modeling: Generate THREAT_MODEL.md with attack surface analysis
- Root Cause Dedup: Deduplicate findings by root cause instead of location
- Multi-Verifier: Multiple verification methods with majority voting
- Auto-Patching: Generate and validate patches with staging
- CVE Bootstrap: Enrich findings with NVD/CISA KEV data
- PoC Compiler: Verify PoC code compiles successfully
- Variant Search: Search for related vulnerability variants
- Rule Synthesis: MOCQ LLM→semgrep rule synthesis
- Complete: Final phase marker
flowchart LR
subgraph Detection["Detection"]
direction TB
A1[Indexing] --> A2[Semgrep] --> A3[CWE Routing] --> A4[CPG Slicing]
A4 --> A5[LLM Static] --> A6[Hunt] --> A7[Validate]
A7 --> A8[Independent Verify] --> A9[Exploit Syn] --> A10[LLM Discovery]
A10 --> A11[LLM Verify]
end
subgraph Triage["Triage"]
direction TB
B1[SecurityAgent Verify] --> B2[Ticket Cross-Ref] --> B3[Git Analysis]
B3 --> B4[Cross-File] --> B5[Confidence]
end
subgraph Aggregation["Aggregation"]
direction TB
C1[AI Aggregation] --> C2[Reporting]
end
subgraph Output["Output"]
direction TB
D1[Threat Model] --> D2[Root Cause Dedup] --> D3[Multi-Verifier]
D3 --> D4[Auto-Patch] --> D5[CVE Bootstrap]
D5 --> D6[PoC Compiler] --> D7[Variant Search]
D7 --> D8[Rule Synthesis] --> D9[Complete]
end
Detection --> Triage --> Aggregation --> Output
classDef detection fill:#e1f5fe
classDef triage fill:#fff3e0
classDef aggregation fill:#f3e5f5
classDef output fill:#e8f5e9
class Detection,Triage,Aggregation,Output detection
Checkpoint markers: Checkpoints are saved after each major phase, enabling resume from any point in the pipeline.