Expand description
forensic-carve — the SecurityRonin fleet carving contract and single-pass
sweep engine.
This crate owns the medium-agnostic carving contract — the Carver trait,
Signature, CarveContext, CarvedItem, and the RecoveryMethod
provenance vocabulary — plus (in later increments) the aho-corasick sweep engine
that runs one detection pass over disk-unallocated or memory regions and
dispatches capped windows to the matching carver.
Fleet ADR 0001 (ronin-issen/docs/decisions/) is the governing design. A carver
sees only &[u8] windows and plain values, so the same carver serves disk and
memory sweeps; medium attribution (PID/VA/PFN, volume/run ids) is wrapped by the
driver after the call and never appears on CarvedItem.
Increment 1: the contract types only. The sweep engine lands in a later cycle.
Structs§
- Carve
Context - The plain-values context handed to
Carver::carve. Carries only values — the window’s absolute base offset in the source, and the confidence policy. It never carries aRead/Seek, a VFS handle, or a memory provider: a carver that must chase virtual pointers is a memory walker, not a medium-agnostic carver. - Carve
Options - Engine knobs. Public fields, medium defaults set by the caller’s driver.
- Carved
Item - One recovered item. Medium-neutral: it never carries PID/VA/PFN (memory) or
volume/run ids (disk) — that attribution is wrapped by the driver after the
carve call (ADR 0001 §8,
SweptItem). Constructed viaCarvedItem::records/CarvedItem::artifact_bytes, never a struct literal. - Carver
Registration - A carver registration submitted by a parser crate. Holds a
'staticreference to the carver so it can live in the inventory’s link-time set. - Region
- A contiguous span of the source to sweep, plus an opaque medium-specific
attribution
tag(disk: volume/run id; memory: PID/VA) that rides back out on eachSweptItem— keepingCarvedItemitself medium-neutral (ADR §8/C1). - Signature
- A magic signature a carver recognises: the bytes, plus the offset at which they appear within the artifact, so a mid-artifact magic still anchors the window start correctly.
- Swept
Item - A carved item plus where it came from: the source-relative offset and the
region’s attribution tag. Keeps
CarvedItemmedium-neutral (ADR §8/C1).
Enums§
- Carved
Payload - A carved item’s payload: either a bounded whole artifact (which re-enters the
normal classify→parse pipeline) or already-decoded records (for a loose chunk
with no containing file to re-parse — e.g. an orphaned
ElfChnk). - Confidence
Policy - What the engine does with carved items given their confidence. Defaults live in each medium’s driver, not hard-coded in the engine (ADR 0001 §8/C1).
- Recovery
Method - How (and how broadly) an artifact was recovered — the fleet-wide provenance
vocabulary (ADR 0001 §3). Carving is a recovery method, so this general
concept owns the plain name; the SQLite-record substrate detail lives in
browser-forensic-carveasSqliteRecoveryMethod.
Traits§
- Carver
- A per-format carver. One impl per format, living in that format’s PARSER crate,
seeing only
&[u8]windows — medium-agnostic by construction, so the same carver serves disk-unallocated and memory sweeps. - Region
Source - A positioned-read edge over the source being swept. Disk drivers implement it
over
forensic-vfspositioned reads; memory drivers overread_virt. A short read (fewer bytes than requested) signals a gap or end-of-source — the engine treats the window as truncated, never fabricating bytes.
Functions§
- registered_
carvers - Every carver registered (via
inventory::submit!) into the final binary. - sweep
- Run one detection pass over
regions, dispatching capped windows to the matching carver. Returns the carved items, each wrapped with its source offset and region tag. Panic-free: a build failure or empty pattern set yields no items rather than erroring.