π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Normalize Cargo dependencies and enforce workspace declarations
Manav Rathi12cdef273a4e
diff --git a/.github/workflows/rust-lint.yml b/.github/workflows/rust-lint.ymlindex fd4afa4528..57105bcc31 100644--- a/.github/workflows/rust-lint.yml+++ b/.github/workflows/rust-lint.yml@@ -43,10 +43,6 @@ jobs:save-if: falsecache-directories: rust/.cache- - run: cargo fmt --check-- - run: cargo clippy --locked --all-targets --features museum,ente-ml/ml-assets-- run: cargo install cargo-audit --version 0.22.2 --locked- - run: cargo audit+ - run: ./scripts/lint.shdiff --git a/.github/workflows/warm-caches.yml b/.github/workflows/warm-caches.ymlindex 4b32756de0..5505e8c0b6 100644--- a/.github/workflows/warm-caches.yml+++ b/.github/workflows/warm-caches.yml@@ -50,14 +50,14 @@ jobs:- name: Reset ML test cacherun: rm -rf .cache- - run: cargo clippy --locked --all-targets --features museum,ente-ml/ml-assets+ - run: cargo install cargo-audit --version 0.22.2 --locked++ - run: ./scripts/lint.sh- run: cargo test --locked --features museum,ente-ml/ml-assetsenv:GITHUB_TOKEN: ${{ github.token }}- - run: cargo install cargo-audit --version 0.22.2 --locked-rust-flutter:# For the cargo steps of mobile-lint.yml.runs-on: ubuntu-latestdiff --git a/rust/Cargo.lock b/rust/Cargo.lockindex 2155ff8f3a..64d007e9f9 100644--- a/rust/Cargo.lock+++ b/rust/Cargo.lock@@ -797,7 +797,7 @@ checksum = "b79834656f71332577234b50bfc009996f7449e0c056884e6a02492ded0ca2f3"dependencies = ["arrayref","arrayvec",- "constant_time_eq 0.4.2",+ "constant_time_eq",][[package]]@@ -946,25 +946,6 @@ dependencies = ["bytes",]-[[package]]-name = "bzip2"-version = "0.5.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "49ecfb22d906f800d4fe833b6282cf4dc1c298f5057ca0b5445e5c209735ca47"-dependencies = [- "bzip2-sys",-]--[[package]]-name = "bzip2-sys"-version = "0.1.13+1.0.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14"-dependencies = [- "cc",- "pkg-config",-]-[[package]]name = "cairo-rs"version = "0.18.5"@@ -1401,12 +1382,6 @@ version = "0.10.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"-[[package]]-name = "constant_time_eq"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6"-[[package]]name = "constant_time_eq"version = "0.4.2"@@ -1930,12 +1905,6 @@ dependencies = ["zeroize",]-[[package]]-name = "deflate64"-version = "0.1.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ac6b926516df9c60bfa16e107b21086399f8285a44ca9711344b9e553c5146e2"-[[package]]name = "delegate-attr"version = "0.3.0"@@ -2824,7 +2793,7 @@ dependencies = ["urlencoding","uuid","zeroize",- "zip 2.4.2",+ "zip 8.6.0",][[package]]@@ -5743,33 +5712,12 @@ version = "0.1.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"-[[package]]-name = "lzma-rs"-version = "0.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e"-dependencies = [- "byteorder",- "crc",-]-[[package]]name = "lzma-rust2"version = "0.15.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1670343e58806300d87950e3401e820b519b9384281bbabfb15e3636689ffd69"-[[package]]-name = "lzma-sys"-version = "0.1.20"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27"-dependencies = [- "cc",- "libc",- "pkg-config",-]-[[package]]name = "markup5ever"version = "0.38.0"@@ -6836,16 +6784,6 @@ version = "0.2.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"-[[package]]-name = "pbkdf2"-version = "0.12.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"-dependencies = [- "digest 0.10.7",- "hmac 0.12.1",-]-[[package]]name = "pem-rfc7468"version = "1.0.0"@@ -11582,15 +11520,6 @@ dependencies = ["windows-sys 0.59.0",]-[[package]]-name = "xz2"-version = "0.1.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"-dependencies = [- "lzma-sys",-]-[[package]]name = "y4m"version = "0.8.0"@@ -11909,36 +11838,6 @@ dependencies = ["syn 2.0.117",]-[[package]]-name = "zip"-version = "2.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fabe6324e908f85a1c52063ce7aa26b68dcb7eb6dbc83a2d148403c9bc3eba50"-dependencies = [- "aes",- "arbitrary",- "bzip2",- "constant_time_eq 0.3.1",- "crc32fast",- "crossbeam-utils",- "deflate64",- "displaydoc",- "flate2",- "getrandom 0.3.4",- "hmac 0.12.1",- "indexmap 2.14.0",- "lzma-rs",- "memchr",- "pbkdf2",- "sha1 0.10.6",- "thiserror 2.0.18",- "time",- "xz2",- "zeroize",- "zopfli",- "zstd",-]-[[package]]name = "zip"version = "4.6.1"@@ -11976,18 +11875,6 @@ version = "1.0.21"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"-[[package]]-name = "zopfli"-version = "0.8.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249"-dependencies = [- "bumpalo",- "crc32fast",- "log",- "simd-adler32",-]-[[package]]name = "zstd"version = "0.13.3"diff --git a/rust/Cargo.toml b/rust/Cargo.tomlindex cc106cc428..01e35d67f2 100644--- a/rust/Cargo.toml+++ b/rust/Cargo.toml@@ -41,6 +41,7 @@ members = [][workspace.dependencies]+dirs = "5.0.1"ente-accounts = { path = "crates/accounts" }ente-assets = { path = "crates/assets" }ente-cast = { path = "crates/cast" }@@ -61,29 +62,45 @@ ente-test-support = { path = "crates/test-support" }ente-uniffi-log = { path = "bindings/uniffi/log" }ente-wasm-lib = { path = "bindings/wasm/lib" }ente-wasm-log = { path = "bindings/wasm/log" }+fast_image_resize = { version = "5.5.0", features = ["image"] }+flate2 = "1.1.9"flutter_rust_bridge = "=2.12.0"flutter_rust_bridge_codegen = "=2.12.0"+futures-util = "0.3.32"+getrandom = { version = "0.4.0", features = ["wasm_js"] }hkdf = "0.13.0"+hmac = "0.13.0"+image = "0.25.10"js-sys = "0.3.102"log = "0.4.29"md-5 = "0.11.0"mockito = "1.7.2"ort = { version = "=2.0.0-rc.13", default-features = false }ort-sys = { version = "=2.0.0-rc.13", default-features = false }+regex = "1.11.1"reqwest = { version = "0.12.28", default-features = false }+rusqlite = { version = "0.38.0", default-features = false, features = ["bundled"] }serde = { version = "1.0.228", features = ["derive"] }serde_json = "1.0.149"serde-wasm-bindgen = "0.6.5"+sha1 = "0.11.0"sha2 = "0.11.0"+srp = { version = "0.7.0-rc.3", default-features = false }+subtle = "2.0.0"+tar = "0.4.46"+tempfile = "3.27.0"thiserror = "2.0.18"+tokio = "1.41.0"tsify = { version = "0.5.8", default-features = false, features = ["js"] }uniffi = { version = "=0.31.0" }uniffi_bindgen = { version = "=0.31.0", default-features = false, features = ["cargo-metadata"] }url = "2.5.8"urlencoding = "2.1.3"+uuid = "1.23.1"wasm-bindgen = "0.2.125"wasm-bindgen-futures = "0.4.75"zeroize = { version = "1.9.0", features = ["derive"] }+zip = { version = "8.6.0", default-features = false, features = ["deflate-flate2-zlib-rs"] }# Unoptimized Argon2 makes production-strength derivations dominate test runtime.[profile.dev.package.argon2]diff --git a/rust/apps/cli/Cargo.toml b/rust/apps/cli/Cargo.tomlindex 149bddc5c9..44f1471ac5 100644--- a/rust/apps/cli/Cargo.toml+++ b/rust/apps/cli/Cargo.toml@@ -11,31 +11,31 @@ license = "AGPL-3.0-only"museum = [][dependencies]-chrono = "0.4"-clap = { version = "4.5", features = ["derive", "env"] }-dialoguer = "0.11"-dirs = "5.0"+chrono = "0.4.0"+clap = { version = "4.5.0", features = ["derive", "env"] }+dialoguer = "0.11.0"+dirs.workspace = trueente-accounts.workspace = trueente-core.workspace = trueente-paste.workspace = true-env_logger = "0.11"-futures = "0.3"-indicatif = "0.18"+env_logger = "0.11.0"+futures = "0.3.0"+indicatif = "0.18.0"log.workspace = true-open = "5.0"-rusqlite = { version = "0.38", features = ["bundled", "serde_json"] }+open = "5.0.0"+rusqlite = { workspace = true, default-features = true, features = ["serde_json"] }serde.workspace = trueserde_json.workspace = truethiserror.workspace = true-tokio = { version = "1.41", features = ["full"] }+tokio = { workspace = true, features = ["full"] }urlencoding.workspace = true-uuid = { version = "1.11", features = ["serde", "v4"] }+uuid = { workspace = true, features = ["serde", "v4"] }zeroize.workspace = true-zip = "2.2"+zip.workspace = true[dev-dependencies]ente-test-support.workspace = truemockito.workspace = truesha2.workspace = true-srp = { version = "0.7.0-rc.3", default-features = false }+srp.workspace = trueurl.workspace = truediff --git a/rust/apps/cli/src/live_photo.rs b/rust/apps/cli/src/live_photo.rsindex 113325a934..a5cf4f4ce0 100644--- a/rust/apps/cli/src/live_photo.rs+++ b/rust/apps/cli/src/live_photo.rs@@ -102,17 +102,22 @@ mod tests {use std::io::{Cursor, Write};use std::path::Path;+ use ente_core::{b64, crypto};+ use mockito::Server;use zip::{CompressionMethod, ZipWriter, write::SimpleFileOptions};use super::{extract_live_photo, parse_entry_name};+ use crate::api::client::AppClient;+ use crate::models::{account::App, file::RemoteFile};+ use crate::sync::DownloadManager;- fn archive(entries: &[(&str, &[u8])]) -> Vec<u8> {+ fn archive(entries: &[(&str, &[u8])], compression: CompressionMethod) -> Vec<u8> {let mut writer = ZipWriter::new(Cursor::new(Vec::new()));for (name, data) in entries {writer.start_file(*name,- SimpleFileOptions::default().compression_method(CompressionMethod::Deflated),+ SimpleFileOptions::default().compression_method(compression),).unwrap();writer.write_all(data).unwrap();@@ -130,31 +135,89 @@ mod tests {}#[tokio::test]- async fn extracts_image_and_video() {- let data = archive(&[("image.jpg", b"image"), ("video.mov", b"video")]);+ async fn extracts_stored_and_deflated_components() {+ for compression in [CompressionMethod::Stored, CompressionMethod::Deflated] {+ let data = archive(+ &[("image.jpg", b"image"), ("video.mov", b"video")],+ compression,+ );+ let directory =+ std::env::temp_dir().join(format!("ente-live-photo-test-{}", uuid::Uuid::new_v4()));+ std::fs::create_dir(&directory).unwrap();++ extract_live_photo(&data, &directory.join("photo.zip"))+ .await+ .unwrap();+ assert_eq!(+ std::fs::read(directory.join("photo.jpg")).unwrap(),+ b"image"+ );+ assert_eq!(+ std::fs::read(directory.join("photo.mov")).unwrap(),+ b"video"+ );++ std::fs::remove_dir_all(directory).unwrap();+ }+ }++ #[tokio::test]+ async fn download_preserves_invalid_live_photo_archive() {+ let data = archive(&[("image.jpg", b"image")], CompressionMethod::Deflated);+ let collection_key = crypto::Key::generate();+ let file_key = crypto::Key::generate();+ let encrypted_key = crypto::secretbox::encrypt(file_key.as_bytes(), &collection_key);+ let mut encrypted_data = Vec::new();+ let header =+ crypto::stream::encrypt_file(&mut data.as_slice(), &mut encrypted_data, &file_key)+ .unwrap();+ let file_id = uuid::Uuid::new_v4().as_u64_pair().0 as i64;+ let file: RemoteFile = serde_json::from_value(serde_json::json!({+ "id": file_id,+ "collectionID": 1,+ "ownerID": 1,+ "encryptedKey": b64::encode(&encrypted_key.encrypted_data),+ "keyDecryptionNonce": b64::encode(encrypted_key.nonce.as_bytes()),+ "file": { "decryptionHeader": b64::encode(header.as_bytes()) },+ "thumbnail": { "decryptionHeader": "" },+ "metadata": { "encryptedData": "", "decryptionHeader": "" },+ "isDeleted": false,+ "updatedAt": 0+ }))+ .unwrap();+ let mut server = Server::new_async().await;+ let url_mock = server+ .mock("GET", format!("/files/download/v3/{file_id}").as_str())+ .with_body(serde_json::json!({ "url": format!("{}/object", server.url()) }).to_string())+ .create_async()+ .await;+ let download_mock = server+ .mock("GET", "/object")+ .with_body(encrypted_data)+ .create_async()+ .await;+ let client = AppClient::new(Some(server.url()), App::Photos).unwrap();+ let mut manager = DownloadManager::new(client).unwrap();+ manager.set_collection_keys([(1, collection_key.as_bytes().to_vec())].into());let directory =std::env::temp_dir().join(format!("ente-live-photo-test-{}", uuid::Uuid::new_v4()));- std::fs::create_dir(&directory).unwrap();-- extract_live_photo(&data, &directory.join("photo.zip"))- .await- .unwrap();- assert_eq!(- std::fs::read(directory.join("photo.jpg")).unwrap(),- b"image"- );- assert_eq!(- std::fs::read(directory.join("photo.mov")).unwrap(),- b"video"- );+ let destination = directory.join("photo.zip");+ manager.download_file(&file, &destination).await.unwrap();++ url_mock.assert_async().await;+ download_mock.assert_async().await;+ assert_eq!(std::fs::read(destination).unwrap(), data);std::fs::remove_dir_all(directory).unwrap();}#[tokio::test]async fn rejects_excessive_expansion() {let oversized = vec![0; super::MAX_EXPANDED_OVERHEAD as usize + 1024 * 1024];- let data = archive(&[("image.jpg", &oversized), ("video.mov", b"video")]);+ let data = archive(+ &[("image.jpg", &oversized), ("video.mov", b"video")],+ CompressionMethod::Deflated,+ );assert!(extract_live_photo(&data, Path::new("photo.zip")).awaitdiff --git a/rust/apps/ensu/src-tauri/Cargo.toml b/rust/apps/ensu/src-tauri/Cargo.tomlindex cff1278706..8422f4c91d 100644--- a/rust/apps/ensu/src-tauri/Cargo.toml+++ b/rust/apps/ensu/src-tauri/Cargo.toml@@ -11,7 +11,7 @@ ente-assets.workspace = trueente-core.workspace = trueente-ensu.workspace = trueente-ensu-crypto.workspace = true-keyring = { version = "3", default-features = false, features = ["apple-native", "windows-native", "linux-native-sync-persistent", "crypto-rust"] }+keyring = { version = "3.0.0", default-features = false, features = ["apple-native", "windows-native", "linux-native-sync-persistent", "crypto-rust"] }log.workspace = trueserde.workspace = trueserde_json.workspace = true@@ -21,10 +21,10 @@ tauri-plugin-fs = "2.5.1"tauri-plugin-opener = "2.5.4"tauri-plugin-process = "2.3.1"tauri-plugin-updater = "2.10.1"-uuid = { version = "1", features = ["v4"] }+uuid = { workspace = true, features = ["v4"] }[target.'cfg(unix)'.dependencies]-libc = "0.2"+libc = "0.2.0"[target.'cfg(windows)'.dependencies]windows-sys = { version = "0.61.2", features = ["Win32_System_SystemInformation"] }diff --git a/rust/bindings/napi/photos/Cargo.toml b/rust/bindings/napi/photos/Cargo.tomlindex b8bd63b68c..4e4fd37e20 100644--- a/rust/bindings/napi/photos/Cargo.toml+++ b/rust/bindings/napi/photos/Cargo.toml@@ -10,9 +10,9 @@ crate-type = ["cdylib"]ente-assets.workspace = trueente-ml.workspace = truelog = { workspace = true, features = ["std"] }-napi = { version = "3", default-features = false, features = ["napi10", "tokio_rt"] }-napi-derive = "3"+napi = { version = "3.0.0", default-features = false, features = ["napi10", "tokio_rt"] }+napi-derive = "3.0.0"ort = { workspace = true, features = ["load-dynamic"] }[build-dependencies]-napi-build = "2"+napi-build = "2.0.0"diff --git a/rust/bindings/uniffi/ensu/Cargo.toml b/rust/bindings/uniffi/ensu/Cargo.tomlindex a750c0c300..c285583019 100644--- a/rust/bindings/uniffi/ensu/Cargo.toml+++ b/rust/bindings/uniffi/ensu/Cargo.toml@@ -13,4 +13,4 @@ ente-ensu = { workspace = true, features = ["transcription"] }ente-uniffi-log.workspace = truethiserror.workspace = trueuniffi = { workspace = true, features = ["tokio"] }-uuid = { version = "1" }+uuid.workspace = truediff --git a/rust/bindings/wasm/space/Cargo.toml b/rust/bindings/wasm/space/Cargo.tomlindex a6fd63b2e2..19384d1833 100644--- a/rust/bindings/wasm/space/Cargo.toml+++ b/rust/bindings/wasm/space/Cargo.toml@@ -18,4 +18,4 @@ wasm-bindgen.workspace = truewasm-bindgen-futures.workspace = true[dev-dependencies]-tokio = { version = "1", features = ["macros", "rt"] }+tokio = { workspace = true, features = ["macros", "rt"] }diff --git a/rust/crates/accounts/Cargo.toml b/rust/crates/accounts/Cargo.tomlindex 2849577726..279a108f4f 100644--- a/rust/crates/accounts/Cargo.toml+++ b/rust/crates/accounts/Cargo.toml@@ -6,23 +6,23 @@ edition = "2024"museum = [][dependencies]-bip39 = { version = "2", default-features = false, features = ["std"] }+bip39 = { version = "2.0.0", default-features = false, features = ["std"] }ente-core.workspace = true-getrandom = { version = "0.4", features = ["wasm_js"] }-hex = "0.4"+getrandom.workspace = true+hex = "0.4.0"serde.workspace = trueserde_json.workspace = truesha2.workspace = true-srp = { version = "0.7.0-rc.3", default-features = false }-subtle = "2"+srp.workspace = true+subtle.workspace = truethiserror.workspace = trueurlencoding.workspace = true-uuid = { version = "1.11", features = ["js", "serde", "v4"] }+uuid = { workspace = true, features = ["js", "serde", "v4"] }zeroize.workspace = true[dev-dependencies]ente-test-support.workspace = true-hmac = "0.13"+hmac.workspace = truemockito.workspace = true-sha1 = "0.11"-tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }+sha1.workspace = true+tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }diff --git a/rust/crates/assets/Cargo.toml b/rust/crates/assets/Cargo.tomlindex 458ca9338e..cff81ded09 100644--- a/rust/crates/assets/Cargo.toml+++ b/rust/crates/assets/Cargo.toml@@ -3,12 +3,12 @@ name = "ente-assets"edition = "2024"[dependencies]-flate2 = "1.1.9"-futures-util = "0.3.32"+flate2.workspace = true+futures-util.workspace = truereqwest = { workspace = true, features = ["http2", "system-proxy", "rustls-tls-webpki-roots"] }serde.workspace = trueserde_json.workspace = truesha2.workspace = true-tar = "0.4.46"+tar.workspace = truethiserror.workspace = true-tokio = { version = "1", features = ["macros", "rt", "sync"] }+tokio = { workspace = true, features = ["macros", "rt", "sync"] }diff --git a/rust/crates/contacts/Cargo.toml b/rust/crates/contacts/Cargo.tomlindex 18839e9ac0..f0aea8372b 100644--- a/rust/crates/contacts/Cargo.toml+++ b/rust/crates/contacts/Cargo.toml@@ -15,11 +15,11 @@ thiserror.workspace = trueente-accounts.workspace = trueente-legacy.workspace = trueente-test-support.workspace = true-hmac = "0.13"+hmac.workspace = truemockito.workspace = truereqwest = { workspace = true, features = ["json"] }serde_json.workspace = true-sha1 = "0.11"-tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }-uuid = { version = "1", features = ["v4", "js"] }+sha1.workspace = true+tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }+uuid = { workspace = true, features = ["v4", "js"] }zeroize.workspace = truediff --git a/rust/crates/core/Cargo.toml b/rust/crates/core/Cargo.tomlindex ec8853abcf..02a1b5cf60 100644--- a/rust/crates/core/Cargo.toml+++ b/rust/crates/core/Cargo.toml@@ -5,37 +5,37 @@ edition = "2024"[dependencies]# Keep argon2 on stable 0.5.x for now. This retains a second digest 0.10# chain (via blake2 0.10) until argon2 0.6 reaches stable.-argon2 = "0.5"-base64 = "0.22"-blake2b_simd = "1.0"-crypto_secretbox = { version = "0.1", default-features = false, features = ["alloc", "salsa20"] }+argon2 = "0.5.0"+base64 = "0.22.0"+blake2b_simd = "1.0.0"+crypto_secretbox = { version = "0.1.0", default-features = false, features = ["alloc", "salsa20"] }crypto_secretstream = "=0.2.0"-getrandom = { version = "0.4", features = ["wasm_js"] }-hpke = { version = "0.14", default-features = false, features = ["alloc", "chacha", "getrandom", "mlkem", "x25519"] }+getrandom.workspace = true+hpke = { version = "0.14.0", default-features = false, features = ["alloc", "chacha", "getrandom", "mlkem", "x25519"] }log.workspace = truemd-5.workspace = true-rand_core_06 = { package = "rand_core", version = "0.6", features = ["getrandom"] }+rand_core_06 = { package = "rand_core", version = "0.6.0", features = ["getrandom"] }reqwest = { workspace = true, features = ["http2", "charset", "system-proxy", "json", "rustls-tls-native-roots", "rustls-tls-webpki-roots"] }-salsa20 = "0.10"+salsa20 = "0.10.0"serde.workspace = trueserde_json.workspace = true-subtle = "2"+subtle.workspace = truethiserror.workspace = true# Remove when hpke fix for accidentally not enabling xwing zeroize is released.# https://github.com/rozbb/rust-hpke/issues/110-x-wing = { version = "0.1", default-features = false, features = ["zeroize"] }-x25519-dalek = { version = "3.0", features = ["static_secrets"] }+x-wing = { version = "0.1.0", default-features = false, features = ["zeroize"] }+x25519-dalek = { version = "3.0.0", features = ["static_secrets"] }zeroize.workspace = true[target.'cfg(not(target_arch = "wasm32"))'.dependencies]reqwest = { workspace = true, features = ["stream"] }bytes = "1.11.1"futures-core = "0.3.32"-tokio = { version = "1", features = ["time"] }+tokio = { workspace = true, features = ["time"] }[target.'cfg(target_arch = "wasm32")'.dependencies]gloo-timers = { version = "0.3.0", features = ["futures"] }[dev-dependencies]-tokio = { version = "1", features = ["rt-multi-thread", "macros"] }+tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }mockito.workspace = truediff --git a/rust/crates/ensu/Cargo.toml b/rust/crates/ensu/Cargo.tomlindex beb23708bd..1f0501288f 100644--- a/rust/crates/ensu/Cargo.toml+++ b/rust/crates/ensu/Cargo.toml@@ -8,22 +8,22 @@ ente-core.workspace = trueente-ensu-crypto.workspace = trueente-image.workspace = truememmap2 = "0.9.9"-regex = { version = "1", optional = true }-rubato = { version = "0.16", optional = true }-rusqlite = { version = "0.38", features = ["bundled"], optional = true }-self_cell = "1"+regex = { workspace = true, optional = true }+rubato = { version = "0.16.0", optional = true }+rusqlite = { workspace = true, default-features = true, optional = true }+self_cell = "1.0.0"serde.workspace = trueserde_json.workspace = truethiserror.workspace = true-tokio = { version = "1", features = ["rt", "time"] }+tokio = { workspace = true, features = ["rt", "time"] }transcribe-rs = { git = "https://github.com/cjpais/transcribe-rs.git", rev = "efc66111d519a434e28d51d94740008a7ce29360", default-features = false, features = ["onnx", "vad-silero"], optional = true }url.workspace = true-uuid = { version = "1", features = ["v4", "rng-getrandom"] }+uuid = { workspace = true, features = ["v4", "rng-getrandom"] }zeroize.workspace = truezstd = "0.13.3"[dev-dependencies]-tempfile = "3.27.0"+tempfile.workspace = true# Keep `mtmd` on every platform for multimodal support.# macOS disables OpenMP because Apple's clang lacks libomp. llama.cpp uses itsdiff --git a/rust/crates/image/Cargo.toml b/rust/crates/image/Cargo.tomlindex 1951c8f7fe..819dfbc518 100644--- a/rust/crates/image/Cargo.toml+++ b/rust/crates/image/Cargo.toml@@ -6,8 +6,8 @@ edition = "2024"ente_heic = { package = "heic_decoder", git = "https://github.com/ente/heic-decoder.git", rev = "2017f4ddaf91017483f6eb71500f520fba47391a", features = ["image-integration",] }-fast_image_resize = { version = "5.5.0", features = ["image"] }-image = { version = "0.25.10", default-features = true }+fast_image_resize.workspace = true+image.workspace = truejxl-oxide = { version = "0.12.6", features = ["image"] }kamadak-exif = "0.6.1"moxcms = { version = "0.8.1", features = ["in_place"] }diff --git a/rust/crates/legacy/Cargo.toml b/rust/crates/legacy/Cargo.tomlindex 00c4512d99..d5c8a2772d 100644--- a/rust/crates/legacy/Cargo.toml+++ b/rust/crates/legacy/Cargo.toml@@ -9,4 +9,4 @@ serde.workspace = trueserde_json.workspace = truesha2.workspace = truethiserror.workspace = true-uuid = { version = "1", features = ["v4", "js"] }+uuid = { workspace = true, features = ["v4", "js"] }diff --git a/rust/crates/location-dataset/Cargo.toml b/rust/crates/location-dataset/Cargo.tomlindex a71cd3deae..5fc115e763 100644--- a/rust/crates/location-dataset/Cargo.toml+++ b/rust/crates/location-dataset/Cargo.toml@@ -7,8 +7,8 @@ publish = falseente-location.workspace = truegeo = { version = "0.33.1", default-features = false }reqwest = { workspace = true, features = ["blocking", "rustls-tls-webpki-roots"] }-rusqlite = { version = "0.38", default-features = false, features = ["bundled"] }+rusqlite.workspace = truesha2.workspace = trueshapefile = { version = "0.9.0", features = ["geo-types"] }thiserror.workspace = true-zip = { version = "8.6.0", default-features = false, features = ["deflate-flate2-zlib-rs"] }+zip.workspace = truediff --git a/rust/crates/ml/Cargo.toml b/rust/crates/ml/Cargo.tomlindex 63838602f8..8aa713f6f0 100644--- a/rust/crates/ml/Cargo.toml+++ b/rust/crates/ml/Cargo.toml@@ -10,17 +10,17 @@ usearch = ["dep:usearch"][dependencies]ente-assets.workspace = trueente-image.workspace = true-fast_image_resize = { version = "5.5.0", features = ["image", "rayon"] }-half = "2.1"+fast_image_resize = { workspace = true, features = ["rayon"] }+half = "2.1.0"html-escape = "0.2.13"-image = { version = "0.25.5", default-features = true }+image.workspace = trueimageproc = "0.25.0"log.workspace = truenalgebra = "0.33.2"once_cell = "1.20.2"plsfix = "0.1.8"rayon = "1.12.0"-regex = "1.11.1"+regex.workspace = truethiserror.workspace = true# The FRB photos bridge calls the SimSIMD symbol exported by usearch 2.21.x.# Newer usearch releases switched that implementation to numkong symbols.@@ -37,7 +37,7 @@ ort = { workspace = true, features = [] }[target.'cfg(target_os = "android")'.dependencies]-ash = { version = "0.38", default-features = false, features = ["loaded"] }+ash = { version = "0.38.0", default-features = false, features = ["loaded"] }ort = { workspace = true, features = ["ndarray","half",@@ -78,11 +78,11 @@ ort = { workspace = true, features = [] }[dev-dependencies]-anyhow = "1"-flate2 = "1.1"-serde = { version = "1", features = ["derive"] }+anyhow = "1.0.0"+flate2.workspace = true+serde.workspace = trueserde_json.workspace = true-tar = "0.4"-tempfile = "3.12"-tokio = { version = "1", features = ["macros", "rt"] }+tar.workspace = true+tempfile.workspace = true+tokio = { workspace = true, features = ["macros", "rt"] }url.workspace = truediff --git a/rust/crates/paste/Cargo.toml b/rust/crates/paste/Cargo.tomlindex 0dfdf8dd7d..0a300e6bf0 100644--- a/rust/crates/paste/Cargo.toml+++ b/rust/crates/paste/Cargo.toml@@ -11,4 +11,4 @@ url.workspace = true[dev-dependencies]mockito.workspace = trueserde_json.workspace = true-tokio = { version = "1", features = ["macros", "rt-multi-thread"] }+tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }diff --git a/rust/crates/photos/Cargo.toml b/rust/crates/photos/Cargo.tomlindex 8894cada50..060e93d86f 100644--- a/rust/crates/photos/Cargo.toml+++ b/rust/crates/photos/Cargo.toml@@ -5,8 +5,8 @@ edition = "2024"[dependencies]ente-assets.workspace = trueente-location.workspace = true-quick-xml = "0.41"+quick-xml = "0.41.0"thiserror.workspace = true[dev-dependencies]-tempfile = "3.12"+tempfile.workspace = truediff --git a/rust/crates/space/Cargo.toml b/rust/crates/space/Cargo.tomlindex 7bbb537f95..f0d38a9d7d 100644--- a/rust/crates/space/Cargo.toml+++ b/rust/crates/space/Cargo.toml@@ -8,7 +8,7 @@ museum = [][dependencies]ente-core.workspace = true-futures-util = "0.3.32"+futures-util.workspace = truelog.workspace = truemd-5.workspace = trueserde.workspace = true@@ -22,5 +22,5 @@ ente-accounts.workspace = trueente-test-support.workspace = truemockito.workspace = truereqwest = { workspace = true, features = ["json"] }-tokio = { version = "1", features = ["macros", "rt-multi-thread"] }-uuid = { version = "1.11", features = ["v4"] }+tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }+uuid = { workspace = true, features = ["v4"] }diff --git a/rust/crates/test-support/Cargo.toml b/rust/crates/test-support/Cargo.tomlindex ab802f5a4f..998397343f 100644--- a/rust/crates/test-support/Cargo.toml+++ b/rust/crates/test-support/Cargo.toml@@ -5,7 +5,7 @@ description = "Runs a local Museum backed by a temporary Postgres for integratiopublish = false[dependencies]-dirs = "5.0.1"+dirs.workspace = truepostgresql_embedded = { version = "0.20.4", default-features = false, features = ["blocking", "rustls", "theseus"] }-tokio = { version = "1", features = ["rt-multi-thread"] }-uuid = { version = "1.23.1", features = ["v4"] }+tokio = { workspace = true, features = ["rt-multi-thread"] }+uuid = { workspace = true, features = ["v4"] }diff --git a/rust/scripts/cargo-versions/check.py b/rust/scripts/cargo-versions/check.pynew file mode 100644index 0000000000..9d9a354c73--- /dev/null+++ b/rust/scripts/cargo-versions/check.py@@ -0,0 +1,63 @@+import re+import subprocess+import sys+import tomllib+from pathlib import Path++root = Path(sys.argv[1]).resolve()+sections = "dependencies", "dev-dependencies", "build-dependencies"+complete = re.compile(+ r"(?:\^|~|=|>=|>|<=|<)?\s*[0-9]+\.[0-9]+\.[0-9]+"+ r"(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?"+ r"(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?"+)+manifest_paths = subprocess.check_output(+ [+ "git",+ "ls-files",+ "--cached",+ "--others",+ "--exclude-standard",+ "-z",+ "--",+ "rust/Cargo.toml",+ "rust/**/Cargo.toml",+ ],+ cwd=root,+ text=True,+).split("\0")+manifests = sorted(+ root / path for path in manifest_paths if path and (root / path).is_file()+)+if not manifests:+ raise SystemExit(f"{root}/rust: found no Cargo manifests")+failed = False++for manifest in manifests:+ path = manifest.relative_to(root).as_posix()+ cargo = tomllib.loads(manifest.read_text())+ tables = [(section, cargo.get(section, {})) for section in sections]+ tables += [+ (f"target.{target}.{section}", config.get(section, {}))+ for target, config in cargo.get("target", {}).items()+ for section in sections+ ]+ tables.append(+ ("workspace.dependencies", cargo.get("workspace", {}).get("dependencies", {}))+ )+ for table, dependencies in tables:+ for name, declaration in dependencies.items():+ requirement = (+ declaration if isinstance(declaration, str) else declaration.get("version")+ )+ if requirement is None:+ continue+ if all(complete.fullmatch(part.strip()) for part in requirement.split(",")):+ continue+ print(+ f"{path}: {table}.{name} has incomplete version requirement {requirement!r}",+ file=sys.stderr,+ )+ failed = True++sys.exit(1 if failed else 0)diff --git a/rust/scripts/cargo-versions/test.py b/rust/scripts/cargo-versions/test.pynew file mode 100644index 0000000000..e435a77b47--- /dev/null+++ b/rust/scripts/cargo-versions/test.py@@ -0,0 +1,129 @@+import subprocess+import sys+import tempfile+from pathlib import Path++check = Path(__file__).with_name("check.py")+++def run(current, added=None, ignored=None, deleted=False):+ with tempfile.TemporaryDirectory() as directory:+ root = Path(directory)+ subprocess.run(["git", "init", "-q"], cwd=root, check=True)+ manifest = root / "rust/app/Cargo.toml"+ if current is None:+ (root / ".gitignore").write_text("")+ else:+ manifest.parent.mkdir(parents=True)+ manifest.write_text(current)+ if ignored:+ (root / ".gitignore").write_text("/rust/target/\n")+ subprocess.run(["git", "add", "."], cwd=root, check=True)+ if deleted:+ manifest.unlink()+ if added:+ new_manifest = root / "rust/new/Cargo.toml"+ new_manifest.parent.mkdir()+ new_manifest.write_text(added)+ if ignored:+ ignored_manifest = root / "rust/target/package/generated/Cargo.toml"+ ignored_manifest.parent.mkdir(parents=True)+ ignored_manifest.write_text(ignored)+ return subprocess.run(+ [sys.executable, check, root],+ capture_output=True,+ text=True,+ )+++failing = """\+[package]+name = "fixture"+version = "0.1.0"++[dependencies]+legacy = "1.2"+metadata = { version = "2", features = ["new"] }+changed = "3.5"+substring = "1.2.3.4"+wildcard = "1.2.*"+incomplete_range = ">=1.2.3, <2"+complete = "1.2.3"+range = ">=1.2.3, <2.0.0"+prerelease = "^3.4.5-alpha.1+build.2"+local = { path = "../local" }++[dev-dependencies]+dev = "4.5"++[build-dependencies]+build = { version = "5" }++[target.'cfg(unix)'.dependencies]+target = "6.7"++[target.'cfg(unix)'.dev-dependencies]+target_dev = "7"++[target.'cfg(unix)'.build-dependencies]+target_build = "8.9"++[workspace.dependencies]+workspace = "9"+"""+result = run(failing, '[dependencies]\nnew_manifest = "10.11"\n')+assert result.returncode == 1, result.stderr+for dependency in (+ "dependencies.legacy",+ "dependencies.metadata",+ "dependencies.changed",+ "dependencies.substring",+ "dependencies.wildcard",+ "dependencies.incomplete_range",+ "dev-dependencies.dev",+ "build-dependencies.build",+ "target.cfg(unix).dependencies.target",+ "target.cfg(unix).dev-dependencies.target_dev",+ "target.cfg(unix).build-dependencies.target_build",+ "workspace.dependencies.workspace",+ "dependencies.new_manifest",+):+ assert f": {dependency} has" in result.stderr, (dependency, result.stderr)+for dependency in (+ "dependencies.complete",+ "dependencies.range",+ "dependencies.prerelease",+ "dependencies.local",+):+ assert f": {dependency} has" not in result.stderr, (dependency, result.stderr)++passing = """\+[package]+name = "fixture"+version = "0.1.0"++[dependencies]+legacy = "1.2.0"+metadata = { version = "2.0.0", features = ["new"] }+changed = "3.4.5"+complete = "1.2.3"+range = ">=1.2.3, <2.0.0"+prerelease = "^3.4.5-alpha.1+build.2"+local = { path = "../local" }++[workspace.dependencies]+workspace = "9.0.0"+"""+result = run(passing, '[target.\'cfg(unix)\'.dependencies]\nnew_manifest = "10.11.12"\n')+assert result.returncode == 0, result.stderr+assert not result.stdout+assert not result.stderr++assert run("[dependencies\nbroken = '1.2.3'\n").returncode != 0+result = run(None)+assert result.returncode != 0+assert "found no Cargo manifests" in result.stderr+result = run(passing, ignored='[dependencies]\ngenerated = "1"\n')+assert result.returncode == 0, result.stderr+result = run(failing, added=passing, deleted=True)+assert result.returncode == 0, result.stderrdiff --git a/rust/scripts/cargo-workspace-dependencies/check.py b/rust/scripts/cargo-workspace-dependencies/check.pynew file mode 100644index 0000000000..57469fc515--- /dev/null+++ b/rust/scripts/cargo-workspace-dependencies/check.py@@ -0,0 +1,60 @@+import json+import subprocess+import sys+import tomllib+from pathlib import Path++root = Path(sys.argv[1]).resolve()+sections = "dependencies", "dev-dependencies", "build-dependencies"+metadata = json.loads(+ subprocess.check_output(+ [+ "cargo",+ "metadata",+ "--no-deps",+ "--format-version",+ "1",+ "--locked",+ "--offline",+ ],+ cwd=root / "rust",+ text=True,+ )+)+packages = [+ package for package in metadata["packages"]+ if package["id"] in metadata["workspace_members"]+]+users = {}+for package in packages:+ for dependency in package["dependencies"]:+ users.setdefault(dependency["name"], set()).add(package["id"])++failed = False++for package in packages:+ manifest = Path(package["manifest_path"])+ path = manifest.relative_to(root).as_posix()+ cargo = tomllib.loads(manifest.read_text())+ tables = [(section, cargo.get(section, {})) for section in sections]+ tables += [+ (f"target.{target}.{section}", config.get(section, {}))+ for target, config in cargo.get("target", {}).items()+ for section in sections+ ]+ for table, dependencies in tables:+ for name, declaration in dependencies.items():+ if isinstance(declaration, dict) and declaration.get("workspace") is True:+ continue+ dependency = (+ declaration.get("package", name) if isinstance(declaration, dict) else name+ )+ if len(users[dependency]) < 2:+ continue+ print(+ f"{path}: {table}.{name} duplicates shared dependency {dependency!r}; use workspace = true",+ file=sys.stderr,+ )+ failed = True++sys.exit(1 if failed else 0)diff --git a/rust/scripts/cargo-workspace-dependencies/test.py b/rust/scripts/cargo-workspace-dependencies/test.pynew file mode 100644index 0000000000..9b4b65313e--- /dev/null+++ b/rust/scripts/cargo-workspace-dependencies/test.py@@ -0,0 +1,92 @@+import subprocess+import sys+import tempfile+from pathlib import Path++check = Path(__file__).with_name("check.py")+workspace = """\+[workspace]+members = ["app-*"]+exclude = ["app-excluded"]+resolver = "2"++[workspace.dependencies]+shared = { path = "shared" }+serde = "1.0.0"+"""+package = """\+[package]+name = "{}"+version = "0.1.0"+edition = "2024"+"""+++def run(app_b):+ with tempfile.TemporaryDirectory() as directory:+ root = Path(directory)+ rust = root / "rust"+ write(rust / "Cargo.toml", workspace)+ write(+ rust / "app-a/Cargo.toml",+ package.format("app-a")+ + "\n[dependencies]\nshared.workspace = true\nserde.workspace = true\n",+ )+ write(rust / "app-b/Cargo.toml", package.format("app-b") + app_b)+ write(+ rust / "app-excluded/Cargo.toml",+ package.format("app-excluded")+ + '\n[dependencies]\nsolo = { path = "../solo" }\n',+ )+ write(rust / "shared/Cargo.toml", package.format("shared"))+ write(rust / "solo/Cargo.toml", package.format("solo"))+ return subprocess.run(+ [sys.executable, check, root],+ capture_output=True,+ text=True,+ )+++def write(path, content):+ path.parent.mkdir(parents=True, exist_ok=True)+ path.write_text(content)+ if path.name == "Cargo.toml" and path.parent.name != "rust":+ source = path.parent / "src/lib.rs"+ source.parent.mkdir(exist_ok=True)+ source.write_text("")+++result = run('\n[dependencies]\nshared = { path = "../shared" }\n')+assert result.returncode == 1, result.stderr+assert "dependencies.shared duplicates shared dependency 'shared'" in result.stderr++result = run("\n[dependencies]\nshared.workspace = true\n")+assert result.returncode == 0, result.stderr+assert not result.stdout+assert not result.stderr++result = run(+ '\n[target.\'cfg(unix)\'.dev-dependencies]\nlocal = { package = "shared", path = "../shared" }\n'+)+assert result.returncode == 1, result.stderr+assert "target.cfg(unix).dev-dependencies.local" in result.stderr++result = run('''+[dependencies]+solo = { path = "../solo" }+[dev-dependencies]+solo = { path = "../solo" }+''')+assert result.returncode == 0, result.stderr+assert not result.stdout+assert not result.stderr++result = run('''+[target.'cfg(unix)'.dependencies]+dep = { package = "serde", version = "1.0.0" }+[target.'cfg(windows)'.dependencies]+dep = { package = "tokio", version = "1.0.0" }+''')+assert result.returncode == 1, result.stderr+assert "target.cfg(unix).dependencies.dep duplicates shared dependency 'serde'" in result.stderr+assert "target.cfg(windows)" not in result.stderrdiff --git a/rust/scripts/lint.sh b/rust/scripts/lint.shnew file mode 100755index 0000000000..ca0fc2494f--- /dev/null+++ b/rust/scripts/lint.sh@@ -0,0 +1,13 @@+#!/usr/bin/env bash+set -euo pipefail++cd "$(dirname "$0")/.."+export RUSTFLAGS="-D warnings"++python3 scripts/cargo-versions/check.py ..+python3 scripts/cargo-versions/test.py+python3 scripts/cargo-workspace-dependencies/check.py ..+python3 scripts/cargo-workspace-dependencies/test.py+cargo fmt --check+cargo clippy --locked --all-targets --features museum,ente-ml/ml-assets+cargo audit