Skip to content

Commit

Permalink
fix: 🐛 fix prototype pollution
Browse files Browse the repository at this point in the history
filter prototype, __proto__ and constructor
  • Loading branch information
AdamGold committed Aug 25, 2020
1 parent 018e488 commit ee4b8e7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ api.set = function set (obj, pointer, value) {

for (var i = 0; i < refTokens.length - 1; ++i) {
var tok = refTokens[i];
if (tok === "__proto__" || tok === "constructor" || tok === "prototype") {
continue
}
if (tok === '-' && Array.isArray(obj)) {
tok = obj.length;
}
Expand Down

0 comments on commit ee4b8e7

Please sign in to comment.