Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from d3m0n-r00t/master
Browse files Browse the repository at this point in the history
Fixed Prototype pollution in simple-deep-assign
  • Loading branch information
JamieSlome committed Jan 22, 2021
2 parents fb360e6 + fd3d818 commit 76c47c5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions simpleDeepAssign.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ function isObject(item/*: any*/)/*: boolean*/ {
*/
function deepAssignObject(target/*: Object*/, source/*: Object*/)/*: void*/ {
Object.keys(source).forEach(key => {
if (key === '__proto__' || key === 'prototype' || key === 'constructor'){
return;
}
if (isObject(target[key]) && isObject(source[key])) {
deepAssignObject(target[key], source[key]);
return;
Expand Down

0 comments on commit 76c47c5

Please sign in to comment.