{
 "article": "/articles/body-parser-2-4-0-and-2-3-0-two-gzip-crash-tests-fail-before-fix-71b30141/",
 "lab": {
  "checks": [
   {
    "name": "should not crash on trailing bytes after a gzip body",
    "outcomes": {
     "2.3.0": "fail",
     "2.4.0": "pass"
    },
    "source": "https://github.com/expressjs/body-parser/blob/f7075eae3a84c3473ab4bf0a777da28db208e916/test/json.js"
   },
   {
    "name": "should not crash when an unsupported charset rejects a compressed body",
    "outcomes": {
     "2.3.0": "fail",
     "2.4.0": "pass"
    },
    "source": "https://github.com/expressjs/body-parser/blob/f7075eae3a84c3473ab4bf0a777da28db208e916/test/json.js"
   },
   {
    "name": "should finish the request when the decompressor finishes early",
    "outcomes": {
     "2.3.0": "pass",
     "2.4.0": "pass"
    },
    "source": "https://github.com/expressjs/body-parser/blob/f7075eae3a84c3473ab4bf0a777da28db208e916/test/json.js"
   },
   {
    "name": "should preserve other consumers of the request body",
    "outcomes": {
     "2.3.0": "pass",
     "2.4.0": "pass"
    },
    "source": "https://github.com/expressjs/body-parser/blob/f7075eae3a84c3473ab4bf0a777da28db208e916/test/json.js"
   }
  ],
  "claims": [],
  "commands": [
   "docker run --rm -it node:22-slim bash",
   "npm install --ignore-scripts body-parser@2.3.0 mocha@^11.7.6 supertest@7.3.0 (and 2.4.0 in a second container)",
   "Copy test/ from https://github.com/expressjs/body-parser/tree/f7075eae3a84c3473ab4bf0a777da28db208e916 into node_modules/body-parser/ (with its helpers)",
   "npx mocha --check-leaks node_modules/body-parser/test/json.js"
  ],
  "date": "2026-11-26",
  "family": "fix",
  "findings": [
   {
    "kind": "fix",
    "text": "should not crash on trailing bytes after a gzip body: 2.3.0 fails, 2.4.0 passes"
   },
   {
    "kind": "fix",
    "text": "should not crash when an unsupported charset rejects a compressed body: 2.3.0 fails, 2.4.0 passes"
   }
  ],
  "limits": [
   "Only the tests that the fix commit added or changed count; the package's other tests are not part of this check.",
   "The published package from npm is tested, not the repository's source, on Node.js 22 only.",
   "A passing test shows the fixed behaviour on our machine; it is not a security audit of the package."
  ],
  "method": [
   "The tests that commit f7075ea added or changed (test/json.js), read from expressjs/body-parser at that commit and run unchanged with mocha against each published version",
   "Which tests it added or changed: each test's name and code at the commit against the commit before it, listed with mocha --dry-run",
   "Each version in its own container: installed from npm without install scripts, then the network cut",
   "Before the vendor's tests went in, each container was read back: no mount, network or device, no added rights, not root; it was removed after",
   "2.4.0 ran the tests twice, in two containers (the self-test)"
  ],
  "product": "body-parser",
  "question": "Do the tests body-parser's fix added fail on 2.3.0 and pass on 2.4.0?",
  "results": [],
  "rig": {
   "cpu": "AMD Ryzen 7 7800X3D (8 cores, 16 threads)",
   "docker": "Docker Engine 29.9.3",
   "driver": "",
   "gpu": "",
   "os": "Windows 11 Pro, Docker Desktop (WSL 2)",
   "ram": "32 GB"
  },
  "schema": 1,
  "self_test": {
   "clear": 0,
   "max_delta_pct": 0.0,
   "name": "2.4.0 against 2.4.0: the fix's tests twice"
  },
  "subjects": [
   {
    "digest": "sha256:e9f565d32859f0cbfb52125eafe8be39390f24dac302dc3cdf566e8ba3ab21ee",
    "image": "body-parser 2.3.0 on node:22-slim",
    "label": "2.3.0"
   },
   {
    "digest": "sha256:e9f565d32859f0cbfb52125eafe8be39390f24dac302dc3cdf566e8ba3ab21ee",
    "image": "body-parser 2.4.0 on node:22-slim",
    "label": "2.4.0"
   }
  ]
 }
}