Summary
resp.text().await reads the entire HTTP response body into memory with no size limit, allowing a server to cause OOM by returning a multi-gigabyte response.
Location
- File:
src/fetchers/client.rs
- Line(s): 120
Severity
Medium
Details
let body_text = resp.text().await.unwrap_or_default();
There is no Content-Length check or maximum body size configured. A server returning a multi-gigabyte response would exhaust available RAM.
Suggested Fix
Add a size guard before reading:
const MAX_BODY: u64 = 50 * 1024 * 1024; // 50 MB
if let Some(len) = resp.content_length() {
if len > MAX_BODY {
return Err(FetcherError::RequestFailed("response too large".into()));
}
}
let body_text = resp.text().await.unwrap_or_default();
Automated finding by repo-monitor
Summary
resp.text().awaitreads the entire HTTP response body into memory with no size limit, allowing a server to cause OOM by returning a multi-gigabyte response.Location
src/fetchers/client.rsSeverity
Medium
Details
There is no
Content-Lengthcheck or maximum body size configured. A server returning a multi-gigabyte response would exhaust available RAM.Suggested Fix
Add a size guard before reading:
Automated finding by repo-monitor