File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,16 +27,22 @@ Findings are written as JSONL to a temp file, which the main `cargo-capsec` CLI
2727
2828## Architecture
2929
30- ```
31- cargo capsec audit --deep
32- └→ cargo check (with RUSTC_WRAPPER=capsec-driver)
33- └→ capsec-driver replaces rustc for each crate
34- └→ after_analysis callback:
35- 1. Walk MIR BasicBlocks → TerminatorKind::Call
36- 2. Extract callee DefId → tcx.def_path_str()
37- 3. Classify against authority patterns
38- 4. Check tcx.is_foreign_item() for FFI
39- 5. Write JSONL to $CAPSEC_DEEP_OUTPUT
30+ ``` mermaid
31+ flowchart TD
32+ A["cargo capsec audit --deep"] --> B["cargo check\n(RUSTC_WRAPPER=capsec-driver)"]
33+ B --> C["capsec-driver replaces rustc\nfor each crate"]
34+ C --> D["after_analysis callback"]
35+ D --> E["Walk MIR BasicBlocks\nTerminatorKind::Call"]
36+ E --> F["Extract callee DefId\ntcx.def_path_str()"]
37+ F --> G{Classify call}
38+ G -->|"std::fs, std::net,\nstd::env, std::process"| H["Authority finding\n(FS/NET/ENV/PROC)"]
39+ G -->|"tcx.is_foreign_item()"| I["FFI finding"]
40+ G -->|"No match"| J["Skip"]
41+ H --> K["Write JSONL to\n$CAPSEC_DEEP_OUTPUT"]
42+ I --> K
43+ K --> L["cargo-capsec reads JSONL\nbuilds export maps"]
44+ L --> M["Phase 2: workspace scan\nwith MIR export maps injected"]
45+ M --> N["Unified cross-crate\ntransitive findings"]
4046```
4147
4248## Standalone testing
You can’t perform that action at this time.
0 commit comments