alasql 0.7.0 → 0.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/CHANGELOG.md +7 -2
- package/README.md +5 -3
- package/bin/alasql-cli.js +1 -1
- package/dist/alasql-worker.js +2 -2
- package/dist/alasql-worker.min.js +1 -1
- package/dist/alasql.fs.js +12 -12
- package/dist/alasql.js +12 -12
- package/dist/alasql.min.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
## 0.7.
|
|
4
|
+
## 0.7.1 (2021-03-05)
|
|
5
5
|
|
|
6
|
-
-
|
|
6
|
+
- Bump: Update lodash dependency
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## 0.7.0 (2021-03-03)
|
|
10
|
+
|
|
11
|
+
- Fix: Code injection vulnerability processing literals
|
|
7
12
|
- Fix: Return empty results in group by when input is empty #927
|
|
8
13
|
|
|
9
14
|
|
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<h2>
|
|
2
|
+
Please use version 0.7 as prior versions has a security flaw if you use user generated data to concat your SQL strings instead of providing them as a parameters to AlaSQL.
|
|
3
|
+
</h2>
|
|
4
|
+
|
|
1
5
|
_AlaSQL is an open source project used on more than two million page views per month - and we appreciate any and all contributions we can get. [Please help out](https://github.com/agershun/alasql/labels/Please%20help%20out%21)._
|
|
2
6
|
|
|
3
7
|
_Have a question? Ask on [Stack Overflow](http://stackoverflow.com/questions/ask?tags=AlaSQL) using the "alasql" tag._
|
|
@@ -23,9 +27,7 @@ _Have a question? Ask on [Stack Overflow](http://stackoverflow.com/questions/ask
|
|
|
23
27
|
<h2 align="center"><a href="http://alasql.org"><img src="https://cloud.githubusercontent.com/assets/1063454/19309516/94f8007e-9085-11e6-810f-62fd60b42185.png" alt="AlaSQL logo" styl="max-width:80%"/></a>
|
|
24
28
|
</h2>
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
Please use version 0.7 - prior versions has a security flaw if you concat your SQL strings instead of providing them as a parameter to AlaSQL.
|
|
28
|
-
</h2>
|
|
30
|
+
|
|
29
31
|
|
|
30
32
|
AlaSQL - _( [à la](http://en.wiktionary.org/wiki/%C3%A0_la) [SQL](http://en.wikipedia.org/wiki/SQL) ) [ælæ ɛskju:ɛl]_ - is an open source SQL database for JavaScript with a strong focus on query speed and data source flexibility for both relational data and schemaless data. It works in the web browser, Node.js, and mobile apps.
|
|
31
33
|
|
package/bin/alasql-cli.js
CHANGED
package/dist/alasql-worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v0.7.
|
|
1
|
+
//! AlaSQL v0.7.2 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 0.7.
|
|
4
|
+
@version 0.7.2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
//! AlaSQL v0.7.
|
|
1
|
+
//! AlaSQL v0.7.2 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
!function(r,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():r.alasql=e()}(this,function(){function i(r,e,t){"function"==typeof(e=e||[])&&(scope=t,t=e,e=[]),"object"!=typeof e&&(e=[e]);var o=i.lastid++;i.buffer[o]=t,i.webworker.postMessage({id:o,sql:r,params:e})}var s;if(i.options={},i.options.progress=function(){},isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)},i.promise=function(){throw new Error("Please include a Promise/A+ library")},"undefined"!=typeof Promise&&(s=function(r,e,n,s){return new Promise(function(t,o){i(r,e,function(r,e){e?o(e):(n&&s&&!1!==i.options.progress&&i.options.progress(n,s),t(r))})})},i.promise=function(r,e){if("undefined"==typeof Promise)throw new Error("Please include a Promise/A+ library");if("string"==typeof r)return s(r,e);if(!isArray(r)||r.length<1||void 0!==e)throw new Error("Error in .promise parameters");return function(r){if(!(r.length<1)){for(var e,t,o=[],n=0;n<r.length;n++){if("string"==typeof(t=r[n])&&(t=[t]),!isArray(t)||t.length<1||2<t.length)throw new Error("Error in .promise parameter");e=t[0],t=t[1]||void 0,o.push(s(e,t,n,r.length))}return Promise.all(o)}}(r)}),!(i=i||!1))throw new Error("alasql was not found");return i.worker=function(){throw new Error("Can find webworker in this enviroment")},"undefined"!=typeof Worker&&(i.worker=function(r,e,t){if(void 0===(r=!0===r?void 0:r))for(var o=document.getElementsByTagName("script"),n=0;n<o.length;n++){if("alasql-worker.js"===o[n].src.substr(-16).toLowerCase()){r=o[n].src.substr(0,o[n].src.length-16)+"alasql.js";break}if("alasql-worker.min.js"===o[n].src.substr(-20).toLowerCase()){r=o[n].src.substr(0,o[n].src.length-20)+"alasql.min.js";break}if("alasql.js"===o[n].src.substr(-9).toLowerCase()){r=o[n].src;break}if("alasql.min.js"===o[n].src.substr(-13).toLowerCase()){r=o[n].src.substr(0,o[n].src.length-13)+"alasql.min.js";break}}if(void 0===r)throw new Error("Path to alasql.js is not specified");var s;!1!==r?(s="importScripts('",s+=r,s+="');self.onmessage = function(event) {alasql(event.data.sql,event.data.params, function(data){postMessage({id:event.data.id, data:data});});}",s=new Blob([s],{type:"text/plain"}),i.webworker=new Worker(URL.createObjectURL(s)),i.webworker.onmessage=function(r){var e=r.data.id;i.buffer[e](r.data.data),delete i.buffer[e]},i.webworker.onerror=function(r){throw r},1<arguments.length&&i("REQUIRE "+e.map(function(r){return'"'+r+'"'}).join(","),[],t)):!1===r&&delete i.webworker}),i.lastid=0,i.buffer={},i.worker(),i});
|
package/dist/alasql.fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v0.7.
|
|
1
|
+
//! AlaSQL v0.7.2 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 0.7.
|
|
4
|
+
@version 0.7.2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
142
142
|
Current version of alasql
|
|
143
143
|
@constant {string}
|
|
144
144
|
*/
|
|
145
|
-
alasql.version = '0.7.
|
|
145
|
+
alasql.version = '0.7.2';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -4027,11 +4027,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4027
4027
|
return +obj;
|
|
4028
4028
|
}
|
|
4029
4029
|
|
|
4030
|
-
var temp = obj.constructor(); // changed
|
|
4030
|
+
var temp = (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4031
4031
|
|
|
4032
4032
|
for (var key in obj) {
|
|
4033
4033
|
if (obj.hasOwnProperty(key)) {
|
|
4034
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4034
|
+
/* 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]); }
|
|
4035
4035
|
}
|
|
4036
4036
|
}
|
|
4037
4037
|
return temp;
|
|
@@ -4103,7 +4103,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4103
4103
|
a = a || {};
|
|
4104
4104
|
for (var key in b) {
|
|
4105
4105
|
if (b.hasOwnProperty(key)) {
|
|
4106
|
-
a[key] = b[key];
|
|
4106
|
+
/* 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]; }
|
|
4107
4107
|
}
|
|
4108
4108
|
}
|
|
4109
4109
|
return a;
|
|
@@ -9061,7 +9061,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
9061
9061
|
aft2 = '';
|
|
9062
9062
|
|
|
9063
9063
|
if (typeof query.groupStar !== 'undefined') {
|
|
9064
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
9064
|
+
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];};";
|
|
9065
9065
|
}
|
|
9066
9066
|
|
|
9067
9067
|
/*
|
|
@@ -9384,7 +9384,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9384
9384
|
} else {
|
|
9385
9385
|
|
|
9386
9386
|
// if column not exist, then copy all
|
|
9387
|
-
sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
|
|
9387
|
+
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]};';
|
|
9388
9388
|
|
|
9389
9389
|
query.dirtyColumns = true;
|
|
9390
9390
|
}
|
|
@@ -9713,10 +9713,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
9713
9713
|
self.columns.forEach(function (col) {
|
|
9714
9714
|
|
|
9715
9715
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
9716
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
9716
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9717
9717
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
9718
9718
|
|
|
9719
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
9719
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9720
9720
|
return '';
|
|
9721
9721
|
|
|
9722
9722
|
} else {
|
|
@@ -13022,7 +13022,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
13022
13022
|
|
|
13023
13023
|
table.update(
|
|
13024
13024
|
function (t) {
|
|
13025
|
-
for (var f in r) t[f] = r[f];
|
|
13025
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
13026
13026
|
},
|
|
13027
13027
|
table.data.indexOf(toreplace),
|
|
13028
13028
|
params
|
|
@@ -14568,7 +14568,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
14568
14568
|
});
|
|
14569
14569
|
} else {
|
|
14570
14570
|
|
|
14571
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
14571
|
+
// 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]};';
|
|
14572
14572
|
sw = JSONtoJS(values);
|
|
14573
14573
|
}
|
|
14574
14574
|
}
|
package/dist/alasql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//! AlaSQL v0.7.
|
|
1
|
+
//! AlaSQL v0.7.2 | © 2014-2018 Andrey Gershun & Mathias Rangel Wulff | License: MIT
|
|
2
2
|
/*
|
|
3
3
|
@module alasql
|
|
4
|
-
@version 0.7.
|
|
4
|
+
@version 0.7.2
|
|
5
5
|
|
|
6
6
|
AlaSQL - JavaScript SQL database
|
|
7
7
|
© 2014-2016 Andrey Gershun & Mathias Rangel Wulff
|
|
@@ -142,7 +142,7 @@ var alasql = function(sql, params, cb, scope) {
|
|
|
142
142
|
Current version of alasql
|
|
143
143
|
@constant {string}
|
|
144
144
|
*/
|
|
145
|
-
alasql.version = '0.7.
|
|
145
|
+
alasql.version = '0.7.2';
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
Debug flag
|
|
@@ -4022,11 +4022,11 @@ var cloneDeep = (utils.cloneDeep = function cloneDeep(obj) {
|
|
|
4022
4022
|
return +obj;
|
|
4023
4023
|
}
|
|
4024
4024
|
|
|
4025
|
-
var temp = obj.constructor(); // changed
|
|
4025
|
+
var temp = (Object.prototype.hasOwnProperty.call(obj, 'constructor') ? Object : obj.constructor)(); // changed
|
|
4026
4026
|
|
|
4027
4027
|
for (var key in obj) {
|
|
4028
4028
|
if (obj.hasOwnProperty(key)) {
|
|
4029
|
-
temp[key] = cloneDeep(obj[key]);
|
|
4029
|
+
/* 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]); }
|
|
4030
4030
|
}
|
|
4031
4031
|
}
|
|
4032
4032
|
return temp;
|
|
@@ -4098,7 +4098,7 @@ var extend = (utils.extend = function extend(a, b) {
|
|
|
4098
4098
|
a = a || {};
|
|
4099
4099
|
for (var key in b) {
|
|
4100
4100
|
if (b.hasOwnProperty(key)) {
|
|
4101
|
-
a[key] = b[key];
|
|
4101
|
+
/* 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]; }
|
|
4102
4102
|
}
|
|
4103
4103
|
}
|
|
4104
4104
|
return a;
|
|
@@ -9056,7 +9056,7 @@ yy.Select.prototype.compileGroup = function (query) {
|
|
|
9056
9056
|
aft2 = '';
|
|
9057
9057
|
|
|
9058
9058
|
if (typeof query.groupStar !== 'undefined') {
|
|
9059
|
-
aft2 += "for(var f in p['" + query.groupStar + "']) {g[f]=p['" + query.groupStar + "'][f];};";
|
|
9059
|
+
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];};";
|
|
9060
9060
|
}
|
|
9061
9061
|
|
|
9062
9062
|
/*
|
|
@@ -9379,7 +9379,7 @@ function compileSelectStar(query, aliases, joinstar) {
|
|
|
9379
9379
|
} else {
|
|
9380
9380
|
|
|
9381
9381
|
// if column not exist, then copy all
|
|
9382
|
-
sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
|
|
9382
|
+
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]};';
|
|
9383
9383
|
|
|
9384
9384
|
query.dirtyColumns = true;
|
|
9385
9385
|
}
|
|
@@ -9708,10 +9708,10 @@ yy.Select.prototype.compileSelectGroup1 = function (query) {
|
|
|
9708
9708
|
self.columns.forEach(function (col) {
|
|
9709
9709
|
|
|
9710
9710
|
if (col instanceof yy.Column && col.columnid === '*') {
|
|
9711
|
-
// s += 'for(var k in g){r[k]=g[k]};';
|
|
9711
|
+
// s += 'for(var k in g){if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9712
9712
|
// s += 'for(var k in this.query.groupColumns){r[k]=g[this.query.groupColumns[k]]};';
|
|
9713
9713
|
|
|
9714
|
-
s += 'for(var k in g) {r[k]=g[k]};';
|
|
9714
|
+
s += 'for(var k in g) {if(/^__proto__$/.test(k))Object.defineProperty(r,k,{writable:true,enumerable:true,configurable:true});r[k]=g[k]};';
|
|
9715
9715
|
return '';
|
|
9716
9716
|
|
|
9717
9717
|
} else {
|
|
@@ -13017,7 +13017,7 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
|
|
|
13017
13017
|
|
|
13018
13018
|
table.update(
|
|
13019
13019
|
function (t) {
|
|
13020
|
-
for (var f in r) t[f] = r[f];
|
|
13020
|
+
for (var f in r) {if(/^__proto__$/.test(f))Object.defineProperty(t,f,{writable:true,enumerable:true,configurable:true});t[f] = r[f];}
|
|
13021
13021
|
},
|
|
13022
13022
|
table.data.indexOf(toreplace),
|
|
13023
13023
|
params
|
|
@@ -14563,7 +14563,7 @@ yy.Insert.prototype.compile = function (databaseid) {
|
|
|
14563
14563
|
});
|
|
14564
14564
|
} else {
|
|
14565
14565
|
|
|
14566
|
-
// sw = 'var w='+JSONtoJS(values)+';for(var k in w){r[k]=w[k]};';
|
|
14566
|
+
// 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]};';
|
|
14567
14567
|
sw = JSONtoJS(values);
|
|
14568
14568
|
}
|
|
14569
14569
|
}
|