mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-08-07 23:47:57 +03:00
Trusted proxy support, unauthenticated rate limit & other fixes (#7472)
* Trusted proxies, unauthenticated rate limits and various fixes * Fix get_groups_data * Fix get_groups_data when not using full_access * Fmt * Fix org import * deduplicate send validation
This commit is contained in:
+5
-14
@@ -85,18 +85,8 @@ impl SendTokens {
|
||||
return Self::invalid_error(&format!("Send {send_id}, max access reached"), "send_id_invalid", true);
|
||||
}
|
||||
|
||||
if let Some(expiration) = send.expiration_date
|
||||
&& Utc::now().naive_utc() >= expiration
|
||||
{
|
||||
return Self::invalid_error(&format!("Send {send_id}, expired"), "send_id_invalid", true);
|
||||
}
|
||||
|
||||
if Utc::now().naive_utc() >= send.deletion_date {
|
||||
return Self::invalid_error(&format!("Send {send_id}, past deletion"), "send_id_invalid", true);
|
||||
}
|
||||
|
||||
if send.disabled {
|
||||
return Self::invalid_error(&format!("Send {send_id}, disabled"), "send_id_invalid", true);
|
||||
if !send.is_accessible() {
|
||||
return Self::invalid_error(&format!("Send {send_id}, not accessible"), "send_id_invalid", true);
|
||||
}
|
||||
|
||||
if send.password_hash.is_some() {
|
||||
@@ -113,8 +103,9 @@ impl SendTokens {
|
||||
}
|
||||
}
|
||||
|
||||
send.access_count += 1;
|
||||
send.save(conn).await?;
|
||||
if !send.register_access(conn).await? {
|
||||
return Self::invalid_error(&format!("Send {send_id}, max access reached"), "send_id_invalid", true);
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
access_claims: generate_send_access_claims(&send_id),
|
||||
|
||||
Reference in New Issue
Block a user