Skip to content

Commit

Permalink
fix(security): further prevent binding of Function calls which may ev…
Browse files Browse the repository at this point in the history
…ade detection
  • Loading branch information
brettz9 committed Oct 17, 2024
1 parent eac48fe commit 30194c7
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGES for jsonpath-plus

## 10.0.4

- fix(security): further prevent binding of Function calls which may evade detection

## 10.0.3

- fix(security): prevent binding of Function calls which may evade detection
Expand Down
3 changes: 3 additions & 0 deletions dist/index-browser-esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,9 @@ const SafeEval = {
if (func === Function) {
throw new Error('Function constructor is disabled');
}
if (func.toString() === 'function () { [native code] }') {
throw new Error('Native functions are disabled');
}
return func(...args);
},
evalAssignmentExpression(ast, subs) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index-browser-esm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index-browser-esm.min.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/index-browser-umd.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,9 @@
if (func === Function) {
throw new Error('Function constructor is disabled');
}
if (func.toString() === 'function () { [native code] }') {
throw new Error('Native functions are disabled');
}
return func(...args);
},
evalAssignmentExpression(ast, subs) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index-browser-umd.min.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index-browser-umd.min.cjs.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/index-node-cjs.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,9 @@ const SafeEval = {
if (func === Function) {
throw new Error('Function constructor is disabled');
}
if (func.toString() === 'function () { [native code] }') {
throw new Error('Native functions are disabled');
}
return func(...args);
},
evalAssignmentExpression(ast, subs) {
Expand Down
3 changes: 3 additions & 0 deletions dist/index-node-esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,9 @@ const SafeEval = {
if (func === Function) {
throw new Error('Function constructor is disabled');
}
if (func.toString() === 'function () { [native code] }') {
throw new Error('Native functions are disabled');
}
return func(...args);
},
evalAssignmentExpression(ast, subs) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Stefan Goessner",
"name": "jsonpath-plus",
"version": "10.0.3",
"version": "10.0.4",
"type": "module",
"bin": {
"jsonpath": "./bin/jsonpath-cli.js",
Expand Down
3 changes: 3 additions & 0 deletions src/Safe-Script.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ const SafeEval = {
if (func === Function) {
throw new Error('Function constructor is disabled');
}
if (func.toString() === 'function () { [native code] }') {
throw new Error('Native functions are disabled');
}
return func(...args);
},
evalAssignmentExpression (ast, subs) {
Expand Down

0 comments on commit 30194c7

Please sign in to comment.