Skip to content

feat: raise default body limit 10MB → 20MB — closes #563#566

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-563-default-body-limit-20mb
Jun 15, 2026
Merged

feat: raise default body limit 10MB → 20MB — closes #563#566
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-563-default-body-limit-20mb

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

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 }).

Change File
defaults.bodyLimit 10 MiB → 20 MiB src/config.js
--body-limit help: "default 10MB" → "default 20MB" bin/jss.js
Refreshed two doc comments that claimed the default "matches the previous hard-coded 10 MiB cap" (now false) config.js, server.js
New regression test pinning the effective wired default test/body-limit.test.js

Test approach

Rather than asserting the config constant in isolation (tautological), the new test pins the default through the whole path — config.defaults.bodyLimitcreateServer() → Fastify — by reading Fastify's frozen initialConfig.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 push over the tunnel", but the tunnel proxy has a separate 10 MiB WS message cap (src/tunnel/index.js MAX_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.js MAX_JSON_SIZE (a separate 10 MiB JSON-parse safety cap) — not the request body limit.

Full suite: 962/962 passing.

Refs

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.bodyLimit to 20 * 1024 * 1024 in src/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.bodyLimit default 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.

@melvincarvalho
melvincarvalho merged commit 84eae4b into gh-pages Jun 15, 2026
2 checks passed
@melvincarvalho
melvincarvalho deleted the issue-563-default-body-limit-20mb branch June 15, 2026 07:31
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.

Raise default body parser limit to 20MB

2 participants