You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it("should not pollute __proto__",function(){constobj={tmp: ""};// @ts-ignore: Pollute __proto__ on purposemerge(obj,(obj.__proto__.polluted="Proto has been polluted"));constobj_new=[];// @ts-ignore: Pollute __proto__ on purposeexpect(obj_new.polluted).toEqual(undefined);});
The problem is, if there's a block like (obj.__proto__.polluted = "Proto has been polluted"), it's polluting the original obj.
I tried fixing it in various ways but it doesn't seem fixable and even with a no-op (i.e. return object), it's still polluted.
It would be great if someone could point out a way to fix the issue. Any sort of serialization is out of the window since you can merge objects with functions.
Consider the following test:
The problem is, if there's a block like
(obj.__proto__.polluted = "Proto has been polluted")
, it's polluting the originalobj
.I tried fixing it in various ways but it doesn't seem fixable and even with a no-op (i.e. return object), it's still polluted.
It would be great if someone could point out a way to fix the issue. Any sort of serialization is out of the window since you can merge objects with functions.
You can run the test at https://github.com/survivejs/webpack-merge/tree/fix/do-not-pollute .
Thanks to Daniel Elkabes from WhiteSource Software for pointing out the issue.
The text was updated successfully, but these errors were encountered: