http: make req.headers have a null prototype#62900
http: make req.headers have a null prototype#62900nodejs-github-bot merged 3 commits intonodejs:mainfrom
Conversation
Makes IncomingMessage.prototype.headers and trailers have a null prototype, matching the existing behavior of headersDistinct and trailersDistinct. Fixes prototype pollution concerns where headers like __proto__ could be interpreted as prototype manipulation. Refs: nodejs#61771 PR-URL: nodejs#61772
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62900 +/- ##
==========================================
+ Coverage 89.61% 89.63% +0.01%
==========================================
Files 706 706
Lines 219136 219203 +67
Branches 41981 41998 +17
==========================================
+ Hits 196376 196478 +102
+ Misses 14671 14618 -53
- Partials 8089 8107 +18
🚀 New features to boost your workflow:
|
In HTTP/2 compatibility mode, make request trailers have a null prototype, matching the behavior of regular headers and trailers.
fcc3070 to
8c7c040
Compare
b202d30 to
6e4f221
Compare
6e4f221 to
3a57b11
Compare
Commit Queue failed- Loading data for nodejs/node/pull/62900 ✔ Done loading data for nodejs/node/pull/62900 ----------------------------------- PR info ------------------------------------ Title http: make req.headers have a null prototype (#62900) Author Matteo Collina <matteo.collina@gmail.com> (@mcollina) Branch mcollina:http-server-headers-null-proto -> nodejs:main Labels http, semver-major, http2, author ready, needs-ci Commits 3 - http: make req.headers have a null prototype - http2/compat: make req.trailers have a null prototype - test: actually check req.trailers null prototype in http-server-heade… Committers 1 - Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/62900 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/62900 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Wed, 22 Apr 2026 21:54:51 GMT ✔ Approvals: 9 ✔ - Jordan Harband (@ljharb): https://github.com/nodejs/node/pull/62900#pullrequestreview-4158266135 ✔ - Stephen Belanger (@Qard): https://github.com/nodejs/node/pull/62900#pullrequestreview-4159826483 ✔ - Gürgün Dayıoğlu (@gurgunday): https://github.com/nodejs/node/pull/62900#pullrequestreview-4159918734 ✔ - Tim Perry (@pimterry): https://github.com/nodejs/node/pull/62900#pullrequestreview-4161042392 ✔ - Filip Skokan (@panva) (TSC): https://github.com/nodejs/node/pull/62900#pullrequestreview-4161690281 ✔ - Daijiro Wachi (@watilde): https://github.com/nodejs/node/pull/62900#pullrequestreview-4161955983 ✔ - René (@Renegade334): https://github.com/nodejs/node/pull/62900#pullrequestreview-4161978817 ✔ - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/62900#pullrequestreview-4163758697 ✔ - Marco Ippolito (@marco-ippolito) (TSC): https://github.com/nodejs/node/pull/62900#pullrequestreview-4164814792 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2026-04-23T21:02:08Z: https://ci.nodejs.org/job/node-test-pull-request/72897/ - Querying data for job/node-test-pull-request/72897/ ✔ Build data downloaded ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD ✔ origin/main is now up-to-date - Downloading patch for 62900 From https://github.com/nodejs/node * branch refs/pull/62900/merge -> FETCH_HEAD ✔ Fetched commits as 24280308dc9d..3a57b11e2fd3 -------------------------------------------------------------------------------- [main bfd78aa23d] http: make req.headers have a null prototype Author: Matteo Collina <hello@matteocollina.com> Date: Tue Apr 21 10:44:34 2026 +0000 11 files changed, 118 insertions(+), 22 deletions(-) create mode 100644 test/parallel/test-http-server-headers-null-proto.js [main 63b779a8d6] http2/compat: make req.trailers have a null prototype Author: Matteo Collina <hello@matteocollina.com> Date: Wed Apr 22 06:15:02 2026 +0000 10 files changed, 59 insertions(+), 61 deletions(-) Auto-merging doc/api/http.md [main 09115ad9ec] test: actually check req.trailers null prototype in http-server-headers-null-proto Author: Matteo Collina <hello@matteocollina.com> Date: Thu Apr 23 15:27:08 2026 +0000 3 files changed, 28 insertions(+), 1 deletion(-) ✔ Patches applied There are 3 commits in the PR. Attempting autorebase. (node:356) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated. (Use `node --trace-deprecation ...` to show where the warning was created) Rebasing (2/6) Executing: git node land --amend --yes --------------------------------- New Message ---------------------------------- http: make req.headers have a null prototypehttps://github.com/nodejs/node/actions/runs/24914037254 |
|
Landed in 21436f0 |
Make req.headers and req.trailers in http.createServer() have a null prototype, matching the existing behavior of headersDistinct and trailersDistinct. Also applies the same fix to HTTP/2 compatibility mode for req.trailers.