This repository was archived by the owner on Dec 19, 2023. It is now read-only.
[Fix] fix prototype pollution vuln#1
Merged
Merged
Conversation
See https://www.huntr.dev/bounties/1-npm-doc-path/ Note that the link describes pollution via `.prototype` and `.constructor`, neither of which are actually "prototype pollution". Mutating a shared object is *supposed* to be visible across the environment. However, `__proto__` is the one that can be unintentional and cause these kind of issues. Note: in node 0.10, `obj['__proto__']` incorrectly does `obj.__proto__`, which is different according to the spec, so Object.getOwnPropertyDescriptor is needed.
|
Congratulations @ljharb - your fix has been selected! 🎉 Thanks for being part of the community & helping secure the world's open-source code. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
📊 Metadata *
Bounty URL: https://www.huntr.dev/bounties/1-npm-doc-path
⚙️ Description *
Note that the link describes pollution via
.prototypeand.constructor, neither of which are actually "prototype pollution". Mutating a shared object is supposed to be visible across the environment. However,__proto__is the one that can be unintentional and cause these kind of issues.Note: in node 0.10,
obj['__proto__']incorrectly doesobj.__proto__, which is different according to the spec, soObject.getOwnPropertyDescriptoris needed.When the key is
__proto__and is not an own property, useObject.definePropertyto create it, avoiding accidental pollution of the [[Prototype]].💻 Technical Description *
See above.
🐛 Proof of Concept (PoC) *
See the test case.
🔥 Proof of Fix (PoF) *
npm test👍 User Acceptance Testing (UAT)
npm test🔗 Relates to...
418sec/huntr#747