Skip to content

Commit

Permalink
Release/v1.0.2 (#73)
Browse files Browse the repository at this point in the history
* Fixing the validation for uploading chunked data, making the validation step more loose in order to accomodate encryption overhead

* updating dependencies

* removing wee_alloc from dependencies

* fix clippy

* fixing clippy errors
  • Loading branch information
htunlogic authored Oct 18, 2023
1 parent 071ee6a commit a3f7108
Show file tree
Hide file tree
Showing 18 changed files with 2,127 additions and 2,010 deletions.
484 changes: 39 additions & 445 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/src/data/invitations/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Validation for Create {
vec![
rule_required!(email),
rule_email!(email),
rule_in!(role, vec!["admin".to_string()]),
rule_in!(role, Into::<Vec<String>>::into(["admin".to_string()])),
Rule::new("quota", |obj: &Self, error| {
if let Some(v) = obj.quota {
if v < MAX_CHUNK_SIZE_BYTES as i64 {
Expand Down
2 changes: 1 addition & 1 deletion admin/src/data/invitations/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl Validation for Search {
fn rules(&self) -> Vec<Rule<Self>> {
vec![rule_in!(
order,
vec!["asc".to_string(), "desc".to_string(),]
Into::<Vec<String>>::into(["asc".to_string(), "desc".to_string()])
)]
}

Expand Down
2 changes: 1 addition & 1 deletion admin/src/data/sessions/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Validation for Search {
fn rules(&self) -> Vec<Rule<Self>> {
vec![rule_in!(
order,
vec!["asc".to_string(), "desc".to_string(),]
Into::<Vec<String>>::into(["asc".to_string(), "desc".to_string()])
)]
}

Expand Down
2 changes: 1 addition & 1 deletion admin/src/data/users/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl Validation for Search {
fn rules(&self) -> Vec<Rule<Self>> {
vec![rule_in!(
order,
vec!["asc".to_string(), "desc".to_string(),]
Into::<Vec<String>>::into(["asc".to_string(), "desc".to_string()])
)]
}

Expand Down
2 changes: 1 addition & 1 deletion admin/src/data/users/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl Validation for Update {
fn rules(&self) -> Vec<Rule<Self>> {
vec![rule_in!(
role,
vec!["admin".to_string(), "user".to_string()]
Into::<Vec<String>>::into(["admin".to_string(), "user".to_string()])
)]
}
}
2 changes: 1 addition & 1 deletion auth/src/data/activity_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Validation for ActivityQuery {
fn rules(&self) -> Vec<Rule<Self>> {
vec![rule_in!(
order,
vec!["asc".to_string(), "desc".to_string(),]
Into::<Vec<String>>::into(["asc".to_string(), "desc".to_string()])
)]
}

Expand Down
7 changes: 1 addition & 6 deletions cryptfns/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cryptfns"
version = "1.0.0"
version = "1.0.1"
edition = "2021"
authors = ["Tibor Hudik <[email protected]>"]
license-file = "../LICENSE.md"
Expand Down Expand Up @@ -40,11 +40,6 @@ chacha20poly1305 = "0.10.1"
# code size when deploying.
console_error_panic_hook = { version = "0.1.6", optional = true }

# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
wee_alloc = { version = "0.4.5", optional = true }

[dependencies.num-traits]
version = "0.2.9"
features = ["libm"]
Expand Down
6 changes: 0 additions & 6 deletions cryptfns/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ use crate::rsa::PublicKeyParts;

use wasm_bindgen::prelude::*;

// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[wasm_bindgen]
pub fn crc16_digest(input: Vec<u8>) -> String {
crate::utils::set_panic_hook();
Expand Down
2 changes: 1 addition & 1 deletion entity/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub async fn create_session<T: super::ConnectionTrait>(
user_agent: ActiveValue::Set(
user_agent
.map(|user_agent| user_agent.to_string())
.unwrap_or_else(|| "".to_string()),
.unwrap_or_default(),
),
device_id: ActiveValue::Set(Uuid::new_v4()),
ip: ActiveValue::Set(
Expand Down
3 changes: 1 addition & 2 deletions error/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "error"
version = "1.0.0"
version = "1.0.1"
edition = "2021"
authors = ["Tibor Hudik <[email protected]>"]
readme = "README.md"
Expand All @@ -24,7 +24,6 @@ validr = "^0.3"
actix-multipart = "^0.6"
actix-web = "^4"
rsa = "^0.8"
sequoia-openpgp = "^1"
base64 = "^0.21"
hex = "^0.4"
jsonwebtoken = "^8"
Expand Down
13 changes: 0 additions & 13 deletions error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use sea_orm::{
error::{ColumnFromStrErr, DbErr, RuntimeErr},
TransactionError,
};
use sequoia_openpgp::Error as PGPError;
use serde::Serialize;
use serde_json::Error as SerdeJsonError;
use std::io::Error as IoError;
Expand All @@ -42,7 +41,6 @@ pub enum Error {
Base64DecodeError(DecodeError),
HexDecodeError(FromHexError),
FromUtf8Error(FromUtf8Error),
PGPError(PGPError),
JWTError(JWTError),
ReqwestError(ReqwestError),
StorageError(String),
Expand Down Expand Up @@ -170,12 +168,6 @@ impl From<FromUtf8Error> for Error {
}
}

impl From<PGPError> for Error {
fn from(source: PGPError) -> Error {
Error::PGPError(source)
}
}

impl From<JWTError> for Error {
fn from(source: JWTError) -> Error {
Error::JWTError(source)
Expand Down Expand Up @@ -342,11 +334,6 @@ impl From<&Error> for ErrorResponse {
message: message.to_string(),
context: None,
},
Error::PGPError(message) => ErrorResponse {
status: 500,
message: message.to_string(),
context: None,
},
Error::JWTError(message) => ErrorResponse {
status: 401,
message: message.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion hoodik/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hoodik"
version = "1.0.1"
version = "1.0.2"
edition = "2021"
authors = ["Tibor Hudik <[email protected]>"]
readme = "../README.md"
Expand Down
2 changes: 1 addition & 1 deletion storage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "storage"
version = "1.0.0"
version = "1.0.1"
edition = "2021"
authors = ["Tibor Hudik <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion storage/src/data/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Validation for Meta {
// rule_required!(checksum),
rule_in!(
checksum_function,
vec!["crc16".to_string(), "sha256".to_string()]
Into::<Vec<String>>::into(["crc16".to_string(), "sha256".to_string()])
),
Rule::new("chunk", |obj: &Self, error| {
if let Some(v) = obj.chunk {
Expand Down
8 changes: 3 additions & 5 deletions storage/src/routes/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,11 @@ fn validate_chunk_size(file: &AppFile, chunk: i64, data_len: usize) -> AppResult
return Ok(());
}

let max_size = chunk_size + chunk_size * 0.01;
let max_size = chunk_size + chunk_size * 0.05;

if data_len as f32 > max_size {
let error = format!(
"chunk_size_mismatch: expected max {}, but received {}",
chunk_size, data_len
);
let error =
format!("chunk_size_mismatch: expected max {max_size}, but received {data_len}",);

return Err(Error::as_validation("chunk", &error));
}
Expand Down
4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hoodik/web",
"license": "CC BY-NC 4.0",
"version": "0.0.0",
"version": "1.0.1",
"private": true,
"scripts": {
"dev": "vite",
Expand Down Expand Up @@ -94,4 +94,4 @@
"vue-tsc": "^1.2.0",
"webdriverio": "^8.9.0"
}
}
}
Loading

0 comments on commit a3f7108

Please sign in to comment.