Skip to content

Commit

Permalink
Merge pull request #1 from Yoshino-s/master
Browse files Browse the repository at this point in the history
Fix prototype pollution
  • Loading branch information
huntr.dev | the place to protect open source authored Mar 29, 2021
2 parents a556e27 + 6c475a1 commit 3679a4d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export default function evaluate(tokens, expr, values) {
nstack.push(f(resolveExpression(n1, values), resolveExpression(n2, values), resolveExpression(n3, values)));
}
} else if (type === IVAR) {
if (/^__proto__|prototype|constructor$/.test(item.value)) {
throw new Error('prototype access detected');
}
if (item.value in expr.functions) {
nstack.push(expr.functions[item.value]);
} else if (item.value in expr.unaryOps && expr.parser.isOperatorEnabled(item.value)) {
Expand Down

0 comments on commit 3679a4d

Please sign in to comment.