Documentation
¶
Overview ¶
Package archive handles unpacking .deb files (a Unix "ar" archive containing debian-binary, control.tar.*, and data.tar.*) and safely extracting the compressed tarballs inside, guarding against path traversal, symlink escapes, and decompression bombs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decompress ¶
Decompress wraps r with the decompressor matching the data.tar.* suffix found on member.Name (.gz, .xz, .zst), or returns r unchanged for a plain .tar member.
func SafeExtractTar ¶
SafeExtractTar reads a tar stream and writes selected entries under destDir, rejecting anything that would escape destDir (path traversal, absolute paths, symlink/hardlink targets outside destDir) and enforcing a total-size cap.
Types ¶
type ArEntry ¶
ArEntry is one member of a Unix ar archive.
func FindMember ¶
FindMember returns the first member whose name starts with any of the given prefixes (used to locate "data.tar" regardless of its compression suffix: .gz, .xz, .zst).
type FilterFunc ¶
FilterFunc decides whether a tar entry should be extracted and, if so, the destination path (relative to destDir) to write it to.