Disable request body inflation by default (`inflate: false`)

Open
#780 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Domain
backend, security

Research direction

Start by reading the parser option handling and migration notes for the next major version; the issue does not name specific files or tests. Trace how inflate defaults across the parsers, then check existing tests for compressed request bodies. Done when inflation defaults to false, explicit inflate: true still works, and the migration notes explain the change.

Written by the indexing model from the issue text.

Description

discuss ideas semver-major
Summary

All parsers in body-parser inflate compressed request bodies by default (inflate: true). In 2.x this includes Brotli (br). Many users may be unaware that their app decompresses attacker-controlled request bodies.

I'd like to propose making inflation opt-in in the next major version.

Proposal
  • Change the default of inflate to false (semver-major).
  • Document the change prominently in the migration notes.
Example

With this change, request inflations are opt-out by default and users should knowingly opt in.

app.use(express.json({ inflate: true }))
app.use(express.urlencoded({ extended: false, inflate: true }))
Motivation

Primary: CVE-2026-111497

CVE-2026-111497 is an out-of-bounds write in the Brotli decoder bundled with Node.js that can lead to remote code execution. It is fixed in 22.23.4, 24.22.1 and 26.12.1. An application is exposed when it decompresses attacker-controlled Brotli data, such as a request body.

With the current defaults, any Express 5 app using the built-in body parsers decodes Content-Encoding: br request bodies. Patching Node.js is the real fix. Still, an opt-in default would have kept this attack surface closed for the many apps that never need compressed request bodies.

Secondary considerations

  • WAF bypasses. Some WAFs and proxies do not decompress request bodies. The app silently accepting encodings that the inspection layer may not see is a risk users should opt into knowingly.
  • Decompression bombs. limit mitigates this. However, CVE-2026-12590 showed that a misconfigured limit could silently disable size enforcement, so accepting compressed bodies should be a deliberate choice.
Dominant language
JavaScript
Stars
5.5k
Forks
802
Avg merge
7h 54m
Merged PRs (30d)
8

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from expressjs/body-parser

All issues in expressjs/body-parser

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.