Skip to content

Commit 5672970

Browse files
committed
feat(release): working on next release
1 parent d166f93 commit 5672970

39 files changed

Lines changed: 1218 additions & 2000 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ findings.json
99
checkpoint.json
1010
file_hashes.json
1111
.cortexkit
12+
todo.md

CHANGELOG.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- VulnInstruct specification-guided vulnerability detection (`src/vuln_spec` module: schema, extractor, BM25+vector retriever) behind `[vuln_spec] enabled = false` default
12+
13+
### Changed
14+
- Threat-modeling phase disabled by default (`enable_threat_modeling = false`) — it generated a static STRIDE template rather than code-derived analysis
15+
1016
## [1.1.0] - 2026-08-12
1117

1218
### Added
1319
- 24-phase scanner pipeline with Validate phase
1420
- P1-P5 paper integration tracks (VulTriage, VulnLLM-R, MoCQ, PacVD, AgentFlow) behind `enabled = false` defaults
1521
- `max_reasoning_tokens` field for LLM config
1622
- Agent scaffold modules: `call_graph_paths`, `fn_lookup`
17-
- 63 unit tests for agent_scaffold edge cases
18-
- Example report screenshot in README
19-
- `docs/README.md` index and `docs/roadmap.md`
23+
- `docs/README.md` documentation index
2024

2125
### Changed
22-
- Split large source files (>1000 lines) into directory modules: `other_phases/`, `llm_phases/`, `config/`
23-
- Extracted shared tree-sitter parser module
24-
- Moved inline tests from source files to `tests/`
26+
- Internal refactoring: split oversized modules into directory modules, extracted shared tree-sitter parser, consolidated tests under `tests/`
2527
- MSRV-compatible clippy fixes (replaced `is_none_or`, `is_multiple_of`)
2628

2729
### Fixed
2830
- C function-name extraction handles `function_declarator` tree-sitter node
2931
- Call-graph builder treats uncalled functions as entry points
3032
- Phase count references updated from 20 to 24 throughout
31-
32-
### Removed
33-
- Duplicate inline test blocks from `ai_aggregation.rs`, `multi_verifier.rs`, `root_cause_dedup.rs`
34-
- Orphaned `scanner_phases_consolidated.rs` artifact

docs/architecture.md

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,36 @@ BACO uses a **data-driven PhaseGraph** (`src/scanner/pipeline/orchestrator.rs`)
1111

1212
## Pipeline Phases
1313

