Skip to content

Commit

Permalink
Fix prototype pollution
Browse files Browse the repository at this point in the history
Following the approach in lodash#4759
  • Loading branch information
Neumann-Nils committed May 25, 2020
1 parent 74b09d6 commit 2f0047b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .internal/baseSet.js
Expand Up @@ -30,6 +30,10 @@ function baseSet(object, path, value, customizer) {
const key = toKey(path[index])
let newValue = value

if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
return object;
}

if (index != lastIndex) {
const objValue = nested[key]
newValue = customizer ? customizer(objValue, key, nested) : undefined
Expand Down

0 comments on commit 2f0047b

Please sign in to comment.