Skip to content

feat(http): Implement HTTP request body size limit middleware#105

Merged
allisson merged 18 commits intomainfrom
body-size-limit
Mar 5, 2026
Merged

feat(http): Implement HTTP request body size limit middleware#105
allisson merged 18 commits intomainfrom
body-size-limit

Conversation

@allisson
Copy link
Owner

@allisson allisson commented Mar 5, 2026

Add a global middleware to limit the size of incoming request bodies,
improving system resilience against Denial-of-Service (DoS) attacks.

Changes:

  • Add MaxRequestBodySize configuration (default 1MB) via MAX_REQUEST_BODY_SIZE environment variable.
  • Implement MaxRequestBodySizeMiddleware in internal/http using http.MaxBytesReader.
  • Wrap request body to intercept http.MaxBytesError and return 413 Payload Too Large.
  • Integrate the middleware into the global Gin router in SetupRouter.
  • Update integration test helpers to include the new limit in test configurations.
  • Document the new security feature in conductor/tech-stack.md.

allisson added 18 commits March 5, 2026 11:18
Add a global middleware to limit the size of incoming request bodies,
improving system resilience against Denial-of-Service (DoS) attacks.

Changes:
- Add MaxRequestBodySize configuration (default 1MB) via MAX_REQUEST_BODY_SIZE environment variable.
- Implement MaxRequestBodySizeMiddleware in internal/http using http.MaxBytesReader.
- Wrap request body to intercept http.MaxBytesError and return 413 Payload Too Large.
- Integrate the middleware into the global Gin router in SetupRouter.
- Update integration test helpers to include the new limit in test configurations.
- Document the new security feature in conductor/tech-stack.md.
@allisson allisson merged commit ffe9896 into main Mar 5, 2026
3 checks passed
@allisson allisson deleted the body-size-limit branch March 5, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant