Skip to content

Commit eac48fe

Browse files
committed
fix(security): prevent binding of Function calls which may evade detection
1 parent 34a836b commit eac48fe

11 files changed

+24
-5
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGES for jsonpath-plus
22

3+
## 10.0.3
4+
5+
- fix(security): prevent binding of Function calls which may evade detection
6+
37
## 10.0.2
48

59
- fix(security): prevent Function calls outside of member expressions

dist/index-browser-esm.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,9 @@ const SafeEval = {
12961296
const obj = SafeEval.evalAst(ast.object, subs);
12971297
const result = obj[prop];
12981298
if (typeof result === 'function') {
1299+
if (obj === Function && prop === 'bind') {
1300+
throw new Error('Function.prototype.bind is disabled');
1301+
}
12991302
if (result === Function) {
13001303
return result; // Don't bind so can identify and throw later
13011304
}

dist/index-browser-esm.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-browser-esm.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-browser-umd.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,9 @@
13021302
const obj = SafeEval.evalAst(ast.object, subs);
13031303
const result = obj[prop];
13041304
if (typeof result === 'function') {
1305+
if (obj === Function && prop === 'bind') {
1306+
throw new Error('Function.prototype.bind is disabled');
1307+
}
13051308
if (result === Function) {
13061309
return result; // Don't bind so can identify and throw later
13071310
}

dist/index-browser-umd.min.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/index-browser-umd.min.cjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-node-cjs.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,9 @@ const SafeEval = {
12971297
const obj = SafeEval.evalAst(ast.object, subs);
12981298
const result = obj[prop];
12991299
if (typeof result === 'function') {
1300+
if (obj === Function && prop === 'bind') {
1301+
throw new Error('Function.prototype.bind is disabled');
1302+
}
13001303
if (result === Function) {
13011304
return result; // Don't bind so can identify and throw later
13021305
}

dist/index-node-esm.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,9 @@ const SafeEval = {
12951295
const obj = SafeEval.evalAst(ast.object, subs);
12961296
const result = obj[prop];
12971297
if (typeof result === 'function') {
1298+
if (obj === Function && prop === 'bind') {
1299+
throw new Error('Function.prototype.bind is disabled');
1300+
}
12981301
if (result === Function) {
12991302
return result; // Don't bind so can identify and throw later
13001303
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Stefan Goessner",
33
"name": "jsonpath-plus",
4-
"version": "10.0.2",
4+
"version": "10.0.3",
55
"type": "module",
66
"bin": {
77
"jsonpath": "./bin/jsonpath-cli.js",

src/Safe-Script.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ const SafeEval = {
111111
const obj = SafeEval.evalAst(ast.object, subs);
112112
const result = obj[prop];
113113
if (typeof result === 'function') {
114+
if (obj === Function && prop === 'bind') {
115+
throw new Error('Function.prototype.bind is disabled');
116+
}
114117
if (result === Function) {
115118
return result; // Don't bind so can identify and throw later
116119
}

0 commit comments

Comments
 (0)