Repository navigation
[v7.x] fix(decompress): treat inherited Object.prototype names as unsupported encodings (#5807) - #6024
Open
mrityunjay-pandey wants to merge 1 commit into
Open
[v7.x] fix(decompress): treat inherited Object.prototype names as unsupported encodings (#5807)#6024mrityunjay-pandey wants to merge 1 commit into
mrityunjay-pandey wants to merge 1 commit into
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v7.x #6024 +/- ##
=======================================
Coverage 93.15% 93.15%
=======================================
Files 112 112
Lines 37626 37627 +1
=======================================
+ Hits 35052 35053 +1
Misses 2574 2574 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 15, 2026
metcoder95
approved these changes
Oct 16, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This relates to...
Backport of #5807 to v7.x.
Rationale
supportedEncodingsinlib/interceptor/decompress.jsis a plain object literal on v7.x too, soContent-Encoding: constructoror__proto__resolves through the prototype chain. With the tests from #5807 applied tov7.x, theconstructorandgzip, constructorcases never settle and__proto__throws out of the interceptor (3 failing tests, the run hits the timeout).Changes
git cherry-pick -x), no conflicts:__proto__: nullon the encodings table, plus the tests from fix(decompress): treat inherited Object.prototype names as unsupported encodings #5807.Features
N/A
Bug Fixes
Object.prototypenames 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 lintandnpm run test:unit(1324 tests, 1321 pass, 3 skipped, 0 fail).