alasql 4.5.3 → 4.5.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.
package/bin/alasql-cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  //
4
4
  // Command line interface for Alasql
5
- // Version: 4.5.3
5
+ // Version: 4.5.4
6
6
  // Date: 28.07.2015
7
7
  // (c) 2014-2022, Andrey Gershun & Mathias Wulff
8
8
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.5.3 build: develop-a7daf2ff | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.5.4 build: develop-a7daf2ff | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.5.3
4
+ @version 4.5.4
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.5.3 build: develop-a7daf2ff | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.5.4 build: develop-a7daf2ff | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.5.3
4
+ @version 4.5.4
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.5.3';
144
+ alasql.version = '4.5.4';
145
145
  alasql.build = 'develop-a7daf2ff';
146
146
 
147
147
  /**
@@ -2502,7 +2502,7 @@ next:function () {
2502
2502
 
2503
2503
  // return next match that has a token
2504
2504
  lex:function lex () {
2505
- var r = this.next();
2505
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2506
2506
  if (r) {
2507
2507
  return r;
2508
2508
  } else {
@@ -6542,7 +6542,7 @@ function queryfn3(query) {
6542
6542
 
6543
6543
  // Prepare variables
6544
6544
  query.data = [];
6545
- query.xgroups = {};
6545
+ query.xgroups=Object.create(null);
6546
6546
  query.groups = [];
6547
6547
 
6548
6548
  // Level of Joins
@@ -14633,22 +14633,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14633
14633
  if (this.props && this.props.length > 0) {
14634
14634
  let fs;
14635
14635
  if (this.method === '@') {
14636
- fs = `alasql.vars['${this.variable}']`;
14636
+ fs = `alasql.vars[k('${this.variable}')]`;
14637
14637
  } else {
14638
- fs = `params['${this.variable}']`;
14638
+ fs = `params[k('${this.variable}')]`;
14639
14639
  }
14640
14640
  this.props.forEach(prop => {
14641
14641
  if (typeof prop === 'string') {
14642
- fs += `['${prop}']`;
14642
+ fs += `[k('${prop}')]`;
14643
14643
  } else if (typeof prop === 'number') {
14644
14644
  fs += `[${prop}]`;
14645
14645
  } else {
14646
14646
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14647
- fs += `[${prop.toJS()}]`;
14647
+ fs += `[k(${prop.toJS()})]`;
14648
14648
  }
14649
14649
  });
14650
14650
 
14651
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14651
+ 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);
14652
14652
  } else {
14653
14653
  if (this.method === '@') {
14654
14654
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.5.3 build: develop-a7daf2ff | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.5.4 build: develop-a7daf2ff | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.5.3
4
+ @version 4.5.4
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.5.3';
144
+ alasql.version = '4.5.4';
145
145
  alasql.build = 'develop-a7daf2ff';
146
146
 
147
147
  /**
@@ -2502,7 +2502,7 @@ next:function () {
2502
2502
 
2503
2503
  // return next match that has a token
2504
2504
  lex:function lex () {
2505
- var r = this.next();
2505
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2506
2506
  if (r) {
2507
2507
  return r;
2508
2508
  } else {
@@ -6542,7 +6542,7 @@ function queryfn3(query) {
6542
6542
 
6543
6543
  // Prepare variables
6544
6544
  query.data = [];
6545
- query.xgroups = {};
6545
+ query.xgroups=Object.create(null);
6546
6546
  query.groups = [];
6547
6547
 
6548
6548
  // Level of Joins
@@ -14633,22 +14633,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14633
14633
  if (this.props && this.props.length > 0) {
14634
14634
  let fs;
14635
14635
  if (this.method === '@') {
14636
- fs = `alasql.vars['${this.variable}']`;
14636
+ fs = `alasql.vars[k('${this.variable}')]`;
14637
14637
  } else {
14638
- fs = `params['${this.variable}']`;
14638
+ fs = `params[k('${this.variable}')]`;
14639
14639
  }
14640
14640
  this.props.forEach(prop => {
14641
14641
  if (typeof prop === 'string') {
14642
- fs += `['${prop}']`;
14642
+ fs += `[k('${prop}')]`;
14643
14643
  } else if (typeof prop === 'number') {
14644
14644
  fs += `[${prop}]`;
14645
14645
  } else {
14646
14646
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14647
- fs += `[${prop.toJS()}]`;
14647
+ fs += `[k(${prop.toJS()})]`;
14648
14648
  }
14649
14649
  });
14650
14650
 
14651
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14651
+ 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);
14652
14652
  } else {
14653
14653
  if (this.method === '@') {
14654
14654
  alasql.vars[this.variable] = res;