alasql 4.8.1 → 4.8.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.8.1
5
+ // Version: 4.8.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.8.1 build: develop-916ff64e | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.8.2 build: develop-916ff64e | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.8.1
4
+ @version 4.8.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.8.1 build: develop-916ff64e | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.8.2 build: develop-916ff64e | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.8.1
4
+ @version 4.8.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.8.1';
144
+ alasql.version = '4.8.2';
145
145
  alasql.build = 'develop-916ff64e';
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
@@ -14859,22 +14859,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14859
14859
  if (this.props && this.props.length > 0) {
14860
14860
  let fs;
14861
14861
  if (this.method === '@') {
14862
- fs = `alasql.vars['${this.variable}']`;
14862
+ fs = `alasql.vars[k('${this.variable}')]`;
14863
14863
  } else {
14864
- fs = `params['${this.variable}']`;
14864
+ fs = `params[k('${this.variable}')]`;
14865
14865
  }
14866
14866
  this.props.forEach(prop => {
14867
14867
  if (typeof prop === 'string') {
14868
- fs += `['${prop}']`;
14868
+ fs += `[k('${prop}')]`;
14869
14869
  } else if (typeof prop === 'number') {
14870
14870
  fs += `[${prop}]`;
14871
14871
  } else {
14872
14872
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14873
- fs += `[${prop.toJS()}]`;
14873
+ fs += `[k(${prop.toJS()})]`;
14874
14874
  }
14875
14875
  });
14876
14876
 
14877
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14877
+ 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);
14878
14878
  } else {
14879
14879
  if (this.method === '@') {
14880
14880
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.8.1 build: develop-916ff64e | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.8.2 build: develop-916ff64e | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.8.1
4
+ @version 4.8.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.8.1';
144
+ alasql.version = '4.8.2';
145
145
  alasql.build = 'develop-916ff64e';
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
@@ -14859,22 +14859,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14859
14859
  if (this.props && this.props.length > 0) {
14860
14860
  let fs;
14861
14861
  if (this.method === '@') {
14862
- fs = `alasql.vars['${this.variable}']`;
14862
+ fs = `alasql.vars[k('${this.variable}')]`;
14863
14863
  } else {
14864
- fs = `params['${this.variable}']`;
14864
+ fs = `params[k('${this.variable}')]`;
14865
14865
  }
14866
14866
  this.props.forEach(prop => {
14867
14867
  if (typeof prop === 'string') {
14868
- fs += `['${prop}']`;
14868
+ fs += `[k('${prop}')]`;
14869
14869
  } else if (typeof prop === 'number') {
14870
14870
  fs += `[${prop}]`;
14871
14871
  } else {
14872
14872
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14873
- fs += `[${prop.toJS()}]`;
14873
+ fs += `[k(${prop.toJS()})]`;
14874
14874
  }
14875
14875
  });
14876
14876
 
14877
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14877
+ 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);
14878
14878
  } else {
14879
14879
  if (this.method === '@') {
14880
14880
  alasql.vars[this.variable] = res;