fix(dos): bound uploads, offload bcrypt, cap image decode, split queues
H3: re-enable a request-body limit (550MB, sized to the largest allowed video + multipart overhead) instead of DefaultBodyLimit::disable(), and drop the second full-file copy by keeping the upload as Bytes. H4: image decode now goes through ImageReader with explicit dimension (12000x12000) and allocation caps, rejecting decompression bombs before the expensive resize, and the whole spawn_blocking is wrapped in a 120s timeout mirroring the ffmpeg guard. H8: every bcrypt hash/verify (join, recover, admin_login, host PIN reset) now runs via spawn_blocking through a new services::password helper, so concurrent auths can't pin the async workers. M7: images and videos get independent compression permit pools, so slow videos can no longer starve image-preview generation. H5: add a generous per-IP daily account-creation cap (NAT-safe at ~100 guests) on top of the burst cap, and wire up the previously-dead upload_count_quota_* config as an event-wide file-count cap that a re-join cannot reset. Also bumps generated recovery PINs from 4 to 6 digits (part of M4). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -282,9 +282,8 @@ pub async fn reset_user_pin(
|
||||
}
|
||||
}
|
||||
|
||||
let pin: String = format!("{:04}", rand::rng().random_range(0..10000u32));
|
||||
let pin_hash =
|
||||
bcrypt::hash(&pin, 12).map_err(|e| AppError::Internal(anyhow::anyhow!(e)))?;
|
||||
let pin: String = format!("{:06}", rand::rng().random_range(0..1_000_000u32));
|
||||
let pin_hash = crate::services::password::hash(pin.clone(), 12).await?;
|
||||
|
||||
sqlx::query(
|
||||
"UPDATE \"user\"
|
||||
|
||||
Reference in New Issue
Block a user