Skip to content
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

[Prototype Pollution] https://github.com/mesqueeb/copy-anything/issues/10 #11

Open
jayateertha043 opened this issue May 9, 2021 · 1 comment

Comments

@jayateertha043
Copy link

jayateertha043 commented May 9, 2021

Hi ,
There were may utilities similar to yours which offered deep copying,cloning and merging functionalities.
I suggest there should always be a check when key is proto,prototype and constructor.(This should be a easy fix) as we don't how how anyone is using your package, If someone using your package directly passes user input to copy function it might severely affect their business logic.

Your package is used by many large organizations like less.js, So we don't exactly know how they use it(safely or not).
Most of them directly pass user input without filtering for these keys.

This may cause severe business logic errors.

Here are few report very similar to this which was accepted and fixed by the opensource community: https://huntr.dev/bounties/1-npm-smart-extend/
https://huntr.dev/bounties/1-npm-@livelybone/copy/

Here are few similar reports fixed by our community:
fabiospampinato/plain-object-merge#1
Geta/NestedObjectAssign#11

To know more about Prototype Pollution: https://codeburst.io/what-is-prototype-pollution-49482fc4b638

If you need any other details regarding this , please feel free to contact me in twitter or comment here.


Sorry,
Closing the issue I think it's intended behaviour.

@mesqueeb
Copy link
Owner

@jayateertha043 I'm planning to still look into prototype pollution a bit more.

I originally had this idea that my libraries are not responsible to limit copying/merging of a prototype, because what if someone needs to do that in their software, just stripping the ability to do so makes my library un-usable to them.

However, since it seems like other libraries do prevent this by default, I might reconsider. I might create 2 versions, one that prevents copying/merging of the prototype, and one that allows it. If I do make 2 versions, I'll be very explicit in the docs about when to use which one.

I'm gonna keep this open a while until I make a final decision.

@mesqueeb mesqueeb reopened this May 10, 2021
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

No branches or pull requests

2 participants