Skip to content

Commit ee4b8e7

Browse files
committed
fix: 🐛 fix prototype pollution
filter prototype, __proto__ and constructor
1 parent 018e488 commit ee4b8e7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ api.set = function set (obj, pointer, value) {
7575

7676
for (var i = 0; i < refTokens.length - 1; ++i) {
7777
var tok = refTokens[i];
78+
if (tok === "__proto__" || tok === "constructor" || tok === "prototype") {
79+
continue
80+
}
7881
if (tok === '-' && Array.isArray(obj)) {
7982
tok = obj.length;
8083
}

0 commit comments

Comments
 (0)