alasql 4.1.11 → 4.1.13
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 +1 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql.fs.js +19 -19
- package/dist/alasql.js +19 -19
- package/dist/alasql.min.js +12 -12
- package/package.json +1 -1
package/bin/alasql-cli.js
CHANGED
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.1.
|
|
1
|
+
//! AlaSQL v4.1.13 build: develop-1493d57a | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.1.
|
|
4
|
+
@version 4.1.13
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2023 Andrey Gershun & Mathias Wulff
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.1.
|
|
1
|
+
//! AlaSQL v4.1.13 build: develop-1493d57a | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.1.
|
|
4
|
+
@version 4.1.13
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2023 Andrey Gershun & Mathias Wulff
|
|
@@ -141,7 +141,7 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.1.
|
|
144
|
+
alasql.version = '4.1.13';
|
|
145
145
|
alasql.build = 'develop-1493d57a';
|
|
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 {
|
|
@@ -4019,11 +4019,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4019
4019
|
return +obj;
|
|
4020
4020
|
}
|
|
4021
4021
|
|
|
4022
|
-
var temp = new obj.constructor(); // changed
|
|
4022
|
+
var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4023
4023
|
|
|
4024
4024
|
for (var key in obj) {
|
|
4025
4025
|
if (obj.hasOwnProperty(key)) {
|
|
4026
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4026
|
+
/* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(temp, key, {value: cloneDeep(obj[key]), writable: true, enumerable: true, configurable: true}); } else { temp[key] = cloneDeep(obj[key]); }
|
|
4027
4027
|
}
|
|
4028
4028
|
}
|
|
4029
4029
|
return temp;
|
|
@@ -4095,7 +4095,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4095
4095
|
a = a || {};
|
|
4096
4096
|
for (var key in b) {
|
|
4097
4097
|
if (b.hasOwnProperty(key)) {
|
|
4098
|
-
a[key] = b[key];
|
|
4098
|
+
/* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(a, key, {value: b[key], writable: true, enumerable: true, configurable: true}); } else { a[key] = b[key]; }
|
|
4099
4099
|
}
|
|
4100
4100
|
}
|
|
4101
4101
|
return a;
|
|
@@ -6548,7 +6548,7 @@ function queryfn3(query) {
|
|
|
6548
6548
|
|
|
6549
6549
|
// Prepare variables
|
|
6550
6550
|
query.data = [];
|
|
6551
|
-
query.xgroups
|
|
6551
|
+
query.xgroups=Object.create(null);
|
|
6552
6552
|
query.groups = [];
|
|
6553
6553
|
|
|
6554
6554
|
// Level of Joins
|
|
@@ -8680,7 +8680,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8680
8680
|
aft2 = '';
|
|
8681
8681
|
|
|
8682
8682
|
if (typeof query.groupStar !== 'undefined') {
|
|
8683
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
8683
|
+
aft2 += "for(var f in p['" + query.groupStar + "']) {if(/^__proto__$/.test(f))Object.defineProperty(g,f,{writable:true,enumerable:true,configurable:true});g[f]=p['" + query.groupStar + "'][f];};";
|
|
8684
8684
|
}
|
|
8685
8685
|
|
|
8686
8686
|
/*
|
|
@@ -9123,7 +9123,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9123
9123
|
} else {
|
|
9124
9124
|
|
|
9125
9125
|
// if column not exist, then copy all
|
|
9126
|
-
sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
|
|
9126
|
+
sp += 'var w=p["' + alias + '"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
|
|
9127
9127
|
|
|
9128
9128
|
query.dirtyColumns = true;
|
|
9129
9129
|
}
|
|
@@ -9451,10 +9451,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
9451
9451
|
self.columns.forEach(function (col) {
|
|
9452
9452
|
|
|
9453
9453
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
9454
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
9454
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9455
9455
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
9456
9456
|
|
|
9457
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
9457
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9458
9458
|
return '';
|
|
9459
9459
|
|
|
9460
9460
|
} else {
|
|
@@ -12715,7 +12715,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
12715
12715
|
|
|
12716
12716
|
table.update(
|
|
12717
12717
|
function (t) {
|
|
12718
|
-
for (var f in r) t[f] = r[f];
|
|
12718
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
12719
12719
|
},
|
|
12720
12720
|
table.data.indexOf(toreplace),
|
|
12721
12721
|
params
|
|
@@ -14268,7 +14268,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
14268
14268
|
});
|
|
14269
14269
|
} else {
|
|
14270
14270
|
|
|
14271
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
14271
|
+
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
|
|
14272
14272
|
sw = JSONtoJS(values);
|
|
14273
14273
|
}
|
|
14274
14274
|
}
|
|
@@ -15337,19 +15337,19 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
15337
15337
|
}
|
|
15338
15338
|
if (this.props && this.props.length > 0) {
|
|
15339
15339
|
if (this.method == '@') {
|
|
15340
|
-
var fs = "alasql.vars['"
|
|
15340
|
+
var fs = "alasql.vars[k('"+this.variable+"')]";
|
|
15341
15341
|
} else {
|
|
15342
|
-
var fs = "params['"
|
|
15342
|
+
var fs = "params[k('"+this.variable+"')]";
|
|
15343
15343
|
}
|
|
15344
15344
|
fs += this.props
|
|
15345
15345
|
.map(function (prop) {
|
|
15346
15346
|
if (typeof prop == 'string') {
|
|
15347
|
-
return "['"
|
|
15347
|
+
return "[k('"+prop+"')]";
|
|
15348
15348
|
} else if (typeof prop == 'number') {
|
|
15349
15349
|
return '[' + prop + ']';
|
|
15350
15350
|
} else {
|
|
15351
15351
|
|
|
15352
|
-
return
|
|
15352
|
+
return "[k("+prop.toJS()+")]";
|
|
15353
15353
|
// } else {
|
|
15354
15354
|
|
|
15355
15355
|
// throw new Error('Wrong SET property');
|
|
@@ -15357,7 +15357,7 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
15357
15357
|
})
|
|
15358
15358
|
.join();
|
|
15359
15359
|
|
|
15360
|
-
new Function('value,params,alasql', 'var y;
|
|
15360
|
+
new Function('value,params,alasql', 'var y;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);
|
|
15361
15361
|
} else {
|
|
15362
15362
|
if (this.method == '@') {
|
|
15363
15363
|
alasql.vars[this.variable] = res;
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v4.1.
|
|
1
|
+
//! AlaSQL v4.1.13 build: develop-1493d57a | © 2014-2023 Andrey Gershun & Mathias Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 4.1.
|
|
4
|
+
@version 4.1.13
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2023 Andrey Gershun & Mathias Wulff
|
|
@@ -141,7 +141,7 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
141
141
|
Current version of alasql
|
|
142
142
|
@constant {string}
|
|
143
143
|
*/
|
|
144
|
-
alasql.version = '4.1.
|
|
144
|
+
alasql.version = '4.1.13';
|
|
145
145
|
alasql.build = 'develop-1493d57a';
|
|
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 {
|
|
@@ -4019,11 +4019,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4019
4019
|
return +obj;
|
|
4020
4020
|
}
|
|
4021
4021
|
|
|
4022
|
-
var temp = new obj.constructor(); // changed
|
|
4022
|
+
var temp = new (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4023
4023
|
|
|
4024
4024
|
for (var key in obj) {
|
|
4025
4025
|
if (obj.hasOwnProperty(key)) {
|
|
4026
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4026
|
+
/* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(temp, key, {value: cloneDeep(obj[key]), writable: true, enumerable: true, configurable: true}); } else { temp[key] = cloneDeep(obj[key]); }
|
|
4027
4027
|
}
|
|
4028
4028
|
}
|
|
4029
4029
|
return temp;
|
|
@@ -4095,7 +4095,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4095
4095
|
a = a || {};
|
|
4096
4096
|
for (var key in b) {
|
|
4097
4097
|
if (b.hasOwnProperty(key)) {
|
|
4098
|
-
a[key] = b[key];
|
|
4098
|
+
/* A "__proto__" key from parsed data is copied as data, never as the prototype */ if (key === '__proto__') { Object.defineProperty(a, key, {value: b[key], writable: true, enumerable: true, configurable: true}); } else { a[key] = b[key]; }
|
|
4099
4099
|
}
|
|
4100
4100
|
}
|
|
4101
4101
|
return a;
|
|
@@ -6548,7 +6548,7 @@ function queryfn3(query) {
|
|
|
6548
6548
|
|
|
6549
6549
|
// Prepare variables
|
|
6550
6550
|
query.data = [];
|
|
6551
|
-
query.xgroups
|
|
6551
|
+
query.xgroups=Object.create(null);
|
|
6552
6552
|
query.groups = [];
|
|
6553
6553
|
|
|
6554
6554
|
// Level of Joins
|
|
@@ -8680,7 +8680,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
8680
8680
|
aft2 = '';
|
|
8681
8681
|
|
|
8682
8682
|
if (typeof query.groupStar !== 'undefined') {
|
|
8683
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
8683
|
+
aft2 += "for(var f in p['" + query.groupStar + "']) {if(/^__proto__$/.test(f))Object.defineProperty(g,f,{writable:true,enumerable:true,configurable:true});g[f]=p['" + query.groupStar + "'][f];};";
|
|
8684
8684
|
}
|
|
8685
8685
|
|
|
8686
8686
|
/*
|
|
@@ -9123,7 +9123,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9123
9123
|
} else {
|
|
9124
9124
|
|
|
9125
9125
|
// if column not exist, then copy all
|
|
9126
|
-
sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
|
|
9126
|
+
sp += 'var w=p["' + alias + '"];for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
|
|
9127
9127
|
|
|
9128
9128
|
query.dirtyColumns = true;
|
|
9129
9129
|
}
|
|
@@ -9451,10 +9451,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
9451
9451
|
self.columns.forEach(function (col) {
|
|
9452
9452
|
|
|
9453
9453
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
9454
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
9454
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9455
9455
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
9456
9456
|
|
|
9457
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
9457
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9458
9458
|
return '';
|
|
9459
9459
|
|
|
9460
9460
|
} else {
|
|
@@ -12715,7 +12715,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
12715
12715
|
|
|
12716
12716
|
table.update(
|
|
12717
12717
|
function (t) {
|
|
12718
|
-
for (var f in r) t[f] = r[f];
|
|
12718
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
12719
12719
|
},
|
|
12720
12720
|
table.data.indexOf(toreplace),
|
|
12721
12721
|
params
|
|
@@ -14268,7 +14268,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
14268
14268
|
});
|
|
14269
14269
|
} else {
|
|
14270
14270
|
|
|
14271
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
14271
|
+
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=w[k]};';
|
|
14272
14272
|
sw = JSONtoJS(values);
|
|
14273
14273
|
}
|
|
14274
14274
|
}
|
|
@@ -15337,19 +15337,19 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
15337
15337
|
}
|
|
15338
15338
|
if (this.props && this.props.length > 0) {
|
|
15339
15339
|
if (this.method == '@') {
|
|
15340
|
-
var fs = "alasql.vars['"
|
|
15340
|
+
var fs = "alasql.vars[k('"+this.variable+"')]";
|
|
15341
15341
|
} else {
|
|
15342
|
-
var fs = "params['"
|
|
15342
|
+
var fs = "params[k('"+this.variable+"')]";
|
|
15343
15343
|
}
|
|
15344
15344
|
fs += this.props
|
|
15345
15345
|
.map(function (prop) {
|
|
15346
15346
|
if (typeof prop == 'string') {
|
|
15347
|
-
return "['"
|
|
15347
|
+
return "[k('"+prop+"')]";
|
|
15348
15348
|
} else if (typeof prop == 'number') {
|
|
15349
15349
|
return '[' + prop + ']';
|
|
15350
15350
|
} else {
|
|
15351
15351
|
|
|
15352
|
-
return
|
|
15352
|
+
return "[k("+prop.toJS()+")]";
|
|
15353
15353
|
// } else {
|
|
15354
15354
|
|
|
15355
15355
|
// throw new Error('Wrong SET property');
|
|
@@ -15357,7 +15357,7 @@ yy.SetVariable.prototype.execute = function (databaseid, params, cb) {
|
|
|
15357
15357
|
})
|
|
15358
15358
|
.join();
|
|
15359
15359
|
|
|
15360
|
-
new Function('value,params,alasql', 'var y;
|
|
15360
|
+
new Function('value,params,alasql', 'var y;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);
|
|
15361
15361
|
} else {
|
|
15362
15362
|
if (this.method == '@') {
|
|
15363
15363
|
alasql.vars[this.variable] = res;
|