Skip to content

Commit ec7ff52

Browse files
committed
ensure __proto__ is not polluted in expandObjectPaths
1 parent 33a2f16 commit ec7ff52

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ lib.expandObjectPaths = function(data) {
933933
if((match = key.match(dottedPropertyRegex))) {
934934
datum = data[key];
935935
prop = match[1];
936+
if(prop === '__proto__') continue;
936937

937938
delete data[key];
938939

@@ -941,6 +942,8 @@ lib.expandObjectPaths = function(data) {
941942
datum = data[key];
942943

943944
prop = match[1];
945+
if(prop === '__proto__') continue;
946+
944947
idx = parseInt(match[2]);
945948

946949
delete data[key];
@@ -969,9 +972,12 @@ lib.expandObjectPaths = function(data) {
969972
} else {
970973
// This is the case where this property is the end of the line,
971974
// e.g. xaxis.range[0]
975+
976+
if(prop === '__proto__') continue;
972977
data[prop][idx] = lib.expandObjectPaths(datum);
973978
}
974979
} else {
980+
if(key === '__proto__') continue;
975981
data[key] = lib.expandObjectPaths(data[key]);
976982
}
977983
}

0 commit comments

Comments
 (0)