@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/dist/baseclient.js
CHANGED
|
@@ -1245,8 +1245,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1245
1245
|
exports.FormatDetail = void 0;
|
|
1246
1246
|
const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
|
|
1247
1247
|
//import { Util } from '@dra2020/baseclient';
|
|
1248
|
-
const
|
|
1249
|
-
const
|
|
1248
|
+
const reIdentifierOrStringOrNumber = /([a-zA-Z0-9_$][a-zA-Z0-9_$]*)|(['"])(?:(?=(\\?))\3.)*?\2/g;
|
|
1249
|
+
const reNumber = /[0-9][0-9]*/;
|
|
1250
1250
|
const reParam = /^__\d+$/;
|
|
1251
1251
|
const reString = /^['"]/;
|
|
1252
1252
|
// Number format: (locale|general|integer|currency).precision
|
|
@@ -1284,9 +1284,11 @@ class Evaluator {
|
|
|
1284
1284
|
let safeexpr = this.expr;
|
|
1285
1285
|
let safenames = names.map(n => namemap[n]);
|
|
1286
1286
|
// Replace valid identifiers with safe version
|
|
1287
|
-
safeexpr = safeexpr.replace(
|
|
1287
|
+
safeexpr = safeexpr.replace(reIdentifierOrStringOrNumber, (match) => {
|
|
1288
1288
|
if (namemap[match])
|
|
1289
1289
|
return namemap[match];
|
|
1290
|
+
else if (reNumber.test(match))
|
|
1291
|
+
return match;
|
|
1290
1292
|
else if (match === '__format' || reString.test(match))
|
|
1291
1293
|
return match;
|
|
1292
1294
|
else {
|
|
@@ -1295,8 +1297,11 @@ class Evaluator {
|
|
|
1295
1297
|
}
|
|
1296
1298
|
});
|
|
1297
1299
|
// Remove any identifiers that aren't the simple parameters to prevent out-of-sandbox execution
|
|
1298
|
-
safeexpr = safeexpr.replace(
|
|
1299
|
-
let valid = reParam.test(match)
|
|
1300
|
+
safeexpr = safeexpr.replace(reIdentifierOrStringOrNumber, (match) => {
|
|
1301
|
+
let valid = reParam.test(match)
|
|
1302
|
+
|| match === '__format'
|
|
1303
|
+
|| reString.test(match)
|
|
1304
|
+
|| reNumber.test(match);
|
|
1300
1305
|
if (valid)
|
|
1301
1306
|
return match;
|
|
1302
1307
|
else {
|