Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix Rust ZIP advisories and defer llama updates

Manav Rathi05abf75b5a7b
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 123041ab4a..57204466c5 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -97,6 +97,8 @@ updates:
# Breaks Photos and Locker iOS builds: https://github.com/rust-lang/libc/issues/5601
- dependency-name: "libc"
versions: ["=0.2.190"]
+ # Remove after validating Ensu inference upgrades with representative models.
+ - dependency-name: "llama-cpp-*"
# Remove when crypto_secretbox also uses salsa20 0.11.
- dependency-name: "salsa20"
versions: ["=0.11.0"]
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index 1753c17be8..b20bff3f6d 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -234,9 +234,6 @@ name = "arbitrary"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
-dependencies = [
- "derive_arbitrary",
-]
[[package]]
name = "archmage"
@@ -2068,17 +2065,6 @@ dependencies = [
"syn 1.0.109",
]
-[[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.117",
-]
-
[[package]]
name = "derive_builder"
version = "0.20.2"
@@ -2571,7 +2557,7 @@ dependencies = [
"url",
"uuid",
"zeroize",
- "zip 8.6.0",
+ "zip",
]
[[package]]
@@ -2790,7 +2776,7 @@ dependencies = [
"sha2 0.11.0",
"shapefile",
"thiserror 2.0.21",
- "zip 8.6.0",
+ "zip",
]
[[package]]
@@ -2918,7 +2904,7 @@ dependencies = [
"tokio",
"unicode-normalization",
"uuid",
- "zip 8.6.0",
+ "zip",
]
[[package]]
@@ -2994,7 +2980,7 @@ dependencies = [
"urlencoding",
"uuid",
"zeroize",
- "zip 8.6.0",
+ "zip",
]
[[package]]
@@ -6076,9 +6062,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "minisign-verify"
-version = "0.2.5"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22f9645cb765ea72b8111f36c522475d2daa0d22c957a9826437e97534bc4e9e"
+checksum = "871285dc19d8d0ebe0eef3d0e99a205f2a71363b122632cbbfa4a6c370a960ce"
[[package]]
name = "miniz_oxide"
@@ -6409,6 +6395,18 @@ dependencies = [
"memoffset",
]
+[[package]]
+name = "nix"
+version = "0.31.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
+dependencies = [
+ "bitflags 2.11.0",
+ "cfg-if",
+ "cfg_aliases",
+ "libc",
+]
+
[[package]]
name = "no_std_io2"
version = "0.9.4"
@@ -9542,9 +9540,9 @@ checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b"
[[package]]
name = "tauri"
-version = "2.12.1"
+version = "2.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed99ee9694a2deb776d91cae48ac7411ddfc89ecae2f9b5041111d8c88f2ace9"
+checksum = "d061d042ccd2df9c9f1508c1e63d835278c0a4c8801eb41764080e51f2eaaf34"
dependencies = [
"anyhow",
"bytes",
@@ -9761,9 +9759,8 @@ dependencies = [
[[package]]
name = "tauri-plugin-updater"
-version = "2.13.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8cb463cd1f26c9562a01718fe9adf6927795f764c3576e509f27cf567307ddef"
+version = "2.14.0"
+source = "git+https://github.com/tauri-apps/plugins-workspace?rev=ba98bfadc4c868c9a7e1a226c83af528e1f11b89#ba98bfadc4c868c9a7e1a226c83af528e1f11b89"
dependencies = [
"base64 0.22.1",
"dirs",
@@ -9790,7 +9787,7 @@ dependencies = [
"tokio",
"url",
"windows-sys 0.61.2",
- "zip 4.6.1",
+ "zip",
]
[[package]]
@@ -11873,7 +11870,7 @@ dependencies = [
"futures-sink",
"futures-util",
"hex",
- "nix",
+ "nix 0.29.0",
"ordered-stream",
"rand 0.8.6",
"serde",
@@ -12126,26 +12123,15 @@ dependencies = [
[[package]]
name = "zip"
-version = "4.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1"
-dependencies = [
- "arbitrary",
- "crc32fast",
- "indexmap 2.14.0",
- "memchr",
-]
-
-[[package]]
-name = "zip"
-version = "8.6.0"
+version = "9.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b"
+checksum = "a954114b47a54df49f83d2722814e86b23d4bb1b54a1b90fb7d92b41619ddc22"
dependencies = [
"crc32fast",
"flate2",
"indexmap 2.14.0",
"memchr",
+ "nix 0.31.3",
"typed-path",
]
@@ -12163,27 +12149,27 @@ checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
[[package]]
name = "zstd"
-version = "0.14.0"
+version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf06bd8162af0734b344780deb55b42a2429ae430870d13fcc12f238e880fe6e"
+checksum = "a4a9ecd0608fac4196ed58e1f337e9a72680fcc9ee449b8bcde6acea680b46f0"
dependencies = [
"zstd-safe",
]
[[package]]
name = "zstd-safe"
-version = "8.0.0"
+version = "8.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae42c0555055784c70058d19ba8e275528e8a99a706684868ace5da4e716a4ab"
+checksum = "ded520f16b29e1a9b771c722221b2b0a0398c2316d9bb3c42b458a5414d7434b"
dependencies = [
"zstd-sys",
]
[[package]]
name = "zstd-sys"
-version = "2.1.0+zstd.1.5.7"
+version = "2.1.2+zstd.1.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ef0a8027ec3ee71300ab3bcbcd0393f434aa72b91ca6d635a39941deae8eea0"
+checksum = "481ada9c543b2323cbb7bbdbb5249177fbf0188ed959ed2c15e4b22421c84ed3"
dependencies = [
"cc",
"pkg-config",
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 923c901395..84eff01d64 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -126,7 +126,11 @@ wasm-bindgen = "0.2.125"
wasm-bindgen-futures = "0.4.75"
web-sys = "0.3.102"
zeroize = { version = "1.9.0", features = ["derive"] }
-zip = { version = "8.6.0", default-features = false, features = ["deflate-flate2-zlib-rs"] }
+zip = { version = "9.0.4", default-features = false, features = ["deflate-flate2-zlib-rs"] }
+
+[patch.crates-io]
+# TODO: Remove after tauri-plugin-updater 2.14.1 ships the ZIP 9 fix.
+tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", rev = "ba98bfadc4c868c9a7e1a226c83af528e1f11b89" }
[workspace.lints.rust]
unexpected_cfgs = { level = "deny", check-cfg = ['cfg(frb_expand)'] }
diff --git a/rust/apps/cli/src/live_photo.rs b/rust/apps/cli/src/live_photo.rs
index a5cf4f4ce0..147df7a6a8 100644
--- a/rust/apps/cli/src/live_photo.rs
+++ b/rust/apps/cli/src/live_photo.rs
@@ -28,7 +28,8 @@ pub(crate) async fn extract_live_photo(zip_data: &[u8], output_path: &Path) -> R
let mut video = None;
for index in 0..archive.len() {
let file = archive.by_index(index)?;
- let (kind, extension) = parse_entry_name(file.name())?;
+ let name = file.name()?;
+ let (kind, extension) = parse_entry_name(&name)?;
let entry = Entry {
index,
extension: extension.to_string(),
diff --git a/rust/crates/photos-export/src/live_photo.rs b/rust/crates/photos-export/src/live_photo.rs
index 401369dacf..b4cc2a7b81 100644
--- a/rust/crates/photos-export/src/live_photo.rs
+++ b/rust/crates/photos-export/src/live_photo.rs
@@ -31,7 +31,7 @@ pub fn extract<R: Read + Seek, W: Write>(
if entry.is_dir() {
continue;
}
- let name = entry.name();
+ let name = entry.name()?;
let (role, extension) = if let Some(extension) = name.strip_prefix("image") {
(Role::Image, extension)
} else if let Some(extension) = name.strip_prefix("video") {
@@ -122,7 +122,7 @@ mod tests {
}
#[test]
- fn limits_declared_and_actual_combined_expansion() {
+ fn rejects_excessive_expansion_and_understated_sizes() {
let mut bytes = archive([9 * 1024 * 1024; 2], zip::CompressionMethod::Deflated);
let written = Cell::new(0);
let mut opened = 0;
@@ -141,13 +141,14 @@ mod tests {
for offset in headers {
bytes[offset + 24..offset + 28].copy_from_slice(&1u32.to_le_bytes());
}
- let limit = bytes.len() as u64 * 20 + 16 * 1024 * 1024;
let result = extract(Cursor::new(&bytes), |_, _| {
opened += 1;
Ok(Count(&written))
});
- assert!(matches!(result, Err(Error::ExpansionLimit)));
- assert_eq!(opened, 2);
- assert_eq!(written.get(), limit);
+ assert!(
+ matches!(result, Err(Error::Io(error)) if error.kind() == std::io::ErrorKind::InvalidData)
+ );
+ assert_eq!(opened, 1);
+ assert_eq!(written.get(), 0);
}
}