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

オープン
#780 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
express, javascript, node.js
領域
backend, security

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
JavaScript
スター
5.5k
フォーク
802
平均マージ
7時間 54分
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

expressjs/body-parser のほかの issue

expressjs/body-parser の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。