@dra2020/baseclient 1.0.146 → 1.0.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseclient.js +10 -5
- package/dist/baseclient.js.map +1 -1
- package/lib/detail/detail.ts +10 -5
- package/package.json +1 -1
package/lib/detail/detail.ts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
import * as Util from '../util/all';
|
|
15
15
|
//import { Util } from '@dra2020/baseclient';
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const reIdentifierOrStringOrNumber = /([a-zA-Z0-9_$][a-zA-Z0-9_$]*)|(['"])(?:(?=(\\?))\3.)*?\2/g;
|
|
18
|
+
const reNumber = /[0-9][0-9]*/;
|
|
19
19
|
const reParam = /^__\d+$/;
|
|
20
20
|
const reString = /^['"]/;
|
|
21
21
|
|
|
@@ -73,10 +73,12 @@ class Evaluator
|
|
|
73
73
|
let safenames = names.map(n => namemap[n]);
|
|
74
74
|
|
|
75
75
|
// Replace valid identifiers with safe version
|
|
76
|
-
safeexpr = safeexpr.replace(
|
|
76
|
+
safeexpr = safeexpr.replace(reIdentifierOrStringOrNumber,
|
|
77
77
|
(match) => {
|
|
78
78
|
if (namemap[match])
|
|
79
79
|
return namemap[match];
|
|
80
|
+
else if (reNumber.test(match))
|
|
81
|
+
return match;
|
|
80
82
|
else if (match === '__format' || reString.test(match))
|
|
81
83
|
return match;
|
|
82
84
|
else
|
|
@@ -87,9 +89,12 @@ class Evaluator
|
|
|
87
89
|
});
|
|
88
90
|
|
|
89
91
|
// Remove any identifiers that aren't the simple parameters to prevent out-of-sandbox execution
|
|
90
|
-
safeexpr = safeexpr.replace(
|
|
92
|
+
safeexpr = safeexpr.replace(reIdentifierOrStringOrNumber,
|
|
91
93
|
(match) => {
|
|
92
|
-
let valid = reParam.test(match)
|
|
94
|
+
let valid = reParam.test(match)
|
|
95
|
+
|| match === '__format'
|
|
96
|
+
|| reString.test(match)
|
|
97
|
+
|| reNumber.test(match);
|
|
93
98
|
if (valid)
|
|
94
99
|
return match;
|
|
95
100
|
else
|