Crate tar

A library for reading and writing TAR archives

This library provides utilities necessary to manage TAR archives abstracted over a reader or writer. Great strides are taken to ensure that an archive is never required to be fully resident in memory, and all objects provide largely a streaming interface to read bytes from.

Security

When unpacking archives (Archive::unpack, Entry::unpack_in), a best-effort is made to prevent writing files outside the destination directory: paths containing .. are rejected, and symlink targets within the archive are validated before use.

Concurrent mutation of the destination tree is outside the threat model. If another process modifies the destination (for example, by atomically swapping a symlink) while extraction is in progress, this crate may follow a path outside the intended destination. Preventing such TOCTOU races requires OS primitives (e.g. openat/O_PATH used throughout) that this crate does not use. When extracting untrusted archives in an environment where the destination may be concurrently modified, use the cap-std crate and/or OS-level sandboxing.

Structs

Enums

Constants