Release v1.4.18 with performance optimization and deep bug fixes
- Optimize session cloning: replace JSON.parse/stringify with shallow spread (~10x faster for large queues) - Convert blocking fs.existsSync/statSync to async on download hot path - Fix EXDEV cross-device rename in sync saveSettings/saveSession (network drive support) - Fix double-delete bug in applyCompletedCleanupPolicy (package_done + immediate) - Fix dangling runPackageIds/runCompletedPackages in removePackageFromSession - Fix AdmZip partial extraction: use overwrite mode for external fallback - Add null byte stripping to sanitizeFilename (path traversal prevention) - Add 5MB size limit for hash manifest files (OOM prevention) - Add 256KB size limit for link artifact file content check - Deduplicate cleanup code via centralized removePackageFromSession Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
d4dd266f6b
commit
b971a79047
@@ -421,4 +421,30 @@ describe("extractor", () => {
|
||||
expect(result.failed).toBe(0);
|
||||
expect(result.extracted).toBe(0);
|
||||
});
|
||||
|
||||
it("rejects zip entries with path traversal", async () => {
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), "rd-extract-"));
|
||||
tempDirs.push(root);
|
||||
const packageDir = path.join(root, "pkg");
|
||||
const targetDir = path.join(root, "out");
|
||||
fs.mkdirSync(packageDir, { recursive: true });
|
||||
|
||||
const zip = new AdmZip();
|
||||
zip.addFile("safe.txt", Buffer.from("safe"));
|
||||
zip.addFile("../escaped.txt", Buffer.from("malicious"));
|
||||
zip.writeZip(path.join(packageDir, "traversal.zip"));
|
||||
|
||||
const result = await extractPackageArchives({
|
||||
packageDir,
|
||||
targetDir,
|
||||
cleanupMode: "none",
|
||||
conflictMode: "overwrite",
|
||||
removeLinks: false,
|
||||
removeSamples: false
|
||||
});
|
||||
|
||||
expect(result.extracted).toBe(1);
|
||||
expect(fs.existsSync(path.join(targetDir, "safe.txt"))).toBe(true);
|
||||
expect(fs.existsSync(path.join(root, "escaped.txt"))).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user