-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for Prototype Pollution #7
base: master
Are you sure you want to change the base?
Conversation
It's my understanding that prototype pollution is the result of doing operations (in this case calling Why should this bug extend to relatively low-level utilities such as |
There is another report of this issue. Looking at the readme page of the Furthermore, even if it were low-level why would you want to copy the prototypes? Could we add an optional argument that defaults to false to allow you to copy the prototype when set to true? |
I don' think there is prototype pollution here:
You are polluting your own object, not the global object |
I think Snoopy is right, this isn't an issue in the sense of you're only polluting the local object not the global object. Thus in the truest sense of the issue, you're not causing prototype pollution, if you were ALL objects would be affected. I created a gist explaining this with examples The issue here is that you could if this were called by a user facing API, which expressJS and a lot of other libraries use this to merge things like headers |
index.js
Outdated
for (var key in b) { | ||
a[key] = b[key]; | ||
var allowedAttrs = Object.getOwnPropertyNames(b); | ||
console.log(allowedAttrs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to remove this console log?
I guess the vuln report is actually based on that? |
Yep indeed, the vuln reports that are going around for utils-merge prototype pollution is wrong |
How did the vuln report get filed? I never filed it. This whole PR seemed to get blown out of proportion after it got filed. |
There are unit tests on this project which demonstrates this. What good does an example gist do? Why not add more unit tests? |
This commit fixes prototype pollution: https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/master/paper/JavaScript_prototype_pollution_attack_in_NodeJS.pdf
Since so many repos depend on this repo, some may be using it to merge proto and this fix may break them.