Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(desktop): upgrade zip extraction dependency to 9.0.4 (#2746)
Call Whiteacbb9245b147
diff --git a/desktop/Cargo.lock b/desktop/Cargo.lockindex 9197ea99e..c14de1ac3 100644--- a/desktop/Cargo.lock+++ b/desktop/Cargo.lock@@ -47,15 +47,6 @@ version = "1.0.104"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"-[[package]]-name = "arbitrary"-version = "1.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"-dependencies = [- "derive_arbitrary",-]-[[package]]name = "async-broadcast"version = "0.7.2"@@ -775,17 +766,6 @@ dependencies = ["serde_core",]-[[package]]-name = "derive_arbitrary"-version = "1.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]-[[package]]name = "derive_more"version = "2.1.1"@@ -4640,6 +4620,12 @@ version = "0.2.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"+[[package]]+name = "typed-path"+version = "0.12.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e"+[[package]]name = "typeid"version = "1.0.3"@@ -5778,15 +5764,16 @@ dependencies = [[[package]]name = "zip"-version = "4.6.1"+version = "9.0.4"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1"+checksum = "a954114b47a54df49f83d2722814e86b23d4bb1b54a1b90fb7d92b41619ddc22"dependencies = [- "arbitrary","crc32fast","flate2","indexmap 2.14.0","memchr",+ "nix",+ "typed-path",][[package]]diff --git a/desktop/Cargo.toml b/desktop/Cargo.tomlindex e5180986b..891273abc 100644--- a/desktop/Cargo.toml+++ b/desktop/Cargo.toml@@ -18,4 +18,4 @@ sys-locale = "0.3.2"thiserror = "2"tokio = { version = "1", default-features = false, features = ["rt", "time"] }url = "2"-zip = { version = "4.6.1", default-features = false, features = ["deflate-flate2-zlib-rs"] }+zip = { version = "9.0.4", default-features = false, features = ["deflate-flate2-zlib-rs"] }diff --git a/desktop/runtime-host/src/private_runtime.rs b/desktop/runtime-host/src/private_runtime.rsindex 282875e0c..a4d903550 100644--- a/desktop/runtime-host/src/private_runtime.rs+++ b/desktop/runtime-host/src/private_runtime.rs@@ -538,6 +538,14 @@ fn extract_archive(let mut entry = archive.by_index(index).map_err(|_| PrivateRuntimeError::ArchiveInvalid)?;+ let entry_name = entry.name().map_err(|_| PrivateRuntimeError::ArchiveInvalid)?;+ if Path::new(entry_name.as_ref()).is_absolute()+ || entry_name.starts_with('/')+ || entry_name.starts_with('\\')+ || entry_name.as_bytes().get(1) == Some(&b':')+ {+ return Err(PrivateRuntimeError::ArchiveInvalid);+ }unpacked = unpacked.checked_add(entry.size()).filter(|value| *value <= manifest.unpacked_size)@@ -801,16 +809,24 @@ mod tests {}fn write_bundle(root: &Path, extra_entry: Option<&str>) -> RuntimeBundleManifest {+ write_bundle_with_compression(root, extra_entry, CompressionMethod::Deflated)+ }++ fn write_bundle_with_compression(+ root: &Path,+ extra_entry: Option<&str>,+ compression: CompressionMethod,+ ) -> RuntimeBundleManifest {let bundle = root.join("bundle");fs::create_dir_all(&bundle).expect("bundle directory");let archive_path = bundle.join("runtime.zip");let archive_file = File::create(&archive_path).expect("archive");let mut zip = ZipWriter::new(archive_file);let executable_options = SimpleFileOptions::default()- .compression_method(CompressionMethod::Deflated)+ .compression_method(compression).unix_permissions(0o755);let data_options = SimpleFileOptions::default()- .compression_method(CompressionMethod::Deflated)+ .compression_method(compression).unix_permissions(0o644);let (python, node, npm_cli) = entrypoints();let mut unpacked_size = 0_u64;@@ -1486,15 +1502,134 @@ mod tests {fs::remove_dir_all(root).ok();}+ // Exercise the reader through prepare(), not just a ZipWriter round-trip:+ // payload hashes, staging cleanup and publication are part of this boundary.+ fn refresh_archive_identity(root: &Path, manifest: &mut RuntimeBundleManifest) {+ let bytes = fs::read(root.join("bundle/runtime.zip")).expect("archive bytes");+ manifest.archive_sha256 = format!("{:x}", Sha256::digest(&bytes));+ manifest.archive_size = bytes.len() as u64;+ fs::write(+ root.join("bundle").join(MANIFEST_NAME),+ serde_json::to_vec(manifest).expect("manifest JSON"),+ )+ .expect("manifest");+ }++ fn assert_no_published_or_staged_files(path: &Path) {+ for entry in fs::read_dir(path).expect("install directory") {+ let entry = entry.expect("entry");+ assert!(entry.file_type().expect("type").is_dir(), "unexpected file: {entry:?}");+ assert!(!entry.file_name().to_string_lossy().starts_with(".install-"));+ assert_no_published_or_staged_files(&entry.path());+ }+ }++ #[test]+ fn installs_unicode_paths_with_stored_and_deflated_entries() {+ for compression in [CompressionMethod::Stored, CompressionMethod::Deflated] {+ let root = scratch("zip-compression");+ write_bundle_with_compression(&root, Some("资料/运行时.txt"), compression);+ let bundle = PrivateRuntimeBundle::new(root.join("bundle"), root.join("installs"));+ let installed = bundle.prepare().expect("install");+ assert_eq!(fs::read(installed.root.join("资料/运行时.txt")).unwrap(), b"runtime");+ assert!(bundle.prepare().expect("reuse").reused);+ fs::remove_dir_all(root).unwrap();+ }+ }+#[test]fn rejects_path_traversal_before_any_file_can_escape() {- let root = scratch("traversal");- write_bundle(&root, Some("../escape"));- let bundle = PrivateRuntimeBundle::new(root.join("bundle"), root.join("installs"));+ for name in [+ "../escape",+ "nested/../../escape",+ "absolute",+ r"C:\escape",+ r"\\server\share\escape",+ ] {+ let root = scratch("traversal");+ // Even the absolute-path negative fixture is test-owned if a+ // regression lets it through; never point it at a real user file.+ let outside = root.join("escape");+ let absolute = outside.to_string_lossy().replace('\\', "/");+ let name = if name == "absolute" { absolute.as_str() } else { name };+ write_bundle(&root, Some(name));+ let bundle = PrivateRuntimeBundle::new(root.join("bundle"), root.join("installs"));- assert!(matches!(bundle.prepare(), Err(PrivateRuntimeError::ArchiveInvalid)));- assert!(!root.join("escape").exists());- fs::remove_dir_all(root).ok();+ let result = bundle.prepare();+ assert!(+ matches!(&result, Err(PrivateRuntimeError::ArchiveInvalid)),+ "{name}: {result:?}"+ );+ assert!(!outside.exists());+ assert_no_published_or_staged_files(&root.join("installs"));+ fs::remove_dir_all(root).unwrap();+ }+ }++ #[test]+ fn rejects_invalid_zip_metadata_and_cleans_partial_extraction() {+ #[cfg(not(unix))]+ let cases: &[&str] = &["crc", "entry-count", "unpacked-size", "truncated"];+ #[cfg(unix)]+ let cases: &[&str] = &["symlink", "crc", "entry-count", "unpacked-size", "truncated"];+ for &case in cases {+ let root = scratch(case);+ let mut manifest = write_bundle(&root, Some("last-entry"));+ let archive_path = root.join("bundle/runtime.zip");+ let mut bytes = fs::read(&archive_path).unwrap();+ // Mutate the last central record: valid earlier entries are+ // extracted first, so this also tests failure cleanup. Recompute+ // the archive digest to avoid passing via the outer hash check.+ let central = bytes.windows(4).rposition(|b| b == b"PK\x01\x02").unwrap();+ match case {+ "symlink" => {+ bytes[central + 38..central + 42].copy_from_slice(&(0o120_777_u32 << 16).to_le_bytes());+ }+ "crc" => bytes[central + 16] ^= 0xff,+ "entry-count" => manifest.entry_count += 1,+ "unpacked-size" => manifest.unpacked_size -= 1,+ "truncated" => bytes.truncate(12),+ _ => unreachable!(),+ }+ fs::write(archive_path, bytes).unwrap();+ refresh_archive_identity(&root, &mut manifest);+ let bundle = PrivateRuntimeBundle::new(root.join("bundle"), root.join("installs"));+ let failure = bundle.prepare().expect_err(case);+ if case == "crc" {+ assert!(+ matches!(failure, PrivateRuntimeError::Install(_)),+ "{case}: {failure:?}"+ );+ } else {+ assert!(+ matches!(failure, PrivateRuntimeError::ArchiveInvalid),+ "{case}: {failure:?}"+ );+ }+ assert_no_published_or_staged_files(&root.join("installs"));+ fs::remove_dir_all(root).unwrap();+ }+ }++ #[cfg(unix)]+ #[test]+ fn extraction_strips_privileged_permission_bits() {+ use std::os::unix::fs::PermissionsExt;+ let root = scratch("zip-modes");+ let mut manifest = write_bundle(&root, None);+ let archive_path = root.join("bundle/runtime.zip");+ let mut bytes = fs::read(&archive_path).unwrap();+ let central = bytes.windows(4).position(|b| b == b"PK\x01\x02").unwrap();+ bytes[central + 38..central + 42].copy_from_slice(&(0o107_755_u32 << 16).to_le_bytes());+ fs::write(archive_path, bytes).unwrap();+ refresh_archive_identity(&root, &mut manifest);+ let bundle = PrivateRuntimeBundle::new(root.join("bundle"), root.join("installs"));+ let installed = bundle.prepare().expect("install");+ assert_eq!(+ fs::metadata(installed.python).unwrap().permissions().mode() & 0o7777,+ 0o755+ );+ fs::remove_dir_all(root).unwrap();}#[test]diff --git a/docs/maintenance/desktop-zip-9.0.4.md b/docs/maintenance/desktop-zip-9.0.4.mdnew file mode 100644index 000000000..98f919e05--- /dev/null+++ b/docs/maintenance/desktop-zip-9.0.4.md@@ -0,0 +1,103 @@+# Desktop zip 9.0.4 candidate (2026-10-16)++## Contract and scope++Replace the desktop workspace's `zip` 4.6.1 with **9.0.4**, preserving+`default-features = false` and `deflate-flate2-zlib-rs`. The manifest's lower+bound and committed lockfile both name 9.0.4. Ordinary Cargo caret semantics+are unchanged; this is not a new exact-pin policy. Do not change Dependabot's+cooldown, packaged Runtime manifests, or installation/update behavior.++The only production Rust consumer is `runtime-host/src/private_runtime.rs`.+It reads the embedded `runtime.zip` (produced with Python `ZIP_DEFLATED` by+`desktop/scripts/build-runtime-bundle.py`) through `ZipArchive::new`,+`by_index`, `enclosed_name`, metadata accessors and `Read`. Test fixtures use+`ZipWriter` / `SimpleFileOptions`. No public API adaptation is needed.++## Candidate identity and selection++- Source: <https://github.com/zip-rs/zip2/releases/tag/v9.0.4>+- Immutable source commit: `7d9988688723f1136966e0e97200f41356dc57eb`+ (annotated tag object `04b8ef34c7fc07dee738a40459dae1a9cd863ad3`).+- crates.io archive:+ <https://static.crates.io/crates/zip/zip-9.0.4.crate>+- Archive SHA-256 / registry checksum:+ `a954114b47a54df49f83d2722814e86b23d4bb1b54a1b90fb7d92b41619ddc22`.+- MIT license; MSRV increases from 1.82 to **1.88** (edition 2024).+ Desktop development uses Rust stable; local verification uses Rust 1.92.+- Registry sparse index <https://index.crates.io/3/z/zip> on 2026-10-16:+ 4.6.1 and 9.0.2 are yanked; 9.0.3 and 9.0.4 are not yanked.+- No downstream patches. The lock update is limited to zip's dependency+ closure: add `typed-path`, reference the existing `nix`, remove the now+ unused `arbitrary` / `derive_arbitrary`; no unrelated dependency refresh.++9.0.4 is preferred to 9.0.3 because it adds a separator check in+`enclosed_name` for verbatim path components, an API Avibe calls directly.+It also fixes empty-stream handling. Its optional LZMA/PPMd dependency+updates do not enable those codecs in Avibe. This is a newly released+candidate, not a claim of long-term soak testing.++### Why this replaces #2700++PR #2700 was closed, not merged. Dependabot job+<https://github.com/avibe-bot/avibe/actions/runs/38858098825> recreated it on+`fbd3b7f62b4ffd2475b022c851dce8d4ef023bfc`, filtered all candidates by+cooldown, fell back to 4.6.1 and closed it as `up_to_date`. Its declared+candidate was 9.0.2 but its lockfile selected 9.0.3. This replacement names+one actual candidate throughout; it does not restore the yanked 9.0.2.++### Security assessment++The maintainer's explanation in+<https://github.com/zip-rs/zip2/issues/1075> links the mass yanks to:++- GHSA-vv5m-jxxh-4627: privileged Unix mode preservation, patched in 9.0.0.+- GHSA-4v9h-p7m9-rh26: external symlink targets, patched in 9.0.0.+- GHSA-4684-h2q9-2vcp: chmod through symlinks, patched in 9.0.1.++The RustSec entry RUSTSEC-2025-0168 concerns extraction paths fixed since+2.3.0; it does not establish a new 4.6.1-specific failure. The maintainer+also mentions further unpublished issues; their impact cannot be assessed+from the public evidence available at preparation time.++Avibe does **not** call upstream `extract` or `ZipStreamReader::extract`.+Its existing extraction loop verifies archive size/hash, checks entry count+and declared unpacked total, rejects symlink entries and non-normal paths,+creates files exclusively in staging, masks mode to `0o777`, checks the full+resulting tree, and only then publishes the slot. These facts reduce the+applicability of the listed extract-API advisories; they are not a blanket+claim that Avibe cannot be affected by any parser vulnerability.++## Validation contract++Primary owner: `PrivateRuntimeBundle::prepare` in `private_runtime.rs`.+Existing tests covered a normal Deflate bundle, signed archive identity,+installed-tree verification, reuse/repair and one `../` path. New cases+cover dependency-sensitive behavior that those cases do not exercise:++- Stored and Deflate payloads with non-ASCII names, full installation and reuse.+- Nested traversal and test-owned absolute paths; no outside file written.+- Symlink central metadata on Unix, CRC failure, truncated archive, incorrect+ entry count and unpacked-size budget; no staged/published files remain on+ failure.+- Unix SUID/SGID/sticky flags are stripped while executable bits survive.++Negative fixtures refresh archive identity after mutation so they reach the+ZIP reader/extractor rather than passing because of the outer hash check.+These are dependency compatibility guards, not claims of newly fixed Avibe+bugs. Expected paths/bytes/modes and invalid metadata are supplied by tests,+not by the implementation under test.++Focused commands (from `desktop/`):++```sh+cargo test -p avibe-runtime-host private_runtime --locked+cargo clippy -p avibe-runtime-host --all-targets --all-features --locked -- -D warnings+cargo fmt --all -- --check+```++CI additionally owns the full lint workflow and macOS/Windows desktop Rust+compilation/tests. No runtime binary candidate is being adopted, so the+playbook's engine-candidate Incus E2E does not apply to this Rust library+change. Actual signed desktop bundle installation and a live upgrade are+not exercised by the hermetic tests; do not claim those release checks ran.