Welcome! BACO (Bug Analysis & Cross-reference Orchestrator) is a research-backed SAST scanner that augments static analysis with LLM-powered discovery across a 24-phase pipeline. Sponsored by Regolo.AI, this project integrates techniques from 20 academic papers to detect vulnerabilities with higher accuracy than traditional tools.
-
Clone the repository:
git clone https://github.com/CodeAtCode/baco-scanner.git cd baco-scanner -
Build from source:
cargo build
-
Run the test suite:
cargo test
-
Create a branch from
masterfor your feature or fix:git checkout -b feat/your-feature-name
-
Make your changes following the code standards below.
-
Run the CI gate locally before committing:
cargo fmt --check cargo clippy --all-targets -- -D warnings cargo test -
Commit with conventional commit messages:
feat:New featurefix:Bug fixdocs:Documentation changesrefactor:Code restructuringtest:Test additions/updateschore:Maintenance tasks
- Rust 1.74+ MSRV: Do not use APIs stabilized after Rust 1.74. The
rust-versionfield inCargo.tomlenforces this. - Zero clippy warnings: All code must pass
cargo clippy --all-targets -- -D warnings. - All tests must pass: No commits when tests fail.
- No inline test modules:
#[cfg(test)]blocks are forbidden insrc/. All tests go intests/unit/ortests/integration/. - Test file naming: Use
<module_name>_tests.rsin the matching subdirectory (e.g.,tests/unit/scanner_phases_tests.rs). - Test module declaration: Declare tests in
tests/unit/mod.rsusing full crate paths.
Adding a phase requires updates in multiple locations:
- PhaseGraph: Register the phase in
src/scanner/pipeline/orchestrator.rswith stable index. - Checkpoint transitions: Add checkpoint handling for the new phase.
- Tests: Update all phase-count references in test files.
- Documentation: Update
docs/architecture.mdandREADME.mdphase counts.
Phase order is defined ONCE in PhaseGraph::new() (src/scanner/pipeline/orchestrator.rs). The parallel/sequential split lives in src/scanner/orchestrator.rs (scheduled_parallel_phases / scheduled_sequential_phases); docs/architecture.md mirrors this structure.
Prompt templates live in:
prompts/phases/*.md— phase-specific prompts (loaded at runtime)prompts/hunt/*.md— domain hunt prompts (loaded at runtime)- Embedded prompts exist in
src/llm_analysis.rsviainclude_str!— both mechanisms are valid.
New phases require:
- A
ScanPhasevariant + config flag (src/config/phases.rs) - Dispatch arm (
src/scanner/phases.rsrun_phase) PhaseGraph::new()entry- Checkpoint
resume_fromentry (src/scanner/checkpoint.rs)
- Unit tests: Place in
tests/unit/subdirectories matching the module structure. - Integration tests: Place in
tests/integration/for multi-phase or end-to-end scenarios. - Shared fixtures: Use fixtures from
tests/unit/fixtures.rsto avoid duplication. - Mock LLM calls: Never hit real APIs in tests—use
mockitofor HTTP mocking.
When filing a bug report, include:
- Rust version:
rustc --version - OS: Platform and version
- BACO version: From
Cargo.tomlorbaco --version - Minimal repro: Steps or code snippet to reproduce the issue
- Expected vs actual behavior: Clear description of the discrepancy
BACO is licensed under GPL v3. By contributing, you agree that your contributions will be licensed under the same terms. See LICENSE for details.