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

Fixed Prototype pollution in simple-deep-assign #1

Merged
merged 1 commit into from
Jan 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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