Skip to content

Architecture

The crates that make up Arca and the unsafe policy that holds them together.

Last updated

Arca is a Cargo workspace. Each crate has one job and a declared stance on unsafe code.

Crates

CrateWhat it doesunsafe
arca-coreErrors, limits, bounded header reads, MS-DOS dates, Zip Slip defenceforbidden
arca-zipZIP with Zip64; store, Deflate over zlib-rs, Zstandard, AES-256forbidden
arca-tarustar TAR with checksum verificationforbidden
arca-streamXZ (through arca-xz), bzip2 and Zstandard streams, alone or around a TAR, told apart by their contentsforbidden
arca-7zBounded 7z parsing, solid extraction, creation (LZMA2, LZMA, PPMd, BZip2, Deflate, Store) with branch/Delta filters, and AESforbidden
arca-rarRAR/CBR reading and RAR5 creation (solid, encrypted, volumes, recovery record), enabled by default in CLI/GUIforbidden
arca-extraRead-only CPIO, AR, DEB, RPM, CAB (MSZIP, LZX) and LZHforbidden
arca-diskRead-only VHD, VHDX, VMDK, DMG and raw disk images: MBR and GPT partitions, FAT, exFAT, NTFS and HFS+ (ISO 9660 through arca-iso)forbidden
arca-cliThe arca binaryallowed, unused
arca-guiThe arca-gui windowforbidden
arca-iconsThe icon the desktop shows for a file typeWindows only, for the shell call
windows/arca-shellExplorer context menu, outside the workspace so cargo build still works on Linux and macOSrequired: COM

The workspace also contains arca-drag and arca-net; see their sources for details.

CLI and desktop share arca_core::Format. WRITABLE (formats whose existing archives can be rewritten) includes 7z but excludes RAR; CREATABLE adds RAR, which can be created from scratch but never modified, and never CBR or ISO. RAR is enabled by default in CLI and GUI; the resolved rars dependency enables encryption and write, never recovery or parallel. arca_rar::create_rar takes explicit sources (clients walk directories under their own bounds), stages beside the output, verifies with the reader and publishes without ever replacing a file. The desktop uses one background password-validation flow for ZIP, 7z and RAR, with retries, cancel and resumption of the original action. CRC metadata is optional: an absent checksum is not displayed as a fabricated zero.

The unsafe policy

Arca's archive parser crates declare #![forbid(unsafe_code)]; this is not a blanket guarantee about all transitive dependencies. Native Bzip2/Zstandard are optional codecs, while desktop and OS libraries have their own unsafe boundaries. The vendored 7z parser and its pinned LZMA decoder compile with unsafe forbidden.

Rust
#![forbid(unsafe_code)]// A malformed archive produces an error, never memory corruption.match ZipArchive::open(file) {    Ok(archive) => list(archive),    Err(e) => eprintln!("arca: {e}"),}

Key dependencies

CrateUsed for
flate2 + zlib-rsDeflate, using the fastest Rust implementation measured during design
zstdZstandard bindings to libzstd, with its internal multithreading enabled
bzip2 0.6 / libbz2-rs-sysbzip2 in ZIP entries and .bz2 streams; a pure-Rust port of libbzip2 (it uses unsafe internally), so no C compiler and no codecs-native
crc32fastCRC-32 checks
sevenz-rust2 0.23.0 / lzma-rust2 0.21.0Apache-2.0 7z/AES and LZMA; vendored parser hardening, LZMA unsafe optimization disabled
rayonThe thread pool behind parallel compression and extraction
clapCommand-line parsing
eframe / eguiThe immediate-mode UI framework behind the window, drawn with OpenGL through Glow

7z boundaries

  • Encoded/decoded headers: 16 MiB each; entries, blocks and streams: 100,000.
  • At most four single-input/output coders per block; multi-input BCJ2 is unsupported.
  • LZMA dictionaries and PPMd models: 256 MiB per stage; Zstd window: 256 MiB. These are not a global memory quota. There is no total extracted-byte or CPU-time quota.
  • Baseline decoding: Copy, LZMA, LZMA2, PPMd, DEFLATE, AES, single-stream BCJ/Delta. Default codecs-native adds Bzip2 and Zstd. Brotli and LZ4 are unsupported.
  • Encrypted extraction validates the entire stable source before destination callbacks, then streams selected blocks. CRC-32 is not authentication.
  • Progress/cancellation is cooperative; bounded header parsing and KDF setup cannot be interrupted internally. Preview rejects sizes beyond the caller cap.
  • Entry.offset is an index for 7z, not a file offset. Method::code() now returns Result<u16> and rejects non-ZIP methods instead of inventing ZIP codes.

CLI/GUI explicitly forward codecs-native; their archive dependencies disable default features. cargo build --release --no-default-features omits native compression, not OS/graphics libraries. Audit the graph with:

Terminal
cargo tree -p arca-cli --no-default-features -e normalcargo tree -p arca-gui --no-default-features -e normalcargo tree -p arca-7z -e features -i lzma-rust2

The first two must omit native zstd-sys and bzip2-sys. LZMA features must be std/encoder, never optimization. Rust 1.95 and edition 2021 remain the workspace baseline; dependency editions are per crate. See the accepted design and patch inventory.

Build profiles

TOML
[profile.dev.package."*"]opt-level = 3[profile.dev]opt-level = 1[profile.release]opt-level = 3lto = "fat"codegen-units = 1panic = "abort"strip = true

Dependencies are optimised even in debug builds: egui lays out, shapes and tessellates the whole window every frame it paints, and at opt-level = 0 that shows up as stutter while dragging. Arca’s own code builds at level 1, which keeps the debugger useful.