Expand description
Core traits and types for scrump.
A capture file is opened by exactly one Format implementation, which
yields scannable Chunks for the detection engine. The engine produces
Hits, which the format then applies as in-place redactions. The final
bytes can be obtained via Format::to_bytes (used by container formats
to repackage their members) or written atomically with write_atomic.
Structs§
- Chunk
- A region inside the source file that the detection engine should scan.
- Dispatcher
- Routes a file (by path or bytes) to the appropriate
Formathandler. - Handler
- A handler entry registered with the
Dispatcher. - Hit
- A confirmed sensitive region to be redacted.
Enums§
- Chunk
Origin - Origin of a chunk inside a capture file. Carrying this with each chunk lets format-specific scrubbers make smarter redaction decisions and lets the CLI explain where a hit was found.
- Replacement
- Strategy for redacting a
Hit. - Scrump
Error - Errors produced by format and engine code.
- Verify
Result - Verification result from an optional live HTTP probe.
Traits§
- Detector
- A detection rule: a regex (+ optional entropy floor) matching candidate secrets in arbitrary bytes.
- Format
- A handler for one specific capture-file format.
Functions§
- apply_
hits_ in_ place - Apply a list of
Hits to a flat byte buffer in place. - shannon_
entropy - Shannon entropy of a byte slice in bits per byte (range 0.0..=8.0).
- write_
atomic - Write
bytestooutatomically (write to a sibling tmp file, fsync, then rename over the destination).
Type Aliases§
- Detect
Fn - Detection function: given the first ~512 bytes and the original path, decide whether this handler claims the file.
- Open
Bytes Fn - Open from an in-memory buffer.
hint_pathlets the implementation preserve filename context (used for atomic-write naming and for extension-based detection of inner members). - Open
Path Fn - Open from a filesystem path.
- Result