Skip to content

Commit 763ada0

Browse files
committed
fix(security): prevent call/apply invocation of Function
1 parent 98a6b22 commit 763ada0

12 files changed

+28
-6
lines changed

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGES for jsonpath-plus
22

3+
## 10.0.6
4+
5+
- fix(security): prevent `call`/`apply` invocation of `Function`
6+
37
## 10.0.5
48

59
- fix: remove overly aggressive disabling of native functions but

badges/coverage-badge.svg

+1-1
Loading

dist/index-browser-esm.js

+3
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,9 @@ const SafeEval = {
12991299
if (obj === Function && prop === 'bind') {
13001300
throw new Error('Function.prototype.bind is disabled');
13011301
}
1302+
if (obj === Function && (prop === 'call' || prop === 'apply')) {
1303+
throw new Error('Function.prototype.call and ' + 'Function.prototype.apply are disabled');
1304+
}
13021305
if (result === Function) {
13031306
return result; // Don't bind so can identify and throw later
13041307
}

dist/index-browser-esm.min.js

+1-1
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

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-browser-umd.cjs

+3
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,9 @@
13051305
if (obj === Function && prop === 'bind') {
13061306
throw new Error('Function.prototype.bind is disabled');
13071307
}
1308+
if (obj === Function && (prop === 'call' || prop === 'apply')) {
1309+
throw new Error('Function.prototype.call and ' + 'Function.prototype.apply are disabled');
1310+
}
13081311
if (result === Function) {
13091312
return result; // Don't bind so can identify and throw later
13101313
}

dist/index-browser-umd.min.cjs

+1-1
Large diffs are not rendered by default.

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

+1-1
Large diffs are not rendered by default.

dist/index-node-cjs.cjs

+3
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,9 @@ const SafeEval = {
13001300
if (obj === Function && prop === 'bind') {
13011301
throw new Error('Function.prototype.bind is disabled');
13021302
}
1303+
if (obj === Function && (prop === 'call' || prop === 'apply')) {
1304+
throw new Error('Function.prototype.call and ' + 'Function.prototype.apply are disabled');
1305+
}
13031306
if (result === Function) {
13041307
return result; // Don't bind so can identify and throw later
13051308
}

dist/index-node-esm.js

+3
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,9 @@ const SafeEval = {
12981298
if (obj === Function && prop === 'bind') {
12991299
throw new Error('Function.prototype.bind is disabled');
13001300
}
1301+
if (obj === Function && (prop === 'call' || prop === 'apply')) {
1302+
throw new Error('Function.prototype.call and ' + 'Function.prototype.apply are disabled');
1303+
}
13011304
if (result === Function) {
13021305
return result; // Don't bind so can identify and throw later
13031306
}

package.json

+1-1
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.5",
4+
"version": "10.0.6",
55
"type": "module",
66
"bin": {
77
"jsonpath": "./bin/jsonpath-cli.js",

src/Safe-Script.js

+6
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ const SafeEval = {
114114
if (obj === Function && prop === 'bind') {
115115
throw new Error('Function.prototype.bind is disabled');
116116
}
117+
if (obj === Function && (prop === 'call' || prop === 'apply')) {
118+
throw new Error(
119+
'Function.prototype.call and ' +
120+
'Function.prototype.apply are disabled'
121+
);
122+
}
117123
if (result === Function) {
118124
return result; // Don't bind so can identify and throw later
119125
}

0 commit comments

Comments
 (0)