Expand description
Archive extraction support for SubX.
Provides transparent extraction of archive files supplied as direct -i
inputs. Archives discovered during directory traversal are NOT extracted.
§Module Structure
Each supported format lives in its own sub-module, while shared security
validation (path-traversal checks, decompression-bomb limits) is
centralised in the common module.
common— Shared validation:validate_entry_path,ExtractionLimits, size/count constants.zip— ZIP extraction (always available, pure Rust).rar— RAR extraction (feature-gatedarchive-rar).sevenz— 7-Zip extraction (always available, pure Rust).targz— Tar-gzip extraction (always available, pure Rust).
§Supported Formats
| Extension(s) | Module | Crate(s) | Feature gate |
|---|---|---|---|
.zip | zip | zip | always-on |
.rar | rar | unrar / unrar_sys | archive-rar |
.7z | sevenz | sevenz-rust | always-on |
.tar.gz / .tgz | targz | tar + flate2 | always-on |
§Security
All extraction operations enforce:
- Path traversal prevention (zip-slip)
- Symlink and hardlink rejection
- Decompression bomb protection (1 GiB size limit, 10,000 entry limit)
Enums§
- Archive
Format - Recognised archive formats.
Functions§
- detect_
format - Detects archive format by file extension (case-insensitive).
- extract_
archive - Extracts an archive to the given destination directory.