alasql 4.4.1 → 4.4.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.4.1
5
+ // Version: 4.4.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.4.1 build: develop-b9447ae3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.4.2 build: develop-b9447ae3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.4.1
4
+ @version 4.4.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 Andrey Gershun & Mathias Wulff
package/dist/alasql.fs.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.4.1 build: develop-b9447ae3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.4.2 build: develop-b9447ae3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.4.1
4
+ @version 4.4.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 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.4.1';
144
+ alasql.version = '4.4.2';
145
145
  alasql.build = 'develop-b9447ae3';
146
146
 
147
147
  /**
@@ -2497,7 +2497,7 @@ next:function () {
2497
2497
 
2498
2498
  // return next match that has a token
2499
2499
  lex:function lex () {
2500
- var r = this.next();
2500
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2501
2501
  if (r) {
2502
2502
  return r;
2503
2503
  } else {
@@ -6533,7 +6533,7 @@ function queryfn3(query) {
6533
6533
 
6534
6534
  // Prepare variables
6535
6535
  query.data = [];
6536
- query.xgroups = {};
6536
+ query.xgroups=Object.create(null);
6537
6537
  query.groups = [];
6538
6538
 
6539
6539
  // Level of Joins
@@ -14595,22 +14595,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14595
14595
  if (this.props && this.props.length > 0) {
14596
14596
  let fs;
14597
14597
  if (this.method === '@') {
14598
- fs = `alasql.vars['${this.variable}']`;
14598
+ fs = `alasql.vars[k('${this.variable}')]`;
14599
14599
  } else {
14600
- fs = `params['${this.variable}']`;
14600
+ fs = `params[k('${this.variable}')]`;
14601
14601
  }
14602
14602
  this.props.forEach(prop => {
14603
14603
  if (typeof prop === 'string') {
14604
- fs += `['${prop}']`;
14604
+ fs += `[k('${prop}')]`;
14605
14605
  } else if (typeof prop === 'number') {
14606
14606
  fs += `[${prop}]`;
14607
14607
  } else {
14608
14608
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14609
- fs += `[${prop.toJS()}]`;
14609
+ fs += `[k(${prop.toJS()})]`;
14610
14610
  }
14611
14611
  });
14612
14612
 
14613
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14613
+ 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);
14614
14614
  } else {
14615
14615
  if (this.method === '@') {
14616
14616
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.4.1 build: develop-b9447ae3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.4.2 build: develop-b9447ae3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.4.1
4
+ @version 4.4.2
5
5
 
6
6
  AlaSQL - JavaScript SQL database
7
7
  © 2014-2024 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.4.1';
144
+ alasql.version = '4.4.2';
145
145
  alasql.build = 'develop-b9447ae3';
146
146
 
147
147
  /**
@@ -2497,7 +2497,7 @@ next:function () {
2497
2497
 
2498
2498
  // return next match that has a token
2499
2499
  lex:function lex () {
2500
- var r = this.next();
2500
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2501
2501
  if (r) {
2502
2502
  return r;
2503
2503
  } else {
@@ -6533,7 +6533,7 @@ function queryfn3(query) {
6533
6533
 
6534
6534
  // Prepare variables
6535
6535
  query.data = [];
6536
- query.xgroups = {};
6536
+ query.xgroups=Object.create(null);
6537
6537
  query.groups = [];
6538
6538
 
6539
6539
  // Level of Joins
@@ -14595,22 +14595,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14595
14595
  if (this.props && this.props.length > 0) {
14596
14596
  let fs;
14597
14597
  if (this.method === '@') {
14598
- fs = `alasql.vars['${this.variable}']`;
14598
+ fs = `alasql.vars[k('${this.variable}')]`;
14599
14599
  } else {
14600
- fs = `params['${this.variable}']`;
14600
+ fs = `params[k('${this.variable}')]`;
14601
14601
  }
14602
14602
  this.props.forEach(prop => {
14603
14603
  if (typeof prop === 'string') {
14604
- fs += `['${prop}']`;
14604
+ fs += `[k('${prop}')]`;
14605
14605
  } else if (typeof prop === 'number') {
14606
14606
  fs += `[${prop}]`;
14607
14607
  } else {
14608
14608
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14609
- fs += `[${prop.toJS()}]`;
14609
+ fs += `[k(${prop.toJS()})]`;
14610
14610
  }
14611
14611
  });
14612
14612
 
14613
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14613
+ 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);
14614
14614
  } else {
14615
14615
  if (this.method === '@') {
14616
14616
  alasql.vars[this.variable] = res;