Skip to content

Commit cb12f14

Browse files
committed
ensure only valid keys are used
1 parent ede8cbe commit cb12f14

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = function(obj, prop, val) {
2525
return obj;
2626
}
2727

28-
var keys = split(prop, {sep: '.', brackets: true});
28+
var keys = split(prop, {sep: '.', brackets: true}).filter(isValidKey);
2929
var len = keys.length;
3030
var idx = -1;
3131
var current = obj;
@@ -49,3 +49,7 @@ module.exports = function(obj, prop, val) {
4949

5050
return obj;
5151
};
52+
53+
function isValidKey(key) {
54+
return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
55+
}

0 commit comments

Comments
 (0)