No request body size limit on API and webhook servers #59

Closed
opened 2026-03-30 13:28:53 +00:00 by sharang · 1 comment
Owner

Neither the API server nor webhook server has a body size limit. Attackers can POST arbitrarily large payloads causing OOM. Fix: Add DefaultBodyLimit (2MB API, 64KB webhooks).

Neither the API server nor webhook server has a body size limit. Attackers can POST arbitrarily large payloads causing OOM. Fix: Add DefaultBodyLimit (2MB API, 64KB webhooks).
sharang added the infrastructuresecurityv0.3.0critical labels 2026-03-30 13:28:53 +00:00
Author
Owner

Covered on main. axum applies a 2 MB DefaultBodyLimit to the Bytes/Json extractors by default, and every API and webhook handler reads its body through them (the webhook handlers take Bytes for the HMAC). Routes that need more set it explicitly: artifact upload and findings import (api/routes.rs) and Werkbank runner results (api/server.rs). A tighter webhook cap than 2 MB is not useful: Gitea push payloads with many commits exceed 64 KB.

Covered on main. axum applies a 2 MB `DefaultBodyLimit` to the `Bytes`/`Json` extractors by default, and every API and webhook handler reads its body through them (the webhook handlers take `Bytes` for the HMAC). Routes that need more set it explicitly: artifact upload and findings import (`api/routes.rs`) and Werkbank runner results (`api/server.rs`). A tighter webhook cap than 2 MB is not useful: Gitea push payloads with many commits exceed 64 KB.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#59