Skip to content

Commit 4de3754

Browse files
committed
enhanced share reliability
1 parent a93173c commit 4de3754

5 files changed

Lines changed: 24 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ name = "encrypted_upload_test"
7777
path = "examples/encrypted_upload_test.rs"
7878

7979
[workspace.package]
80-
version = "0.3.3"
80+
version = "0.3.4"
8181
edition = "2021"
8282
license = "MIT OR Apache-2.0"
8383
repository = "https://github.com/functionland/fula-api"

crates/fula-client/src/encryption.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6221,6 +6221,19 @@ impl EncryptedClient {
62216221
chunked_meta: &ChunkedFileMetadata,
62226222
dek: &fula_crypto::keys::DekKey,
62236223
) -> Result<Bytes> {
6224+
// Reject share tokens that claim implausible file sizes before attempting
6225+
// allocation. WASM's linear memory is bounded; a garbage total_size from a
6226+
// malformed token would otherwise surface as an opaque "memory access out
6227+
// of bounds" from __wbindgen_realloc instead of a clean error.
6228+
const MAX_CHUNKED_TOTAL_SIZE: u64 = 8 * 1024 * 1024 * 1024;
6229+
if chunked_meta.total_size > MAX_CHUNKED_TOTAL_SIZE {
6230+
return Err(ClientError::Encryption(fula_crypto::CryptoError::Decryption(
6231+
format!(
6232+
"chunked_meta.total_size {} exceeds maximum {}",
6233+
chunked_meta.total_size, MAX_CHUNKED_TOTAL_SIZE
6234+
),
6235+
)));
6236+
}
62246237
let mut output = Vec::with_capacity(chunked_meta.total_size as usize);
62256238
self.download_chunks_windowed_to_writer(bucket, storage_key, chunked_meta, dek, &mut output, None).await?;
62266239
Ok(Bytes::from(output))

packages/fula_client/ios/fula_client.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Pod::Spec.new do |s|
88
s.name = 'fula_client'
9-
s.version = '0.3.3'
9+
s.version = '0.3.4'
1010
s.summary = 'Flutter SDK for Fula decentralized storage'
1111
s.description = <<-DESC
1212
A Flutter plugin providing client-side encryption, metadata privacy,

packages/fula_client/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: fula_client
22
description: Flutter SDK for Fula decentralized storage with client-side encryption, metadata privacy, and secure sharing.
3-
version: 0.3.3
3+
version: 0.3.4
44
homepage: https://fx.land
55
repository: https://github.com/functionland/fula-api
66
issue_tracker: https://github.com/functionland/fula-api/issues

0 commit comments

Comments
 (0)