Skip to content

Commit

Permalink
Limit HTTP request bodies to 1 MiB
Browse files Browse the repository at this point in the history
This stops the RPC server from allocating arbitrary amounts of memory,
leading to out of memory crashes.

Fixes nimiq/core-rs-albatross#2749.
  • Loading branch information
hrxi committed Jul 22, 2024
1 parent 0a4abc1 commit cc98d91
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ impl<D: Dispatcher> Server<D> {
let inner = Arc::clone(&self.inner);
let post_route = warp::path::end()
.and(warp::post())
.and(warp::body::content_length_limit(1024 * 1024))
.and(warp::body::bytes())
.and_then(move |body: Bytes| {
let inner = Arc::clone(&inner);
Expand Down

0 comments on commit cc98d91

Please sign in to comment.