Commit graph

24 commits

Author SHA1 Message Date
trvon
b33d3357b5
fix(rust): refine path join traversal provenance
Some checks failed
build / build-linux (push) Failing after 7m51s
build / build-macos (push) Has been cancelled
build / release (push) Has been cancelled
2026-09-02 05:58:14 -06:00
trvon
bcdcb3036b
feat(analysis): harden quality and solver pipelines 2026-07-29 20:46:51 -04:00
trvon
f37222d4fb
fix(scan): harden frontend analysis 2026-07-28 11:57:38 -04:00
trvon
75e3e09cbf
fix(rust): dedupe cargo wrapper output 2026-07-28 00:38:56 -04:00
trvon
f0ece0794a
feat(eval): add manifest project runner 2026-07-27 23:18:03 -04:00
trvon
f749f44d92
feat(rust): improve security provenance 2026-07-20 14:52:42 -04:00
trvon
d2755e4d79
build: update nightly toolchain pin to 2026-05-28 (rustc 1.98.0)
- fold-rust builds with nightly rustc_private feature
- cargo-check now requires RUSTUP_TOOLCHAIN=nightly for target crates
- Ripgrep scan: 49 findings (42 path-traversal, 7 command-injection)
  with --suppress-local-paths taint filtering enabled
2026-05-29 09:48:22 -04:00
trvon
5d8b288719
feat: Rust interprocedural symbolic summary caching (Phase 2, Rust-CLang parity)
- symbolic_summary.rs: MIR-based summary computation per function
- Produces SymbolicSummaryData with SMT-LIB BV-64 expressions
- Matches C++ fold::symbolic::SymbolicSummary wire format
- Cross-function Z3 proofs now possible
2026-05-28 20:41:29 -04:00
trvon
192387b406
feat: wire MIR control flow into Rust Z3 encoder (Phase 2, Rust-CLang parity)
- MIR-to-IR tree converter: 12 functions walk MIR basic blocks
- Each block becomes Call(mir_block) with statements + terminator
- SwitchInt terminators → path predicate forking per case
- Return/Rvalue encoding threaded through RustExprNode JSON
- Brings Rust CFG precision to parity with Clang security walker
2026-05-28 20:40:12 -04:00
trvon
10b9b81ef9
feat: known-safe path prefix recognition for Rust detectors
- KnownSafePaths set: codex_home, config_path, cargo_bin, cache dirs
- classify_origin returns LiteralValue for calls to known-safe functions
- Eliminates ~200 path-traversal FPs from config/cache file reading
2026-05-28 20:09:36 -04:00
trvon
74b10224b1
fix: filter ts_rs codegen from path-traversal (eliminates 45% FPs)
- Skip path-traversal in ts_rs/__inline functions (compile-time codegen)
- TS::inline serializes types to .ts files — not runtime path handling
- Expected: ~500/1102 findings eliminated
2026-05-28 12:48:22 -04:00
trvon
ee49900f01
fix: filter augment_args from command-injection (eliminates 69% FPs)
- Add current_fn_name tracking in DerefHunter HIR visitor
- Skip command-injection when inside augment_args* functions
- clap derive macros are CLI registration, not command execution
- Expected: 150/217 findings eliminated
2026-05-28 12:47:19 -04:00
trvon
b79f964a59
feat: intra-procedural taint origin tracking for Rust detectors
- TaintOrigin enum: LiteralValue, EnvironmentSource, FileSource, UnknownProvenance
- classify_origin(): walks HIR to classify expression provenance
- Path-traversal: skip when path arg is LiteralValue (string literal, const)
- Command-injection: skip when .arg()/.args() arg is LiteralValue
- Expected: 80%+ FP reduction — most code uses fixed paths and commands
2026-05-28 12:20:07 -04:00
trvon
f45bce34ac
fix: objc_msgSend — lang filter + _OBJC_CLASS_ verification + Swift IR kinds + vtable fuzzing
- discoverObjcClasses: filter icj to lang='objc', verify _OBJC_CLASS_ symbol exists
- Add 4 Swift IR node kinds: OptionalBind, ProtocolWitness, ExistentialContainer, SwitchEnum
- Vtable fuzzing: parse _ZTV symbols, emit vtable-dispatch harnesses
- Clone scoring: --clone-min-score gate with hash-distance metric
- BorrowTracker wired into Rust null-deref findings
2026-05-28 10:36:25 -04:00
trvon
6f07fa25cc
fix: filter Swift symbols from binary fuzz + bump budget to 120-600s
- Swift-mangled symbols (//_T0) skipped: need valid objects, not raw uint64_t
- Cov:2 dead end explained: garbage args cause Swift runtime abort before real code
- Fuzz budget floor raised 30→120s, ceiling 120→600s (match AFL++/libFuzzer norms)
- Base per-CPU allocation doubled 45→90s
2026-05-28 09:08:32 -04:00
trvon
e61821e5b7
feat: return-checking harnesses + Rust unsafe-audit command
- --check-returns flag adds ASan sentinel for pointer-returning functions
- unsafe-audit subcommand: detects SAFETY comment gaps in unsafe blocks
- fold-rust: null-deref adt-safety filter for Option/Result/Vec paths
2026-05-27 23:12:43 -04:00
trvon
ee3392931c
feat: param type inference + internal fuzz targets for binary harnesses
- --binary-param-types: uint64 (default) or infer (map r2 types)
- mapR2Type: converts afij type strings → C types with sized memcpy
- discoverInternalFuzzTargets: ObjC methods + Swift witnesses + vtable
- --fuzz-internal flag gates internal function fuzzing
2026-05-27 22:59:13 -04:00
trvon
b9381a6ab3
feat: adaptive fuzz budget + corpus seeding for binary harnesses
- HW detect: sysconf CPU/memory → compute per-harness budget (30-120s)
- --per-harness-timeout-seconds flag for override
- 3-5 seed files per harness: zeros, sentinels, ASCII patterns
- --corpus-seeds N flag to control seed count
2026-05-27 21:04:00 -04:00
trvon
a36801cf8e
perf: Z3 LRU cache, batch observers, fold-rust body cache, ripgrep benchmark
- Z3 query LRU cache (4096 entries, O(1) promote/evict)
- Batch observer dispatch in security walker
- fold-rust: single-walk hash, dead code removed, timing added
- bench/corpora/rust-oss/: ripgrep benchmark harness
2026-05-27 19:06:32 -04:00
trvon
9bdd989b7e
fix: binary harness_file, -I path resolution, caller-context schema
- Store harness_file in binary fuzz predictions to fix prep↔run mismatch
- Resolve relative -I flags against compile DB directory
- Add caller_unsafe/is_param_sourced fields to fold-rust NDJSON
- Allow empty target_sources in fuzz-run for dlopen harnesses
- Recursive IR encoder descent for nested hazards
2026-05-27 17:34:52 -04:00
trvon
ffc7917957
feat: symbolic IR, swift backend, binary-to-fuzz pipeline, SARIF fixes
- Rust IR encoder (encodeRustIr): walks HIR expr trees, fires SafetyObserver hooks
- Swift SIL frontend (fold-swift): swiftc -emit-sil parser, demangling, NDJSON output
- SwiftBackend: --mode swift CLI routing, shells out to fold-swift
- Binary-to-fuzz: Mach-O export discovery, ARM64 ABI param-count inference, dlopen harness generation
- Language-agnostic IR: json_keys canonical constants, Call/Member/ArraySubscript/Cast/HeapNew nodes
- Dogfood fixes: SARIF kind field, cross-detector dedup, harness_file in predictions, Swift stoi safety
- Corpuses: swift-sil-z3-corpus.md, binary-fuzz-corpus.md
- AGENTS.md: cross-language wire format rule
2026-05-27 15:29:14 -04:00
trvon
95aac8209c
feat: expand rust security scanner coverage 2026-05-27 11:32:05 -04:00
trvon
ce1c353847
feat: harden security scanner routing 2026-05-27 10:36:57 -04:00
trvon
da4c848cbc
feat(rust): MVP Rust frontend — unsafe-deref detection + clone clustering
First non-clang frontend for fold. Scans Rust source for the
subset of issues that meaningfully exist there: raw-pointer
dereferences in `unsafe` blocks (Heuristic confidence) and
within-Rust Type-1/2/3 clones via the existing clone detector.
Reuses the M30 frontend-agnostic IR + AnalysisBackend
abstraction unchanged.

Architecture: a separate `tools/fold-rust` cargo binary that the
C++ `RustBackend` shells out to. Two subprocess invocation
modes:

- `extract --unit <file>`: standalone .rs file, no Cargo
  context (limited; external-crate imports won't resolve).
- `cargo-check --crate-dir <dir>`: invokes `cargo check` with
  RUSTC_WORKSPACE_WRAPPER set to ourselves so cargo supplies
  the full --extern/-L/--cfg per-TU. Mirrors the
  clippy/miri/kani pattern.

RustBackend::discoverUnits walks up from each `.rs` input to
find the nearest Cargo.toml and collapses sibling files to one
crate unit; orphan files fall back to single-file extract.
scan_router auto-detects --mode=rust when all paths are `.rs`;
mixed Rust + C/C++ warns and defaults to source mode.

Includes:

- tools/fold-rust/: cargo crate pinned to nightly-2026-05-22.
  HIR-driven DerefHunter (raw-pointer dereference detection
  via typeck `is_raw_ptr()`) and HashWalker (FNV-1a + mix64
  port of src/ir/normalize.cpp for FunctionSummary hashes).
- include/fold/ir/expr_json.{hpp,cpp}: RustExprNode +
  RustNodeArena + bidirectional JSON wire format for
  ir::Expr; round-trip tested across 8 Kinds.
- include/fold/frontend/rust_backend.{hpp,cpp}: AnalysisBackend
  impl. posix_spawnp + NDJSON parser. Caches summaries +
  findings across extractFunctions calls; polymorphic
  runDetectorsOnShard dispatch routes summaries to
  detectClones.
- src/cli/{main,scan_router,scan_runner}.cpp: --mode=rust
  branch + autoDetectRust(). Mode validation extended to
  accept rust.
- docs/rust-frontend.md: scope, wire format, rustc-private
  pin + bump procedure, verification snippets.

44/44 unit + integration tests still green. Verified
end-to-end on a 3-function rename-pair fixture: 1 clone
cluster + 1 raw-deref finding through both `extract` and
`cargo-check` paths.

Out of scope (tracked separately): equiv + class-dup
detectors (need encoder frontend-agnostification),
dead-statement (needs Rust CFG), cross-language clones
(needs unified kind-tag taxonomy), Proved/ConcreteWitness
promotion (needs encoder integration), `cargo fuzz`
harnesses.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 22:36:28 -04:00