alasql 4.6.7 → 4.6.8

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.6.7
5
+ // Version: 4.6.8
6
6
  // Date: 28.07.2015
7
7
  // (c) 2014-2022, Andrey Gershun & Mathias Wulff
8
8
  //
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.6.7 build: develop-f6e298b2 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.8 build: develop-f6e298b2 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.7
4
+ @version 4.6.8
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.6.7 build: develop-f6e298b2 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.8 build: develop-f6e298b2 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.7
4
+ @version 4.6.8
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.6.7';
144
+ alasql.version = '4.6.8';
145
145
  alasql.build = 'develop-f6e298b2';
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 {
@@ -6562,7 +6562,7 @@ function queryfn3(query) {
6562
6562
 
6563
6563
  // Prepare variables
6564
6564
  query.data = [];
6565
- query.xgroups = {};
6565
+ query.xgroups=Object.create(null);
6566
6566
  query.groups = [];
6567
6567
 
6568
6568
  // Level of Joins
@@ -14827,22 +14827,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14827
14827
  if (this.props && this.props.length > 0) {
14828
14828
  let fs;
14829
14829
  if (this.method === '@') {
14830
- fs = `alasql.vars['${this.variable}']`;
14830
+ fs = `alasql.vars[k('${this.variable}')]`;
14831
14831
  } else {
14832
- fs = `params['${this.variable}']`;
14832
+ fs = `params[k('${this.variable}')]`;
14833
14833
  }
14834
14834
  this.props.forEach(prop => {
14835
14835
  if (typeof prop === 'string') {
14836
- fs += `['${prop}']`;
14836
+ fs += `[k('${prop}')]`;
14837
14837
  } else if (typeof prop === 'number') {
14838
14838
  fs += `[${prop}]`;
14839
14839
  } else {
14840
14840
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14841
- fs += `[${prop.toJS()}]`;
14841
+ fs += `[k(${prop.toJS()})]`;
14842
14842
  }
14843
14843
  });
14844
14844
 
14845
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14845
+ 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);
14846
14846
  } else {
14847
14847
  if (this.method === '@') {
14848
14848
  alasql.vars[this.variable] = res;
package/dist/alasql.js CHANGED
@@ -1,7 +1,7 @@
1
- //! AlaSQL v4.6.7 build: develop-f6e298b2 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
1
+ //! AlaSQL v4.6.8 build: develop-f6e298b2 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT
2
2
  /*
3
3
  @module alasql
4
- @version 4.6.7
4
+ @version 4.6.8
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.6.7';
144
+ alasql.version = '4.6.8';
145
145
  alasql.build = 'develop-f6e298b2';
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 {
@@ -6562,7 +6562,7 @@ function queryfn3(query) {
6562
6562
 
6563
6563
  // Prepare variables
6564
6564
  query.data = [];
6565
- query.xgroups = {};
6565
+ query.xgroups=Object.create(null);
6566
6566
  query.groups = [];
6567
6567
 
6568
6568
  // Level of Joins
@@ -14827,22 +14827,22 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
14827
14827
  if (this.props && this.props.length > 0) {
14828
14828
  let fs;
14829
14829
  if (this.method === '@') {
14830
- fs = `alasql.vars['${this.variable}']`;
14830
+ fs = `alasql.vars[k('${this.variable}')]`;
14831
14831
  } else {
14832
- fs = `params['${this.variable}']`;
14832
+ fs = `params[k('${this.variable}')]`;
14833
14833
  }
14834
14834
  this.props.forEach(prop => {
14835
14835
  if (typeof prop === 'string') {
14836
- fs += `['${prop}']`;
14836
+ fs += `[k('${prop}')]`;
14837
14837
  } else if (typeof prop === 'number') {
14838
14838
  fs += `[${prop}]`;
14839
14839
  } else {
14840
14840
  // Assuming prop.toJS() is a method that converts prop to a JavaScript expression.
14841
- fs += `[${prop.toJS()}]`;
14841
+ fs += `[k(${prop.toJS()})]`;
14842
14842
  }
14843
14843
  });
14844
14844
 
14845
- new Function('value, params, alasql', `${fs} = value`)(res, params, alasql);
14845
+ 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);
14846
14846
  } else {
14847
14847
  if (this.method === '@') {
14848
14848
  alasql.vars[this.variable] = res;