镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[v7.x] fix(decompress): treat inherited Object.prototype names as unsupported encodings (#5807) - #6024

Open
mrityunjay-pandey wants to merge 2 commits into
nodejs:v7.xfrom
mrityunjay-pandey:backport/v7.x-decompress-proto
Open

mrityunjay-pandey wants to merge 2 commits into
nodejs:v7.xfrom
mrityunjay-pandey:backport/v7.x-decompress-proto

Conversation

@mrityunjay-pandey

Copy link
Copy Markdown
Contributor

This relates to...

Backport of #5807 to v7.x.

Rationale

supportedEncodings in lib/interceptor/decompress.js is a plain object literal on v7.x too, so Content-Encoding: constructor or __proto__ resolves through the prototype chain. With the tests from #5807 applied to v7.x, the constructor and gzip, constructor cases never settle and __proto__ throws out of the interceptor (3 failing tests, the run hits the timeout).

Changes

Features

N/A

Bug Fixes

  • The decompress interceptor passes through Object.prototype names as unsupported encodings instead of hanging or throwing.

Breaking Changes and Deprecations

N/A

Status

Tested locally on Linux with Node 24: node --test test/interceptors/decompress.js (48 pass), npm run lint and npm run test:unit (1324 tests, 1321 pass, 3 skipped, 0 fail).

…d encodings (nodejs#5807)

supportedEncodings is a plain object literal, so the guard

  if (!supportedEncodings[encoding])

resolves inherited names through the prototype chain instead of rejecting
them. onResponseStart lowercases the header first, which leaves exactly two
reachable from the wire: constructor and __proto__.

A response carrying Content-Encoding: constructor calls Object(), pushes the
plain object it returns into the decompressor chain, and the request then
never settles; __proto__ throws TypeError out of the interceptor. Give the
table a null prototype so only its own entries can match.

(cherry picked from commit ca5111e)
@codecov-commenter

codecov-commenter commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.17%. Comparing base (14c296f) to head (c687fe8).

Additional details and impacted files
@@           Coverage Diff           @@
##             v7.x    #6024   +/-   ##
=======================================
  Coverage   93.16%   93.17%           
=======================================
  Files         112      112           
  Lines       37632    37633    +1     
=======================================
+ Hits        35059    35063    +4     
+ Misses       2573     2570    -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

4 participants