14-
**Core Pipeline (20 phases):**
15-
16-
### Parallel Detection (3 phases)
17-
1. **Indexing**: Build file list and call graph
18-
2. **Semgrep**: Static analysis with predefined rules
19-
3. **LLM Static Analysis**: Independent LLM-based code analysis
20-
21-
### Sequential Discovery (3 phases)
22-
4. **CWE Routing**: Mixture-of-experts routing to appropriate analyzers
23-
5. **LLM Discovery**: Multi-model vulnerability detection with CVE enrichment
24-
6. **LLM Verification**: Validation with PoC generation and mitigation code
25-
26-
### Triage (5 phases)
27-
7. **SecurityAgent Verification**: Tool-based agent verification using file_read, pattern_search, file_write, run_test
28-
8. **Ticket Cross-Ref**: Search GitHub/GitLab for existing reports
29-
9. **Git Analysis**: Check commit history for related fixes
30-
10. **Cross-File Analysis**: Trace data flow between files
31-
11. **Confidence Scoring**: Calculate composite reliability score
32-
33-
### Aggregation (2 phases)
34-
12. **AI Aggregation**: Generate executive summary, semantic deduplication, and LLM-enriched descriptions
35-
13. **Threat Modeling**: Generate THREAT_MODEL.md with attack surface analysis
36-
37-
### Post-Processing (6 phases)
38-
14. **Root Cause Dedup**: Deduplicate findings by root cause instead of location
39-
15. **Multi-Verifier**: Multiple verification methods with majority voting
40-
16. **Auto-Patching**: Generate and validate patches with staging
41-
17. **CVE Bootstrap**: Enrich findings with NVD/CISA KEV data
42-
18. **PoC Compiler**: Verify PoC code compiles successfully
43-
19. **Variant Search**: Search for related vulnerability variants
44-
45-
### Output (1 phase)
46-
20. **Reporting**: Generate JSON, HTML, and SARIF outputs
14+
**Core Pipeline (24 phases):**
15+
16+
Phase order is defined once in `PhaseGraph::new()` (src/scanner/pipeline/orchestrator.rs); this table mirrors it and must be updated when that changes.
17+
18+
| Phase # | Name | Parallel/Sequential | Config gate (default) |
19+
|---------|------|---------------------|----------------------|
20+
| 1 | Indexing | Parallel | Always-on |
21+
| 2 | Semgrep | Parallel | Always-on |
22+
| 3 | CPG Slice | Parallel | `cpg.enabled=false` |
23+
| 4 | LLM Static Analysis | Parallel | `llm.phases.indexing` (API key present) |
24+
| 5 | CWE Routing | Sequential | Always-on |
25+
| 6 | Rule Synthesis | Sequential | `rulesynth.enabled=false` |
26+
| 7 | LLM Discovery | Sequential | `llm.phases.discovery` (API key present) |
27+
| 8 | LLM Verification | Sequential | `llm.phases.verification` (API key present) |
28+
| 9 | Validate | Sequential | `validate.enabled=false` |
29+
| 10 | SecurityAgent Verification | Sequential | `agent.enabled=false` |
30+
| 11 | Ticket Cross-Reference | Sequential | `llm.phases.ticket_crossref` (API key present) |
31+
| 12 | Git Analysis | Sequential | `llm.phases.git_analysis` (API key present) |
32+
| 13 | Cross-File Analysis | Sequential | `llm.phases.cross_file_analysis` (API key present) |
33+
| 14 | Confidence Scoring | Sequential | `normalization.enabled=false` |
34+
| 15 | AI Aggregation | Sequential | `llm.phases.aggregation` (API key present) |
35+
| 16 | Threat Modeling | Sequential | `aggregation.tier_2_features.enabled=false` |
36+
| 17 | Root Cause Deduplication | Sequential | `aggregation.root_cause_dedup=true` |
37+
| 18 | Multi-Verifier | Sequential | `aggregation.multi_verifier=true` |
38+
| 19 | Auto-Patching | Sequential | `aggregation.auto_patching=false` |
39+
| 20 | CVE Bootstrap | Sequential | `aggregation.cve_bootstrap=true` |
40+
| 21 | PoC Compilation | Sequential | `aggregation.poc_compilation=false` |
41+
| 22 | Exploit Synthesis | Sequential | `exploit.enabled=false` |
42+
| 23 | Variant Search | Sequential | `aggregation.variant_search=true` |
43+
| 24 | Reporting | Sequential | Always-on |
4744

4845
## Data Flow
4946

@@ -96,4 +93,3 @@ flowchart LR
9693

9794
**Checkpoint markers**: Checkpoints are saved after each major phase, enabling resume from any point in the pipeline.
9895

99-
**Orphaned phases**: The following modules exist but are NOT wired into the pipeline and do NOT run: CpgSlice, Hunt, Validate, IndependentVerify, ExploitSynth, RuleSynthesis.

docs/configuration.md

Lines changed: 130 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Configuration
22

3+
## Quick Start
4+
5+
Minimal working configuration — copy-paste this block and fill in your API key:
6+
7+
```toml
8+
[project]
9+
name = "my-project"
10+
path = "/path/to/target"
11+
languages = ["c"]
12+
13+
[llm.phases.discovery]
14+
base_url = "https://api.mistral.ai/v1"
15+
api_key = "${MISTRAL_API_KEY}"
16+
model = "mistral-small"
17+
18+
[scanner.performance]
19+
enable_incremental_scan = false
20+
max_parallel_tasks = 4
21+
enable_llm_cache = false
22+
enable_file_filtering = true
23+
```
24+
25+
**Experimental sections** (disabled by default):
26+
- `[cpg]` — CPG-guided slicing (requires Joern binary)
27+
- `[validate]` — LLM-as-judge rationale validation
28+
- `[vuln_spec]` — VulTriage triple-path, policy sampling, agent scaffold
29+
- `[agent_scaffold]` — Agent-assisted analysis
30+
- `[agent_flow]` — Multi-agent harness synthesis
31+
- `[threat_modeling]` — STRIDE threat modeling (now under `[scanner.performance]`)
32+
33+
Enable only after reviewing the detailed sections below.
34+
335
## Project Settings
436

