alasql 4.21.1 → 4.21.2

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/bin/alasql-cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  //
4
4
  // Command line interface for Alasql
5
- // Version: 4.21.1
5
+ // Version: 4.21.2
6
6
  // Date: 28.07.2015
7
7
  // (c) 2014-2022, Andrey Gershun & Mathias Wulff
8
8
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.21.1 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.21.2 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.21.1
4
+ @version 4.21.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2025 Andrey Gershun & Mathias Wulff
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.21.1 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.21.2 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.21.1
4
+ @version 4.21.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2025 Andrey Gershun & Mathias Wulff
@@ -141,7 +141,7 @@ SOFTWARE.
141
141
  Current version of alasql
142
142
  @constant {string}
143
143
  */
144
- alasql.version = '4.21.1';
144
+ alasql.version = '4.21.2';
145
145
  alasql.build = 'develop-38bf3c39';
146
146
 
147
147
  /**
@@ -3052,7 +3052,7 @@ next:function () {
3052
3052
 
3053
3053
  // return next match that has a token
3054
3054
  lex:function lex () {
3055
- var r = this.next();
3055
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
3056
3056
  if (r) {
3057
3057
  return r;
3058
3058
  } else {
@@ -7383,7 +7383,7 @@ function queryfn3(query) {
7383
7383
 
7384
7384
  // Prepare variables
7385
7385
  query.data = [];
7386
- query.xgroups = {};
7386
+ query.xgroups=Object.create(null);
7387
7387
  query.groups = [];
7388
7388
 
7389
7389
  // Level of Joins
@@ -8472,7 +8472,7 @@ yy.Select = class Select {
8472
8472
  var converted = {};
8473
8473
  for (var key in r) {
8474
8474
  var colDef = table.xcolumns && table.xcolumns[key];
8475
- converted[key] = alasql.utils.typeConverter(r[key], colDef ? colDef.dbtypeid : null);
8475
+ var cv=alasql.utils.typeConverter(r[key], colDef ? colDef.dbtypeid : null);if(key==="__proto__"){Object.defineProperty(converted,key,{value:cv,writable:true,enumerable:true,configurable:true})}else{converted[key]=cv}
8476
8476
  }
8477
8477
  table.data.push(converted);
8478
8478
  `;
@@ -17481,22 +17481,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
17481
17481
  if (this.props && this.props.length > 0) {
17482
17482
  let fs;
17483
17483
  if (this.method === '@') {
17484
- fs = `alasql.vars['${this.variable}']`;
17484
+ fs = `alasql.vars[k('${this.variable}')]`;
17485
17485
  } else {
17486
- fs = `params['${this.variable}']`;
17486
+ fs = `params[k('${this.variable}')]`;
17487
17487
  }
17488
17488
  this.props.forEach(prop => {
17489
17489
  if (typeof prop === 'string') {
17490
- fs += `['${prop}']`;
17490
+ fs += `[k('${prop}')]`;
17491
17491
  } else if (typeof prop === 'number') {
17492
17492
  fs += `[${prop}]`;
17493
17493
  } else {
17494
17494
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
17495
- fs += `[${prop.toJS()}]`;
17495
+ fs += `[k(${prop.toJS()})]`;
17496
17496
  }
17497
17497
  });
17498
17498
 
17499
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
17499
+ new Function('value, params, alasql', `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);
17500
17500
  } else {
17501
17501
  if (this.method === '@') {
17502
17502
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.21.1 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.21.2 build: develop-38bf3c39 | © 2014-2025 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.21.1
4
+ @version 4.21.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2025 Andrey Gershun & Mathias Wulff
@@ -141,7 +141,7 @@ SOFTWARE.
141
141
  Current version of alasql
142
142
  @constant {string}
143
143
  */
144
- alasql.version = '4.21.1';
144
+ alasql.version = '4.21.2';
145
145
  alasql.build = 'develop-38bf3c39';
146
146
 
147
147
  /**
@@ -3052,7 +3052,7 @@ next:function () {
3052
3052
 
3053
3053
  // return next match that has a token
3054
3054
  lex:function lex () {
3055
- var r = this.next();
3055
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
3056
3056
  if (r) {
3057
3057
  return r;
3058
3058
  } else {
@@ -7383,7 +7383,7 @@ function queryfn3(query) {
7383
7383
 
7384
7384
  // Prepare variables
7385
7385
  query.data = [];
7386
- query.xgroups = {};
7386
+ query.xgroups=Object.create(null);
7387
7387
  query.groups = [];
7388
7388
 
7389
7389
  // Level of Joins
@@ -8472,7 +8472,7 @@ yy.Select = class Select {
8472
8472
  var converted = {};
8473
8473
  for (var key in r) {
8474
8474
  var colDef = table.xcolumns && table.xcolumns[key];
8475
- converted[key] = alasql.utils.typeConverter(r[key], colDef ? colDef.dbtypeid : null);
8475
+ var cv=alasql.utils.typeConverter(r[key], colDef ? colDef.dbtypeid : null);if(key==="__proto__"){Object.defineProperty(converted,key,{value:cv,writable:true,enumerable:true,configurable:true})}else{converted[key]=cv}
8476
8476
  }
8477
8477
  table.data.push(converted);
8478
8478
  `;
@@ -17481,22 +17481,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
17481
17481
  if (this.props && this.props.length > 0) {
17482
17482
  let fs;
17483
17483
  if (this.method === '@') {
17484
- fs = `alasql.vars['${this.variable}']`;
17484
+ fs = `alasql.vars[k('${this.variable}')]`;
17485
17485
  } else {
17486
- fs = `params['${this.variable}']`;
17486
+ fs = `params[k('${this.variable}')]`;
17487
17487
  }
17488
17488
  this.props.forEach(prop => {
17489
17489
  if (typeof prop === 'string') {
17490
- fs += `['${prop}']`;
17490
+ fs += `[k('${prop}')]`;
17491
17491
  } else if (typeof prop === 'number') {
17492
17492
  fs += `[${prop}]`;
17493
17493
  } else {
17494
17494
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
17495
- fs += `[${prop.toJS()}]`;
17495
+ fs += `[k(${prop.toJS()})]`;
17496
17496
  }
17497
17497
  });
17498
17498
 
17499
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
17499
+ new Function('value, params, alasql', `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);
17500
17500
  } else {
17501
17501
  if (this.method === '@') {
17502
17502
  alasql.vars[this.variable] = res;