Lab fix verification · Express
Do the tests Express's fix added fail on 5.2.1 and pass on 5.3.0?
- should not add Content-Length header if Transfer-Encoding header is equal to chunked: 5.2.1 fails, 5.3.0 passes
- should not add Content-Length header if Transfer-Encoding header is equal to compress: 5.2.1 fails, 5.3.0 passes
- should not add Content-Length header if Transfer-Encoding header is equal to deflate: 5.2.1 fails, 5.3.0 passes
- should not add Content-Length header if Transfer-Encoding header is equal to gzip: 5.2.1 fails, 5.3.0 passes
Measured Nov 26, 2026 on our own machine. How we tested · Raw data (JSON)
On this page · 5 sections
TL;DR
In our test, all four tests that Express's res.send() fix added or changed failed on 5.2.1 and passed on 5.3.0, so the fixed behaviour is what separates the two versions here.
res.send() Content-Length Tests: Failed on 5.2.1, Passed on 5.3.0 #
Each of the four tests checks that no Content-Length header is added when the Transfer-Encoding header is set to a given value. The four tests cover chunked, compress, deflate and gzip, and the outcomes are in the table below.
| Test | 5.2.1 | 5.3.0 |
|---|---|---|
| should not add Content-Length header if Transfer-Encoding header is equal to chunked | fail | pass |
| should not add Content-Length header if Transfer-Encoding header is equal to compress | fail | pass |
| should not add Content-Length header if Transfer-Encoding header is equal to deflate | fail | pass |
| should not add Content-Length header if Transfer-Encoding header is equal to gzip | fail | pass |
Every one of the four tests fails on 5.2.1 and passes on 5.3.0. For an application, this means that a response sent with res.send() while a Transfer-Encoding header is present was not handled as these tests expect on 5.2.1, and the 5.3.0 package handles it as they expect. The result covers only the Transfer-Encoding values these tests use.
Express 5.3.0 Self-Test: Repeat Runs Gave the Same Outcomes #
In our test, 5.3.0 ran the fix's tests in two containers, and every test had the same outcome both times. This shows that the pass results for 5.3.0 in the table above were the same on both runs, so they are not a one-off result from a single container.
Express 5.3.0: Content-Length Is Added Only Without Transfer-Encoding #
The change that these tests check is listed in the Express v5.3.0 release notes under Bug fixes. The notes say:
The Content-Length header in res.send() is now only added when a Transfer-Encoding header is not present
The release notes also say this complies with the HTTP specification, which states that both headers should not coexist in the same response. For a reader, this is the behaviour the four tests above check: on 5.2.1 they failed, and on 5.3.0 they passed in our test.
Note
Background: The Express pull request that made the change gives the reason: because Content-Length and Transfer-Encoding can't be present in the response headers together, Content-Length should be added only if there is no Transfer-Encoding header.
Our test did not check the other changes listed in the 5.3.0 release notes, such as the dependency upgrades.
Express 5.3.0 Dependency Security Fixes: qs, proxy-addr and body-parser #
The Express v5.3.0 release notes list three dependency upgrades that carry advisory IDs. Our test did not run these checks, so the table reports only what the release notes state.
| Dependency upgrade in 5.3.0 | Advisory IDs listed | What the release notes say it fixes |
|---|---|---|
| qs upgraded to ^6.16.0 | CVE-2026-2391 (GHSA-w7fw-mjwx-w883), CVE-2026-82417 (GHSA-4mjr-xmp4-gh2g), CVE-2026-82562 (GHSA-x5fp-wj9c-mxmx) | Security fix: arrayLimit bypasses in comma parsing and a denial of service via an attacker-controlled isBuffer |
| proxy-addr upgraded to ^2.0.8 | CVE-2026-90711 | Security fix: the release notes name the advisory but do not describe its impact |
| body-parser upgraded to ^2.3.0 | CVE-2026-12590 (GHSA-v422-hmwv-36x6) | Security fix: an invalid limit option value silently disabled request body size enforcement (fail-open), allowing a denial of service via arbitrarily large payloads. Invalid limit values now throw at parser initialization instead of being ignored |
The Sentinel’s Call
Applications that send responses with res.send() while a Transfer-Encoding header is present should move to 5.3.0 first, because the four tests failed on 5.2.1 and passed on 5.3.0 in our test. After upgrading, check the Content-Length header on those responses. Other changes can follow the same upgrade path.
Our judgement, drawn only from the facts and sources above.
How we tested
- ProcessorAMD Ryzen 7 7800X3D (8 cores, 16 threads)
- Memory32 GB RAM
- SystemWindows 11 Pro, Docker Desktop (WSL 2)
- ContainersDocker Engine 29.9.3
What we ran
- 5.2.1
express 5.2.1 on node:22-slimsha256:e9f565d32859… - 5.3.0
express 5.3.0 on node:22-slimsha256:e9f565d32859…
Self-test 5.3.0 against 5.3.0: the fix's tests twice: every test had the same outcome both times.
Method
- The tests that commit 18e5985 added or changed (test/res.send.js), read from expressjs/express 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
- 5.3.0 ran the tests twice, in two containers (the self-test)
Reproduce it
docker run --rm -it node:22-slim bash
npm install --ignore-scripts [email protected] mocha@^11.7.5 supertest@^6.3.0 (and 5.3.0 in a second container)
Copy test/ from https://github.com/expressjs/express/tree/18e5985b8a9d5e8423db0a9121f22bdaecd5b120 into node_modules/express/ (with its helpers)
npx mocha --check-leaks node_modules/express/test/res.send.jsLimits
- 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.
Sources
- Release v5.3.0 · expressjs/express · GitHub github.com · Oct 9, 2026
- expressjs/express#4893: fix(res.send): add Content-Length header only if Transfer-Encoding is not present github.com · Jun 16, 2026
Edited and approved by Jarosław Krzemiński. Spotted a mistake? Report a correction or read the corrections policy.




Comments