exarch-rs 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  Memory-safe archive extraction and creation library for Node.js.
10
10
 
11
- > **Important:** exarch is designed as a secure replacement for vulnerable archive libraries like `tar-fs`, which has known CVEs with CVSS scores up to 9.4.
11
+ **Important:** exarch is designed as a secure replacement for vulnerable archive libraries like `tar-fs`, which has known CVEs with CVSS scores up to 9.4.
12
12
 
13
13
  This package provides Node.js bindings for [exarch-core](../exarch-core), a Rust library with built-in protection against common archive vulnerabilities.
14
14
 
@@ -28,7 +28,7 @@ pnpm add exarch-rs
28
28
  bun add exarch-rs
29
29
  ```
30
30
 
31
- > **Note:** This package includes TypeScript definitions. No need for separate `@types` package.
31
+ **Note:** This package includes TypeScript definitions. No need for a separate `@types` package.
32
32
 
33
33
  ## Requirements
34
34
 
@@ -79,7 +79,7 @@ const result = extractArchiveSync('archive.tar.gz', '/output/path');
79
79
  console.log(`Extracted ${result.filesExtracted} files`);
80
80
  ```
81
81
 
82
- > **Tip:** Prefer the async API to avoid blocking the event loop during extraction.
82
+ **Tip:** Prefer the async API to avoid blocking the event loop during extraction.
83
83
 
84
84
  ### ES Modules
85
85
 
@@ -151,9 +151,13 @@ Synchronous version. Blocks the event loop until extraction completes.
151
151
 
152
152
  ```typescript
153
153
  interface ExtractionReport {
154
- filesExtracted: number; // Number of files extracted
155
- bytesWritten: number; // Total bytes written
156
- durationMs: number; // Extraction duration in milliseconds
154
+ filesExtracted: number; // Number of files extracted
155
+ directoriesCreated: number; // Number of directories created
156
+ symlinksCreated: number; // Number of symlinks created
157
+ bytesWritten: number; // Total bytes written
158
+ durationMs: number; // Extraction duration in milliseconds
159
+ filesSkipped: number; // Files skipped (e.g. duplicates)
160
+ warnings: string[]; // Warning messages from extraction
157
161
  }
158
162
  ```
159
163
 
@@ -163,10 +167,11 @@ Builder-style security configuration.
163
167
 
164
168
  ```typescript
165
169
  const config = new SecurityConfig()
166
- .maxFileSize(bytes) // Max size per file
167
- .maxTotalSize(bytes) // Max total extraction size
168
- .maxFileCount(count) // Max number of files
169
- .maxCompressionRatio(n); // Max compression ratio (zip bomb detection)
170
+ .maxFileSize(bytes) // Max size per file
171
+ .maxTotalSize(bytes) // Max total extraction size
172
+ .maxFileCount(count) // Max number of files
173
+ .maxCompressionRatio(n) // Max compression ratio (zip bomb detection)
174
+ .setAllowSolidArchives(true); // Allow solid 7z archives (default: false)
170
175
  ```
171
176
 
172
177
  ## Security Features
@@ -182,21 +187,21 @@ The library provides built-in protection against:
182
187
  | Permission sanitization | Strips setuid/setgid bits |
183
188
  | Size limits | Enforces file and total size limits |
184
189
 
185
- > **Caution:** Unlike many Node.js archive libraries, exarch applies security validation by default.
190
+ **Caution:** Unlike many Node.js archive libraries, exarch applies security validation by default.
186
191
 
187
192
  ## Supported Formats
188
193
 
189
- | Format | Extensions | Extract | Create |
190
- |--------|------------|:-------:|:------:|
191
- | TAR | `.tar` | ✅ | ✅ |
192
- | TAR+GZIP | `.tar.gz`, `.tgz` | ✅ | ✅ |
193
- | TAR+BZIP2 | `.tar.bz2`, `.tbz2` | ✅ | ✅ |
194
- | TAR+XZ | `.tar.xz`, `.txz` | ✅ | ✅ |
195
- | TAR+ZSTD | `.tar.zst`, `.tzst` | ✅ | ✅ |
196
- | ZIP | `.zip` | ✅ | ✅ |
197
- | 7z | `.7z` | ✅ | — |
198
-
199
- > **Note:** 7z creation is not yet supported. Solid and encrypted 7z archives are rejected for security reasons.
194
+ | Format | Extensions | Extract | Create | List | Verify |
195
+ |--------|------------|:-------:|:------:|:----:|:------:|
196
+ | TAR | `.tar` | ✅ | ✅ | ✅ | ✅ |
197
+ | TAR+GZIP | `.tar.gz`, `.tgz` | ✅ | ✅ | ✅ | ✅ |
198
+ | TAR+BZIP2 | `.tar.bz2`, `.tbz2` | ✅ | ✅ | ✅ | ✅ |
199
+ | TAR+XZ | `.tar.xz`, `.txz` | ✅ | ✅ | ✅ | ✅ |
200
+ | TAR+ZSTD | `.tar.zst`, `.tzst` | ✅ | ✅ | ✅ | ✅ |
201
+ | ZIP | `.zip` | ✅ | ✅ | ✅ | ✅ |
202
+ | 7z | `.7z` | ✅ | — | ✅ | ✅ |
203
+
204
+ **Note:** 7z creation is not yet supported. Solid and encrypted 7z archives are rejected for security reasons. Unix symlinks inside 7z archives are reported as regular files (sevenz-rust2 API limitation).
200
205
 
201
206
  ## Comparison with tar-fs
202
207
 
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exarch-rs",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Memory-safe archive extraction library with built-in security validation",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/src/config.rs CHANGED
@@ -160,6 +160,17 @@ impl SecurityConfig {
160
160
  self
161
161
  }
162
162
 
163
+ /// Allows or denies solid 7z archives.
164
+ ///
165
+ /// Solid archives require reading all preceding entries to decompress any
166
+ /// entry, which may allow a crafted archive to consume excessive
167
+ /// memory. Disabled by default.
168
+ #[napi(js_name = "setAllowSolidArchives")]
169
+ pub fn set_allow_solid_archives(&mut self, allow: Option<bool>) -> &Self {
170
+ self.inner.allow_solid_archives = allow.unwrap_or(true);
171
+ self
172
+ }
173
+
163
174
  /// Sets whether to preserve permissions from archive.
164
175
  #[napi(js_name = "setPreservePermissions")]
165
176
  pub fn set_preserve_permissions(&mut self, preserve: Option<bool>) -> &Self {