Skip to main content

SourceOpen

Trait SourceOpen 

Source
pub trait SourceOpen {
    // Required methods
    fn open_with_credentials(
        &self,
        source: DynSource,
        spec: Locator,
        depth: usize,
        creds: &dyn CredentialSource,
    ) -> VfsResult<Option<Resolved>>;
    fn resolve_to_source(
        &self,
        source: DynSource,
        spec: Locator,
        depth: usize,
    ) -> VfsResult<Option<ResolvedSource>>;

    // Provided method
    fn open(
        &self,
        source: DynSource,
        spec: Locator,
        depth: usize,
    ) -> VfsResult<Option<Resolved>> { ... }
}
Expand description

The generic layer resolver, exposed as an extension trait on the leaf’s Openers. Bring it into scope (use forensic_vfs_resolver::SourceOpen;) to call openers.open(source, spec, 0).

Required Methods§

Source

fn open_with_credentials( &self, source: DynSource, spec: Locator, depth: usize, creds: &dyn CredentialSource, ) -> VfsResult<Option<Resolved>>

Recursively resolve a source to a filesystem: sniff its head (and a tail window for trailer magics); if a filesystem prober recognizes it, mount it; otherwise if a volume-system prober recognizes it, descend into each volume and resolve that; otherwise attempt a signature-detected encryption layer, then containers, then archives; finally, as a last resort, attempt each signature-less credential-attempt encryption scheme so a wrong VeraCrypt guess can never shadow a real filesystem (ADR 0010). Ok(None) when nothing recognizes it — a genuinely clean unknown, not an error.

Encryption failure semantics follow the probe verdict (ADR 0010): a Yes (BitLocker/LUKS/FileVault) whose decrypt fails propagates loud — the source is identified encryption and a wrong/absent key is a nameable condition — while a Maybe (VeraCrypt) whose decrypt fails falls through, because a failed decrypt of a signature-less scheme is indistinguishable from random data and must not break the empty-source contract.

creds supplies keys/passphrases to any encryption layer reached. depth is the current nesting level; callers start at 0. The recursion is depth-capped against a self-referential container/volume bomb.

§Errors

Propagates a source read error, or a prober open/decode failure raised after a positive (Yes) probe verdict.

Source

fn resolve_to_source( &self, source: DynSource, spec: Locator, depth: usize, ) -> VfsResult<Option<ResolvedSource>>

Resolve a source to its innermost raw byte edge by peeling only the medium-agnostic packaging layers — archive/compression (ADR 0008) plus a bare container decode — and returning that ResolvedSource instead of requiring a filesystem mount (ADR 0011).

This is the terminal a memory- or log-dump reader wants: memf receives the raw physical-page stream unwrapped from memory.raw.gz / memory.zip / dump.7z without re-implementing archive detection, then runs its own format detection over the bytes. It is orthogonal to the downstream medium — the same peel the disk SourceOpen::open path uses, stopping one step earlier.

Where it stops: after archive and bare-container peeling only. It does not run the filesystem, volume-system, or encryption descent — those are disk interpretation, not packaging unwrap, and a memory dump is a single flat stream, not a partitioned/encrypted disk. A source that no packaging prober claims is its own terminal and is returned as-is (a bare memory.raw / .dd). Container decode is included because a container is a packaging wrapper over a flat stream; volume/encryption/filesystem are not.

For a multi-member archive each member is tried in order and the first that peels to a terminal wins (the single-dump case); a caller wanting every member enumerates at the front-end.

depth is the current nesting level; callers start at 0. Past the packaging depth cap it yields Ok(None) (a self-referential-container bomb guard), symmetric with SourceOpen::open.

§Errors

Propagates a source read error, or a container/archive open/decode failure raised after a positive probe verdict.

Provided Methods§

Source

fn open( &self, source: DynSource, spec: Locator, depth: usize, ) -> VfsResult<Option<Resolved>>

Recursively resolve a source to a filesystem, supplying no credentials. A convenience wrapper over SourceOpen::open_with_credentials with the leaf’s NoCredentials context: a signature-detected encryption layer then surfaces NeedCredentials loudly and a credential-attempt scheme falls through, so an encrypted volume is never silently skipped nor guessed.

§Errors

Propagates a source read error, or a prober open/decode failure raised after a positive probe verdict.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SourceOpen for Openers

Source§

fn open_with_credentials( &self, source: DynSource, spec: Locator, depth: usize, creds: &dyn CredentialSource, ) -> VfsResult<Option<Resolved>>

Source§

fn resolve_to_source( &self, source: DynSource, spec: Locator, depth: usize, ) -> VfsResult<Option<ResolvedSource>>

Implementors§