mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-08-11 21:49:07 +00:00
Update Rust and Crates
- Updated Rust to v1.72.0 - Updated all the crates Including a CVE https://github.com/dani-garcia/vaultwarden/security/dependabot/21 - Updated GitHub Workflows - Run `cargo fmt` which has some new fmt's - Moved from `rust-toolchain` to `rust-toolchain.toml`
This commit is contained in:
parent
66bff73ebf
commit
32543c46da
29 changed files with 219 additions and 212 deletions
|
@ -340,9 +340,13 @@ async fn post_send_file_v2_data(
|
|||
|
||||
let mut data = data.into_inner();
|
||||
|
||||
let Some(send) = Send::find_by_uuid(send_uuid, &mut conn).await else { err!("Send not found. Unable to save the file.") };
|
||||
let Some(send) = Send::find_by_uuid(send_uuid, &mut conn).await else {
|
||||
err!("Send not found. Unable to save the file.")
|
||||
};
|
||||
|
||||
let Some(send_user_id) = &send.user_uuid else {err!("Sends are only supported for users at the moment")};
|
||||
let Some(send_user_id) = &send.user_uuid else {
|
||||
err!("Sends are only supported for users at the moment")
|
||||
};
|
||||
if send_user_id != &headers.user.uuid {
|
||||
err!("Send doesn't belong to user");
|
||||
}
|
||||
|
|
|
@ -685,7 +685,9 @@ async fn download_icon(domain: &str) -> Result<(Bytes, Option<&str>), Error> {
|
|||
|
||||
for icon in icon_result.iconlist.iter().take(5) {
|
||||
if icon.href.starts_with("data:image") {
|
||||
let Ok(datauri) = DataUrl::process(&icon.href) else {continue};
|
||||
let Ok(datauri) = DataUrl::process(&icon.href) else {
|
||||
continue;
|
||||
};
|
||||
// Check if we are able to decode the data uri
|
||||
let mut body = BytesMut::new();
|
||||
match datauri.decode::<_, ()>(|bytes| {
|
||||
|
|
|
@ -124,7 +124,9 @@ fn websockets_hub<'r>(
|
|||
err_code!("Invalid claim", 401)
|
||||
};
|
||||
|
||||
let Ok(claims) = crate::auth::decode_login(&token) else { err_code!("Invalid token", 401) };
|
||||
let Ok(claims) = crate::auth::decode_login(&token) else {
|
||||
err_code!("Invalid token", 401)
|
||||
};
|
||||
|
||||
let (mut rx, guard) = {
|
||||
let users = Arc::clone(&WS_USERS);
|
||||
|
|
|
@ -100,7 +100,9 @@ async fn web_files(p: PathBuf) -> Cached<Option<NamedFile>> {
|
|||
|
||||
#[get("/attachments/<uuid>/<file_id>?<token>")]
|
||||
async fn attachments(uuid: SafeString, file_id: SafeString, token: String) -> Option<NamedFile> {
|
||||
let Ok(claims) = decode_file_download(&token) else { return None };
|
||||
let Ok(claims) = decode_file_download(&token) else {
|
||||
return None;
|
||||
};
|
||||
if claims.sub != *uuid || claims.file_id != *file_id {
|
||||
return None;
|
||||
}
|
||||
|
|
|
@ -501,7 +501,7 @@ pub fn format_naive_datetime_local(dt: &NaiveDateTime, fmt: &str) -> String {
|
|||
///
|
||||
/// https://httpwg.org/specs/rfc7231.html#http.date
|
||||
pub fn format_datetime_http(dt: &DateTime<Local>) -> String {
|
||||
let expiry_time: chrono::DateTime<chrono::Utc> = chrono::DateTime::from_utc(dt.naive_utc(), chrono::Utc);
|
||||
let expiry_time = DateTime::<chrono::Utc>::from_naive_utc_and_offset(dt.naive_utc(), chrono::Utc);
|
||||
|
||||
// HACK: HTTP expects the date to always be GMT (UTC) rather than giving an
|
||||
// offset (which would always be 0 in UTC anyway)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue