You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BREAKING CHANGE: limit syntax for bracketed lookup strings to fix vuln (#145)
This restricts the supported syntax for *bracketed* parts of lookup
strings to avoid the need to *eval* that string. The eval is a
security vulnerability that allows command injection. CVE-2020-7712Fixes#144
Copy file name to clipboardExpand all lines: lib/json.js
+87-15Lines changed: 87 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
#!/usr/bin/env node
2
2
/**
3
-
* Copyright (c) 2014 Trent Mick. All rights reserved.
4
-
* Copyright (c) 2014 Joyent Inc. All rights reserved.
3
+
* Copyright 2020 Trent Mick.
4
+
* Copyright 2020 Joyent Inc.
5
5
*
6
6
* json -- JSON love for your command line.
7
7
*
8
8
* See <https://github.com/trentm/json> and <https://trentm.com/json/>
9
9
*/
10
10
11
-
varVERSION='9.0.6';
11
+
varVERSION='10.0.0';
12
12
13
13
varp=console.warn;
14
14
varutil=require('util');
@@ -757,13 +757,22 @@ function isInteger(s) {
757
757
*
758
758
* 'a.b.c' -> ["a","b","c"]
759
759
* 'b["a"]' -> ["b","a"]
760
-
* 'b["a" + "c"]' -> ["b","ac"]
760
+
*
761
+
* Note: v10 made a backward incompatible change here that limits the supported
762
+
* *bracketed* lookups. A bracketed section of a lookup must be of one of the
763
+
* following forms:
764
+
* ["..."]
765
+
* ['...']
766
+
* [`...`]
767
+
* The quoted string is not evaluated, other than supporting a subset of JS
768
+
* string escapes (e.g. \', \", \n; but not unicode char escapes).
769
+
* See the long block comment below in this function for details.
761
770
*
762
771
* Optionally receives an alternative lookup delimiter (other than '.')
763
772
*/
764
773
functionparseLookup(lookup,lookupDelim){
765
774
vardebug=function(){};
766
-
//var debug = console.warn;
775
+
//var debug = console.warn;
767
776
768
777
varbits=[];
769
778
debug('\n*** '+lookup+' ***');
@@ -775,15 +784,35 @@ function parseLookup(lookup, lookupDelim) {
0 commit comments