feat: raise default body limit 10MB → 20MB — closes #563#566
Merged
Conversation
A more generous out-of-the-box request body cap for common workloads
(larger `git push`, media uploads, bigger RDF documents). Still fully
configurable via --body-limit / JSS_BODY_LIMIT / createServer({
bodyLimit }) — deployments wanting tighter memory-DoS protection lower
it.
- config.defaults.bodyLimit: 10 MiB → 20 MiB
- bin/jss.js --body-limit help text: 'default 10MB' → 'default 20MB'
- refreshed two now-stale doc comments that claimed the default
'matches the previous hard-coded 10 MiB cap' (config.js, server.js)
- new regression test pins the EFFECTIVE wired default via Fastify's
initialConfig.bodyLimit (config.defaults → createServer → Fastify),
so the default can't silently drift
Scope note: the tunnel proxy has a SEPARATE 10 MiB WS message cap
(src/tunnel/index.js MAX_MESSAGE_SIZE) that this change does not touch
— a >10 MiB push over a tunnel would clear the body limit but hit
that cap. Out of scope for #563 (request-body default); worth a
follow-up if tunnelled large pushes become a real need.
Full suite: 962/962 passing.
Closes #563.
There was a problem hiding this comment.
Pull request overview
Raises the server’s default Fastify request body limit from 10 MiB to 20 MiB, keeping the limit configurable via existing CLI/env/programmatic options and adding a regression test that verifies the effective default is actually wired through to Fastify.
Changes:
- Bumped
defaults.bodyLimitto20 * 1024 * 1024insrc/config.js. - Updated
createServer()inline documentation to reflect the new default fallback behavior. - Added an end-to-end-style regression test asserting Fastify’s
initialConfig.bodyLimitdefault is 20 MiB.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/config.js |
Updates the default bodyLimit constant and refreshes explanatory comments. |
src/server.js |
Refreshes the comment describing how bodyLimit falls back to defaults when unset. |
bin/jss.js |
Updates --body-limit help text to reflect the new default. |
test/body-limit.test.js |
Adds a regression test pinning the effective wired default via server.initialConfig. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Closes #563.
What
Raises the out-of-the-box request body cap from 10 MiB to 20 MiB — a more generous default for common workloads (larger
git push, media uploads, bigger RDF documents). Still fully configurable; deployments wanting tighter memory-DoS protection lower it via--body-limit/JSS_BODY_LIMIT/createServer({ bodyLimit }).defaults.bodyLimit10 MiB → 20 MiBsrc/config.js--body-limithelp: "default 10MB" → "default 20MB"bin/jss.jsconfig.js,server.jstest/body-limit.test.jsTest approach
Rather than asserting the config constant in isolation (tautological), the new test pins the default through the whole path —
config.defaults.bodyLimit→createServer()→ Fastify — by reading Fastify's frozeninitialConfig.bodyLimit. So an accidental break anywhere in the wiring (not just a constant edit) trips it.Scope note (worth a look)
The issue's motivation cites "larger
git pushover the tunnel", but the tunnel proxy has a separate 10 MiB WS message cap (src/tunnel/index.jsMAX_MESSAGE_SIZE) that this PR does not touch. So a >10 MiB push over a tunnel would clear the raised body limit but still hit the tunnel cap. That's out of scope for #563 (which is specifically the request-body parser default) — flagging it as a candidate follow-up if tunnelled large pushes become a real need, rather than silently bumping a second unrelated limit.Also unchanged:
src/utils/url.jsMAX_JSON_SIZE(a separate 10 MiB JSON-parse safety cap) — not the request body limit.Full suite: 962/962 passing.
Refs
--body-limitknob this re-defaults--body-limitthrough the CLI path (so the new default actually reaches Fastify fromjss start)