From ac7073c85256093d4a71032b07bf9d056bbfad64 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Mon, 4 Jan 2021 14:20:48 +0200 Subject: [PATCH] bumped deps --- lib/api/domainaccess.js | 15 +++----- lib/schemas.js | 80 ++++++++++++++++++++--------------------- package.json | 22 ++++++------ tasks.js | 2 +- 4 files changed, 55 insertions(+), 64 deletions(-) diff --git a/lib/api/domainaccess.js b/lib/api/domainaccess.js index 0200d9af..72baf936 100644 --- a/lib/api/domainaccess.js +++ b/lib/api/domainaccess.js @@ -7,8 +7,6 @@ const roles = require('../roles'); const { sessSchema, sessIPSchema } = require('../schemas'); module.exports = (db, server) => { - - server.post( '/domainaccess/:tag/:action', tools.asyncifyJson(async (req, res, next) => { @@ -89,7 +87,6 @@ module.exports = (db, server) => { }) ); - server.get( '/domainaccess/:tag/:action', tools.asyncifyJson(async (req, res, next) => { @@ -151,13 +148,11 @@ module.exports = (db, server) => { res.json({ success: true, - results: domains.map(domainData => { - return { - id: domainData._id, - domain: domainData.domain, - action - }; - }) + results: domains.map(domainData => ({ + id: domainData._id, + domain: domainData.domain, + action + })) }); return next(); diff --git a/lib/schemas.js b/lib/schemas.js index fee58c82..0844e91b 100644 --- a/lib/schemas.js +++ b/lib/schemas.js @@ -32,57 +32,53 @@ const tagStringValidator = () => { }; */ -const mongoCursorValidator = () => { - return (value, helpers) => { - value = value.toString(); +const mongoCursorValidator = () => (value, helpers) => { + value = value.toString(); - if (/[^a-zA-Z0-9\-_]/.test(value)) { - return helpers.error('any.invalid'); - } - try { - EJSON.parse(Buffer.from(value, 'base64')); - } catch (E) { - return helpers.error('any.invalid'); - } + if (/[^a-zA-Z0-9\-_]/.test(value)) { + return helpers.error('any.invalid'); + } + try { + EJSON.parse(Buffer.from(value, 'base64')); + } catch (E) { + return helpers.error('any.invalid'); + } - return value; // Everything is OK - }; + return value; // Everything is OK }; -const metaDataValidator = () => { - return (value, helpers) => { - let parsed; +const metaDataValidator = () => (value, helpers) => { + let parsed; - if (typeof value === 'object') { - try { - parsed = value; - value = JSON.stringify(value); - } catch (err) { - return helpers.error('any.invalid'); - } - } else { - try { - parsed = JSON.parse(value); - } catch (err) { - return helpers.error('any.invalid'); - } + if (typeof value === 'object') { + try { + parsed = value; + value = JSON.stringify(value); + } catch (err) { + return helpers.error('any.invalid'); } - - const { error: strError, value: strValue } = Joi.string() - .trim() - .max(1024 * 1024) - .validate(value); - if (strError) { - throw strError; + } else { + try { + parsed = JSON.parse(value); + } catch (err) { + return helpers.error('any.invalid'); } + } - const { error: objError } = Joi.object().validate(parsed); - if (objError) { - throw objError; - } + const { error: strError, value: strValue } = Joi.string() + .trim() + .max(1024 * 1024) + .validate(value); + if (strError) { + throw strError; + } - return strValue; - }; + const { error: objError } = Joi.object().validate(parsed); + if (objError) { + throw objError; + } + + return strValue; }; const mongoCursorSchema = Joi.string().trim().empty('').custom(mongoCursorValidator({}), 'Cursor validation').max(1024); diff --git a/package.json b/package.json index 808ca920..0a3d7d38 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,12 @@ "author": "Andris Reinman", "license": "EUPL-1.1+", "devDependencies": { - "ajv": "6.12.6", + "ajv": "7.0.3", "chai": "4.2.0", "docsify-cli": "4.4.2", - "eslint": "7.14.0", + "eslint": "7.17.0", "eslint-config-nodemailer": "1.2.0", - "eslint-config-prettier": "6.15.0", + "eslint-config-prettier": "7.1.0", "grunt": "1.3.0", "grunt-cli": "1.3.2", "grunt-eslint": "23.0.0", @@ -37,7 +37,7 @@ "dependencies": { "@phc/pbkdf2": "1.1.14", "accesscontrol": "2.2.1", - "argon2-browser": "1.15.2", + "argon2-browser": "1.15.3", "axios": "0.21.1", "base32.js": "0.1.0", "bcryptjs": "2.4.3", @@ -49,23 +49,23 @@ "humanname": "0.2.2", "iconv-lite": "0.6.2", "ioredfour": "1.0.2-ioredis-03", - "ioredis": "4.19.2", + "ioredis": "4.19.4", "isemail": "3.2.0", "joi": "17.3.0", - "js-yaml": "3.14.0", + "js-yaml": "4.0.0", "key-fingerprint": "1.1.0", "libbase64": "1.2.1", "libmime": "5.0.0", "libqp": "1.1.0", - "mailsplit": "5.0.0", + "mailsplit": "5.0.1", "mobileconfig": "2.3.1", "mongo-cursor-pagination": "7.3.1", "mongodb": "3.6.3", "mongodb-extended-json": "1.11.0", "node-forge": "0.10.0", - "nodemailer": "6.4.16", + "nodemailer": "6.4.17", "npmlog": "4.1.2", - "openpgp": "4.10.8", + "openpgp": "4.10.9", "pem": "1.14.4", "pwnedpasswords": "1.0.5", "qrcode": "1.4.4", @@ -77,9 +77,9 @@ "speakeasy": "2.0.0", "u2f": "0.1.3", "unixcrypt": "1.0.13", - "uuid": "8.3.1", + "uuid": "8.3.2", "wild-config": "1.5.1", - "yargs": "16.1.1" + "yargs": "16.2.0" }, "repository": { "type": "git", diff --git a/tasks.js b/tasks.js index 9a68a7a5..abdb2ba1 100644 --- a/tasks.js +++ b/tasks.js @@ -10,7 +10,7 @@ const fs = require('fs'); const MessageHandler = require('./lib/message-handler'); const MailboxHandler = require('./lib/mailbox-handler'); const AuditHandler = require('./lib/audit-handler'); -const setupIndexes = yaml.safeLoad(fs.readFileSync(__dirname + '/indexes.yaml', 'utf8')); +const setupIndexes = yaml.load(fs.readFileSync(__dirname + '/indexes.yaml', 'utf8')); const Gelf = require('gelf'); const os = require('os');