alasql 4.7.1 → 4.7.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.7.1
5
+ // Version: 4.7.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.7.1 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.7.2 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.7.1
4
+ @version 4.7.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.7.1 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.7.2 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.7.1
4
+ @version 4.7.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.7.1';
144
+ alasql.version = '4.7.2';
145
145
  alasql.build = 'develop-272b12b3';
146
146
 
147
147
  /**
@@ -2505,7 +2505,7 @@ next:function () {
2505
2505
 
2506
2506
  // return next match that has a token
2507
2507
  lex:function lex () {
2508
- var r = this.next();
2508
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2509
2509
  if (r) {
2510
2510
  return r;
2511
2511
  } else {
@@ -6575,7 +6575,7 @@ function queryfn3(query) {
6575
6575
 
6576
6576
  // Prepare variables
6577
6577
  query.data = [];
6578
- query.xgroups = {};
6578
+ query.xgroups=Object.create(null);
6579
6579
  query.groups = [];
6580
6580
 
6581
6581
  // Level of Joins
@@ -14840,22 +14840,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14840
14840
  if (this.props && this.props.length > 0) {
14841
14841
  let fs;
14842
14842
  if (this.method === '@') {
14843
- fs = `alasql.vars['${this.variable}']`;
14843
+ fs = `alasql.vars[k('${this.variable}')]`;
14844
14844
  } else {
14845
- fs = `params['${this.variable}']`;
14845
+ fs = `params[k('${this.variable}')]`;
14846
14846
  }
14847
14847
  this.props.forEach(prop => {
14848
14848
  if (typeof prop === 'string') {
14849
- fs += `['${prop}']`;
14849
+ fs += `[k('${prop}')]`;
14850
14850
  } else if (typeof prop === 'number') {
14851
14851
  fs += `[${prop}]`;
14852
14852
  } else {
14853
14853
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14854
- fs += `[${prop.toJS()}]`;
14854
+ fs += `[k(${prop.toJS()})]`;
14855
14855
  }
14856
14856
  });
14857
14857
 
14858
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14858
+ 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);
14859
14859
  } else {
14860
14860
  if (this.method === '@') {
14861
14861
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.7.1 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.7.2 build: develop-272b12b3 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.7.1
4
+ @version 4.7.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.7.1';
144
+ alasql.version = '4.7.2';
145
145
  alasql.build = 'develop-272b12b3';
146
146
 
147
147
  /**
@@ -2505,7 +2505,7 @@ next:function () {
2505
2505
 
2506
2506
  // return next match that has a token
2507
2507
  lex:function lex () {
2508
- var r = this.next();
2508
+ var r = this.next();if(r&&/^(N?['"]__proto__['"]|\[__proto__\]|`__proto__`|__proto__)$/i.test(this.yytext))throw new Error("__proto__ is not allowed");
2509
2509
  if (r) {
2510
2510
  return r;
2511
2511
  } else {
@@ -6575,7 +6575,7 @@ function queryfn3(query) {
6575
6575
 
6576
6576
  // Prepare variables
6577
6577
  query.data = [];
6578
- query.xgroups = {};
6578
+ query.xgroups=Object.create(null);
6579
6579
  query.groups = [];
6580
6580
 
6581
6581
  // Level of Joins
@@ -14840,22 +14840,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14840
14840
  if (this.props && this.props.length > 0) {
14841
14841
  let fs;
14842
14842
  if (this.method === '@') {
14843
- fs = `alasql.vars['${this.variable}']`;
14843
+ fs = `alasql.vars[k('${this.variable}')]`;
14844
14844
  } else {
14845
- fs = `params['${this.variable}']`;
14845
+ fs = `params[k('${this.variable}')]`;
14846
14846
  }
14847
14847
  this.props.forEach(prop => {
14848
14848
  if (typeof prop === 'string') {
14849
- fs += `['${prop}']`;
14849
+ fs += `[k('${prop}')]`;
14850
14850
  } else if (typeof prop === 'number') {
14851
14851
  fs += `[${prop}]`;
14852
14852
  } else {
14853
14853
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14854
- fs += `[${prop.toJS()}]`;
14854
+ fs += `[k(${prop.toJS()})]`;
14855
14855
  }
14856
14856
  });
14857
14857
 
14858
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14858
+ 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);
14859
14859
  } else {
14860
14860
  if (this.method === '@') {
14861
14861
  alasql.vars[this.variable] = res;