disallow accidental undefined as a find value
This commit is contained in:
parent
cb39b6282e
commit
422be49b1a
|
@ -226,15 +226,15 @@ function wrap(db, dir, dbsMap) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
DB.find = function (obj1, params) {
|
DB.find = function (obj, params) {
|
||||||
//var obj = obj1;
|
var err;
|
||||||
var obj = {};
|
Object.keys(obj).forEach(function (key) {
|
||||||
if (obj1) {
|
if (undefined === obj[key]) {
|
||||||
Object.keys(obj1).forEach(function (key) {
|
err = new Error("'" + key + "' was `undefined'. For security purposes you must explicitly set the value to null or ''");
|
||||||
if (undefined !== obj1[key]) {
|
|
||||||
obj[key] = obj1[key];
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (err) {
|
||||||
|
return PromiseA.reject(err);
|
||||||
}
|
}
|
||||||
var sql = 'SELECT * FROM \'' + tablename + '\' ';
|
var sql = 'SELECT * FROM \'' + tablename + '\' ';
|
||||||
var keys = obj && Object.keys(obj);
|
var keys = obj && Object.keys(obj);
|
||||||
|
|
Loading…
Reference in New Issue