Skip to content

fix: reject compressed request bodies in every body parser - #2191

Merged
paustint merged 1 commit into
mainfrom
fix/body-parser-disable-inflate
Oct 24, 2026
Merged

paustint merged 1 commit into
mainfrom
fix/body-parser-disable-inflate

Conversation

@paustint

Copy link
Copy Markdown
Contributor

No client sends a compressed request body, but body-parser inflates gzip, deflate and br by default. That means anyone can push a crafted stream into Node's zlib/Brotli decoders with Content-Encoding: br (CVE-2026-111497, "Node2Shell"). Cloudflare doesn't decode request bodies before passing them to the origin, so it doesn't protect us here.

This sets inflate: false on every parser in api (global parsers, Stripe webhook, CSP reports), geo-ip-api and admin-api. A request with an encoded body now gets 415 encoding.unsupported; uncompressed (identity) bodies are unaffected.

The Node 24.22.1 bump (#2188) is the actual fix. This removes the attack surface in case of future decoder bugs.

Verified

  • typecheck passes for api, geo-ip-api and admin-api
  • Local express check: plain JSON returns 200, a br-encoded body returns 415

No client sends a compressed request body, but body-parser inflates gzip,
deflate and br by default, so any request reached Node's zlib/brotli decoders
(CVE-2026-111497). With inflate: false, an encoded body gets a 415. The Node
24.22.1 bump is the actual fix; this removes the attack surface.
@paustint
paustint merged commit 14dfa0d into main Oct 24, 2026
15 checks passed
@paustint
paustint deleted the fix/body-parser-disable-inflate branch October 24, 2026 15:28
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.

1 participant