537
```toml
@@ -28,7 +60,7 @@ enable_file_filtering = true
2860
# Each flag controls whether a specific analysis phase runs during the scan.
2961

3062
# Threat modeling using STRIDE analysis (adds LLM-based threat identification)
31-
enable_threat_modeling = true
63+
enable_threat_modeling = false
3264
# Root-cause deduplication (collapses findings that share the same root cause)
3365
enable_root_cause_dedup = true
3466
# Multi-verifier cross-checking (runs additional LLM verification passes)
@@ -49,7 +81,7 @@ enable_variant_search = true
4981

5082
| Flag | Default | Side effects |
5183
| --- | --- | --- |
52-
| `enable_threat_modeling` | `true` | None (read-only analysis) |
84+
| `enable_threat_modeling` | `false` | None (read-only analysis) |
5385
| `enable_root_cause_dedup` | `true` | None |
5486
| `enable_multi_verifier` | `true` | Additional LLM API calls |
5587
| `enable_auto_patching` | `false` | Writes code files, runs git commands in a staging worktree |
@@ -64,14 +96,18 @@ See [`docs/architecture.md`](architecture.md) for the full 20-phase pipeline des
6496

6597
BACO supports single or multiple models per phase. When multiple models are configured, they are used in round-robin fashion to distribute load across different models/providers.
6698

67-
**Detailed error logging**: When LLM requests fail, BACO reports the HTTP status code, error type (timeout, connection, request, body, decode), and the actual URL for easier debugging.
99+
**Default temperature:** `0.5` (controlled randomness for better security analysis)
100+
101+
**Default max_reasoning_tokens:** `2048` (caps reasoning phase before forcing final answer)
68102

69103
**Single model:**
70104
```toml
71105
[llm.phases.discovery]
72106
base_url = "https://api.mistral.ai/v1"
73107
api_key = "${MISTRAL_API_KEY}" # or set env var
74108
model = "mistral-small"
109+
temperature = 0.5
110+
max_reasoning_tokens = 2048
75111
```
76112

77113
**Multiple models:**
@@ -104,9 +140,10 @@ When enabled, the LLM Discovery phase reads source files directly before analyzi
104140

105141
```toml
106142
[agent]
107-
enabled = true
143+
enabled = false
108144
max_turns = 10 # Max conversation turns with tools
109145
tool_timeout_secs = 60 # Timeout for tool execution
146+
trusted_paths = ["."] # Paths allowed for tool operations
110147
keep_artifacts = false # Keep generated test files
111148
```
112149

@@ -158,22 +195,41 @@ Code:
158195
llm_discovery = """Given this finding, determine if it's a true vulnerability:
159196
Title: %%FINDING_TITLE%%
160197
Location: %%FILE_PATH%%:%%LINE_NUMBER%%
198+
Current Description: %%CURRENT_DESCRIPTION%%
161199
Description: %%VULNERABILITY_DESCRIPTION%%
162200
"""
163201
```
164202

165203
**Available template variables:**
166204
- `%%PROJECT_PATH%%` - Target project path
205+
- `%%PROJECT_NAME%%` - Project name
167206
- `%%FILE_EXTENSIONS%%` - Detected file extensions
168207
- `%%LANGUAGES%%` - Target languages
169208
- `%%CODE_CONTENT%%` - Code snippet being analyzed
170209
- `%%LANGUAGE%%` - Programming language of the file
171210
- `%%FILE_PATH%%` - File path
172-
- `%%LINE_RANGE%%` - Line numbers
211+
- `%%LINE_NUMBER%%` - Specific line number
212+
- `%%LINE_RANGE%%` - Line numbers range
213+
- `%%CURRENT_DESCRIPTION%%` - Current vulnerability description (for iterative phases)
173214
- `%%FINDING_TITLE%%` - Vulnerability title
174215
- `%%VULNERABILITY_DESCRIPTION%%` - Description text
175216
- `%%FINDINGS_COUNT%%` - Total findings count
176217
- `%%SCAN_DATE%%` - Scan date
218+
- `%%TOTAL_FINDINGS%%` - Total findings count (alias)
219+
- `%%TOTAL_FILES%%` - Total files scanned
220+
- `%%FILES_COUNT%%` - Files count (alias)
221+
- `%%SOURCE_LIST%%` - List of source files
222+
- `%%CONTEXT_LINES%%` - Context lines around finding
223+
- `%%CWE_SPECS%%` - CWE specification details
224+
- `%%EXCLUDE_PATHS%%` - Excluded paths
225+
- `%%MAX_FILE_SIZE%%` - Maximum file size limit
226+
- `%%PROJECT_TYPE%%` - Project type
227+
- `%%SCAN_DURATION%%` - Scan duration
228+
- `%%TICKET_SYSTEMS%%` - Configured ticket systems
229+
- `%%TOOLS_USED%%` - Tools used in analysis
230+
- `%%VULNERABILITY_LIST%%` - List of vulnerabilities
231+
- `%%VULNERABILITY_TITLE%%` - Vulnerability title
232+
- `%%FINDINGS_LIST%%` - Full findings list
177233

