alasql 2.4.3 → 2.4.4

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.
@@ -1,7 +1,7 @@
1
- //! AlaSQL v2.4.3 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v2.4.4 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 2.4.3
4
+ @version 2.4.4
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2023 Andrey Gershun & Mathias Wulff
@@ -416,7 +416,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
416
416
  // });
417
417
  // Prepare variables
418
418
  query.data = [];
419
- query.xgroups = {};
419
+ query.xgroups=Object.create(null);
420
420
  query.groups = [];
421
421
  // Level of Joins
422
422
  var h = 0;
@@ -1934,7 +1934,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
1934
1934
  /**
1935
1935
  Current version of alasql
1936
1936
  @constant {string}
1937
- */ alasql.version = "2.4.3";
1937
+ */ alasql.version = "2.4.4";
1938
1938
  /**
1939
1939
  Debug flag
1940
1940
  @type {boolean}
@@ -46442,7 +46442,7 @@ var __dirname = '';
46442
46442
  },
46443
46443
  // return next match that has a token
46444
46444
  lex: function lex() {
46445
- var r = this.next();
46445
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
46446
46446
  if (r) {
46447
46447
  return r;
46448
46448
  } else {
@@ -56933,22 +56933,22 @@ if(false) {
56933
56933
  }
56934
56934
  if (this.props && this.props.length > 0) {
56935
56935
  if (this.method == "@") {
56936
- var fs = "alasql.vars['" + this.variable + "']";
56936
+ var fs = "alasql.vars[k('"+this.variable+"')]";
56937
56937
  } else {
56938
- var fs = "params['" + this.variable + "']";
56938
+ var fs = "params[k('"+this.variable+"')]";
56939
56939
  }
56940
56940
  fs += this.props.map(function(prop) {
56941
56941
  if (typeof prop == "string") {
56942
- return "['" + prop + "']";
56942
+ return "[k('"+prop+"')]";
56943
56943
  } else if (typeof prop == "number") {
56944
56944
  return "[" + prop + "]";
56945
56945
  } else {
56946
- return "[" + prop.toJS() + "]";
56946
+ return "[k("+prop.toJS()+")]";
56947
56947
  // } else {
56948
56948
  // throw new Error('Wrong SET property');
56949
56949
  }
56950
56950
  }).join();
56951
- new Function("value,params,alasql", "var y;" + fs + "=value")(res, params, alasql);
56951
+ new Function("value,params,alasql", 'var y;var k=function(x){if(x==="__proto__"||x==="constructor"||x==="prototype")throw new Error(x+" is not allowed");return x};'+fs+'=value')(res, params, alasql);
56952
56952
  } else {
56953
56953
  if (this.method == "@") {
56954
56954
  alasql.vars[this.variable] = res;
@@ -1,7 +1,7 @@
1
- //! AlaSQL v2.4.3 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v2.4.4 | © 2014-2022 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 2.4.3
4
+ @version 2.4.4
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2023 Andrey Gershun & Mathias Wulff
@@ -416,7 +416,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
416
416
  // });
417
417
  // Prepare variables
418
418
  query.data = [];
419
- query.xgroups = {};
419
+ query.xgroups=Object.create(null);
420
420
  query.groups = [];
421
421
  // Level of Joins
422
422
  var h = 0;
@@ -1934,7 +1934,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
1934
1934
  /**
1935
1935
  Current version of alasql
1936
1936
  @constant {string}
1937
- */ alasql.version = "2.4.3";
1937
+ */ alasql.version = "2.4.4";
1938
1938
  /**
1939
1939
  Debug flag
1940
1940
  @type {boolean}
@@ -46445,7 +46445,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
46445
46445
  },
46446
46446
  // return next match that has a token
46447
46447
  lex: function lex() {
46448
- var r = this.next();
46448
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
46449
46449
  if (r) {
46450
46450
  return r;
46451
46451
  } else {
@@ -56944,22 +56944,22 @@ if(false) {
56944
56944
  }
56945
56945
  if (this.props && this.props.length > 0) {
56946
56946
  if (this.method == "@") {
56947
- var fs = "alasql.vars['" + this.variable + "']";
56947
+ var fs = "alasql.vars[k('"+this.variable+"')]";
56948
56948
  } else {
56949
- var fs = "params['" + this.variable + "']";
56949
+ var fs = "params[k('"+this.variable+"')]";
56950
56950
  }
56951
56951
  fs += this.props.map(function(prop) {
56952
56952
  if (typeof prop == "string") {
56953
- return "['" + prop + "']";
56953
+ return "[k('"+prop+"')]";
56954
56954
  } else if (typeof prop == "number") {
56955
56955
  return "[" + prop + "]";
56956
56956
  } else {
56957
- return "[" + prop.toJS() + "]";
56957
+ return "[k("+prop.toJS()+")]";
56958
56958
  // } else {
56959
56959
  // throw new Error('Wrong SET property');
56960
56960
  }
56961
56961
  }).join();
56962
- new Function("value,params,alasql", "var y;" + fs + "=value")(res, params, alasql);
56962
+ new Function("value,params,alasql", 'var y;var k=function(x){if(x==="__proto__"||x==="constructor"||x==="prototype")throw new Error(x+" is not allowed");return x};'+fs+'=value')(res, params, alasql);
56963
56963
  } else {
56964
56964
  if (this.method == "@") {
56965
56965
  alasql.vars[this.variable] = res;