Repository navigation
feat(backend): limit request body size - #625
Merged
Merged
Conversation
Cap request bodies at app.http.request.max-body-bytes (1 MiB): a larger Content-Length gets 413, and chunked bodies are cut off at the same size. Jackson additionally limits document length and token count via spring.jackson.factory.constraints.read.*. The largest expected request (50 000 relay IDs) is about 0.5 MiB. Document a matching body size limit for the reverse proxy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kp3fiqzW8RmvfihHmwk8Br
Member
Author
|
Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RequestBodyLimitConfig: a filter on all paths that caps request bodies atapp.http.request.max-body-bytes(default 1 MiB). A declaredContent-Lengthabove the limit gets413without the body being read. Bodies without a length (chunked) get413once they exceed the limit.application.yml: Jackson read constraints viaspring.jackson.factory.constraints.read.*. Document length is capped at the same size and the token count at 60 000. The largest expected request is 50 000 relay IDs, about 0.5 MiB.backend/README.md: new "Reverse proxy" section recommending a matching body size limit (e.g. nginxclient_max_body_size 1m;).THREAT_MODEL.md: lists the limits under existing controls, assumptions and the review checklist.Tests
RequestBodyLimitTest:Content-Lengthgets 413;./gradlew test: all 122 tests pass.Dependencies
No dependencies were added or changed, so no vetting or SCA was needed. Snyk SAST was not run locally, because it needs maintainer authentication. The Snyk PR checks still apply.
Generated by Claude Code