178234
Prompts are validated (max 10,000 characters, no null bytes) before use.
179235

@@ -188,16 +244,26 @@ credentials.token = "${GITHUB_TOKEN}"
188244

189245
## Output Formats
190246

191-
- **findings.json**: Complete vulnerability data with all 16 fields
192-
- **report.html**: Visual report with severity colors, code snippets, AI summary
193247
- **findings.json**: Complete vulnerability data with all 16 fields
194248
- **report.html**: Visual report with severity colors, code snippets, AI summary
195249
- **report.sarif**: SARIF format for CI/CD integration
196250

197251
## Paper-Integration Research Flags
198252

199-
The following flags enable experimental research-backed analysis augmentations.
200-
All default to disabled. See `todo.md` for full implementation details.
253+
> **Experimental — disabled by default.** These sections enable research-backed analysis augmentations. Enable only after understanding the tradeoffs.
254+
255+
### Validate (CORRECT paper arxiv:2504.13474)
256+
257+
LLM-as-judge rationale validation: evaluates the soundness of reasoning behind each finding and adjusts confidence accordingly (+0.10 sound, -0.20 flawed).
258+
259+
| Field | Type | Default | Description |
260+
|----------|------|---------|--------------------------------|
261+
| `enabled`| bool | false | Enable Validate phase |
262+
263+
```toml
264+
[validate]
265+
enabled = false
266+
```
201267

202268
### VulTriage (P1) — arXiv:2605.09461
203269

@@ -276,15 +342,33 @@ feedback → iterative loop. Extends the `[scanner.rulesynth]` section.
276342
|-----------------|------|---------|--------------------------------|
277343
| `mocq_mode` | bool | false | Enable MoCQ neuro-symbolic mode|
278344
| `max_iterations`| int | 5 | Max synthesis iterations |
279-
| `corpus_path` | str | "tests/fixtures/" | Path to pattern corpus |
345+
| `corpus_path` | str | None | Path to pattern corpus |
280346

281347
```toml
282348
[scanner.rulesynth]
349+
enabled = false
283350
mocq_mode = false
284351
max_iterations = 5
285352
corpus_path = "tests/fixtures/"
286353
```
287354

355+
### CPG-Guided Slicing (T3.1)
356+
357+
CPG (Code Property Graph) slicing using Joern. Requires Joern binary in PATH or specify path.
358+
359+
| Field | Type | Default | Description |
360+
|---------------|------|---------|--------------------------------|
361+
| `enabled` | bool | false | Enable CPG slicing |
362+
| `joern_path` | str | None | Path to Joern binary |
363+
| `slice_budget_lines`| int | 200 | Maximum lines per slice |
364+
365+
```toml
366+
[cpg]
367+
enabled = false
368+
joern_path = null
369+
slice_budget_lines = 200
370+
```
371+
288372
### PacVD Primitive-API Abstraction (P4) — arXiv:2605.07785
289373

290374
Appends callee abstraction at one of four granularity levels to the LLM prompt.
@@ -319,4 +403,40 @@ integration — static harness only until P5.5.
319403
enabled = false
320404
max_iterations = 10
321405
requires_instrumented_target = false
406+
```
407+
408+
### Exploit Synthesis (T3.2)
409+
410+
Automated exploit generation to verify findings. Runs in sandboxed Docker containers.
411+
412+
| Field | Type | Default | Description |
413+
|------------------------------|------|---------|--------------------------------|
414+
| `enabled` | bool | false | Enable exploit synthesis |
415+
| `sandbox_image` | str | "python:3.11-slim" | Docker image for sandbox |
416+
| `timeout_secs` | int | 30 | Timeout for exploit execution |
417+
| `max_exploits_per_finding` | int | 1 | Max attempts per finding |
418+
419+
```toml
420+
[exploit]
421+
enabled = false
422+
sandbox_image = "python:3.11-slim"
423+
timeout_secs = 30
424+
max_exploits_per_finding = 1
425+
```
426+
427+
### Confidence Normalization
428+
429+
Normalizes confidence scores using project baselines or isotonic regression.
430+
431+
| Field | Type | Default | Description |
432+
|------------------------|------|---------|--------------------------------|
433+
| `enabled` | bool | false | Enable normalization |
434+
| `normalization_tier` | str | "None" | Normalization tier (None, ProjectRelative, Isotonic) |
435+
| `project_baseline_path`| str | None | Path to project baseline file |
436+
437+
```toml
438+
[normalization]
439+
enabled = false
440+
normalization_tier = "None"
441+
project_baseline_path = null
322442
```

0 commit comments

Comments
 (0)