- fixed criticità sulla password e su tokens che potevi richiedere sul projection.
This commit is contained in:
@@ -1967,6 +1967,22 @@ module.exports = {
|
|||||||
return query;
|
return query;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sanitizzaProjection: function (mioproj) {
|
||||||
|
|
||||||
|
// mioproj = {valore: '$password'};
|
||||||
|
|
||||||
|
const COL_TO_REMOVE = ['$password', '$tokens', '$tokens.token', 'ipaddr'];
|
||||||
|
|
||||||
|
for (let chiave in mioproj) {
|
||||||
|
// Elimina questa richiesta della password !
|
||||||
|
if (COL_TO_REMOVE.includes(mioproj[chiave])) {
|
||||||
|
delete mioproj[chiave];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mioproj;
|
||||||
|
},
|
||||||
|
|
||||||
getLookup: function (params, num, pass_proj, proj_add) {
|
getLookup: function (params, num, pass_proj, proj_add) {
|
||||||
const query = [];
|
const query = [];
|
||||||
|
|
||||||
@@ -1998,6 +2014,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (params.lk_tab) {
|
if (params.lk_tab) {
|
||||||
let proj = params.lk_proj;
|
let proj = params.lk_proj;
|
||||||
|
proj = this.sanitizzaProjection(proj);
|
||||||
if (!!pass_proj) {
|
if (!!pass_proj) {
|
||||||
proj = pass_proj;
|
proj = pass_proj;
|
||||||
}
|
}
|
||||||
@@ -2752,6 +2769,8 @@ module.exports = {
|
|||||||
// NUOVA VERSIONE
|
// NUOVA VERSIONE
|
||||||
let proj = params.lookup2 ? params.lookup2.lk_proj : null;
|
let proj = params.lookup2 ? params.lookup2.lk_proj : null;
|
||||||
|
|
||||||
|
proj = this.sanitizzaProjection(proj);
|
||||||
|
|
||||||
if (params.proj0) {
|
if (params.proj0) {
|
||||||
query.push({ $project: params.proj0 });
|
query.push({ $project: params.proj0 });
|
||||||
}
|
}
|
||||||
@@ -3050,12 +3069,17 @@ module.exports = {
|
|||||||
if (ris) {
|
if (ris) {
|
||||||
if (params.table === 'users') {
|
if (params.table === 'users') {
|
||||||
for (const myrec of ris.rows) {
|
for (const myrec of ris.rows) {
|
||||||
myrec.password = '**********';
|
if (myrec.ipaddr)
|
||||||
|
myrec.ipaddr = '';
|
||||||
|
if (myrec.tokens)
|
||||||
|
myrec.tokens = [];
|
||||||
|
if (myrec.password)
|
||||||
|
myrec.password = '';
|
||||||
}
|
}
|
||||||
} else if (params.table === 'mygroups') {
|
} else if (params.table === 'mygroups') {
|
||||||
for (const myrec of ris.rows) {
|
for (const myrec of ris.rows) {
|
||||||
if (myrec.pwd_cryp)
|
if (myrec.pwd_cryp)
|
||||||
myrec.pwd_cryp = '**********';
|
myrec.pwd_cryp = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4927,7 +4951,7 @@ module.exports = {
|
|||||||
* Funzione per scaricare dati GeoJSON dei comuni d'Italia e salvarli localmente.
|
* Funzione per scaricare dati GeoJSON dei comuni d'Italia e salvarli localmente.
|
||||||
* @param {string} url - L'URL dal quale scaricare i dati GeoJSON.
|
* @param {string} url - L'URL dal quale scaricare i dati GeoJSON.
|
||||||
* @param {string} outputPath - Il percorso del file in cui salvare i dati GeoJSON.
|
* @param {string} outputPath - Il percorso del file in cui salvare i dati GeoJSON.
|
||||||
*/
|
*/
|
||||||
async downloadGeoJSON(url, outputPath) {
|
async downloadGeoJSON(url, outputPath) {
|
||||||
try {
|
try {
|
||||||
// Effettua una richiesta GET all'URL specificato per scaricare i dati.
|
// Effettua una richiesta GET all'URL specificato per scaricare i dati.
|
||||||
|
|||||||
Reference in New Issue
Block a user