What
Add configurable body size limit on the Sentry envelope ingest endpoint to prevent DoS via oversized payloads.
Why
BMAD CTO finding (P0): The ingest endpoint currently has NO body size limit. An attacker can send arbitrarily large Sentry envelopes → memory exhaustion, storage exhaustion, DoS.
BMAD CLO finding: Sentry SDK clients can send payload bombs. Must enforce hard limits.
Changes
- Add
axum::extract::DefaultBodyLimit or Tower middleware to cap request body size
- Recommended limit: 1MB per event (aligns with Sentry's own limits)
- Make the limit configurable via
Config (env var TRAPFALL_MAX_BODY_SIZE)
- Return
413 Payload Too Large for oversized requests
- Add test: send oversized envelope → verify 413 response
Testing
- Unit test: oversized payload → 413
- Unit test: normal payload → 200/202
- Integration test: rapid fire many normal-sized events → no crash
What
Add configurable body size limit on the Sentry envelope ingest endpoint to prevent DoS via oversized payloads.
Why
BMAD CTO finding (P0): The ingest endpoint currently has NO body size limit. An attacker can send arbitrarily large Sentry envelopes → memory exhaustion, storage exhaustion, DoS.
BMAD CLO finding: Sentry SDK clients can send payload bombs. Must enforce hard limits.
Changes
axum::extract::DefaultBodyLimitor Tower middleware to cap request body sizeConfig(env varTRAPFALL_MAX_BODY_SIZE)413 Payload Too Largefor oversized requestsTesting