exarch-core
Memory-safe archive extraction library with security validation.
This crate is part of the exarch workspace.
Installation
Add to your Cargo.toml:
[]
= "0.1"
Or with cargo-add:
[!IMPORTANT] Requires Rust 1.89.0 or later.
Usage
use ;
Security Features
exarch-core provides defense-in-depth protection against common archive vulnerabilities:
| Protection | Description | Default |
|---|---|---|
| Path traversal | Blocks ../ and absolute paths |
Enabled |
| Symlink attacks | Prevents symlinks escaping extraction directory | Enabled |
| Hardlink attacks | Validates hardlink targets | Enabled |
| Zip bombs | Detects high compression ratios | Enabled (100x limit) |
| Permission sanitization | Strips setuid/setgid bits | Enabled |
| Size limits | Configurable file and total size limits | 50MB / 10GB |
[!CAUTION] Disabling security features is strongly discouraged. Only do so if you fully understand the risks and trust the archive source.
Custom Security Configuration
use SecurityConfig;
let config = SecurityConfig ;
Supported Formats
- TAR (
.tar) - TAR+GZIP (
.tar.gz,.tgz) - TAR+BZIP2 (
.tar.bz2) - TAR+XZ (
.tar.xz,.txz) - ZIP (
.zip)
API Overview
Main Types
| Type | Description |
|---|---|
extract_archive |
High-level extraction function |
Archive |
Archive handle with typestate pattern |
SecurityConfig |
Security configuration options |
ExtractionReport |
Extraction statistics and results |
ExtractionError |
Error types for extraction failures |
See API documentation for complete reference.
Related Crates
exarch-python- Python bindings via PyO3exarch-node- Node.js bindings via napi-rs
MSRV Policy
[!NOTE] Minimum Supported Rust Version: 1.89.0. MSRV increases are minor version bumps.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.