Skip to content

Commit fdfb7f6

Browse files
committed
Validate PATCH upload length against max size
1 parent 18a43aa commit fdfb7f6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎relay-server/src/endpoints/upload.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ async fn handle_patch(
219219
let location = SignedLocation::from_parts(project_id, key, length, signature);
220220

221221
let config = state.config();
222+
if length.is_some_and(|len| len > config.max_upload_size()) {
223+
return Err(StatusCode::PAYLOAD_TOO_LARGE.into());
224+
}
222225

223226
// There is no real "fast path" for streaming uploads. Always wait for the project config
224227
// to be loaded:

0 commit comments

Comments
 (0)