Compare commits

..

No commits in common. "cc17e42e91bdfcbf2717873cd2c71090300340e2" and "8aa0f9d0305149b8a946e8a20b5837dc2be80bbc" have entirely different histories.

5 changed files with 329 additions and 513 deletions

View File

@ -1,6 +1,6 @@
const fs = require('fs');
const glob = require('simple-glob');
const joi = require('joi');
const joi = require('@hapi/joi');
const werelogs = require('werelogs');
const ARN = require('../../models/ARN');
@ -135,19 +135,15 @@ class AuthLoader {
}
_validateData(authData, filePath) {
let res = {};
try {
res = joi.attempt(authData, this._joiValidator,
const res = joi.validate(authData, this._joiValidator,
{ abortEarly: false });
} catch (err) {
this._dumpJoiErrors(error.details, filePath);
if (res.error) {
this._dumpJoiErrors(res.error.details, filePath);
return false;
}
let allKeys = [];
let arnError = false;
const validatedAuth = res;
const validatedAuth = res.value;
validatedAuth.accounts.forEach(account => {
// backward-compat: ignore arn if starts with 'aws:' and log a
// warning
@ -199,17 +195,12 @@ class AuthLoader {
if (arnError) {
return false;
}
let uniqueKeysRes = {};
try {
uniqueKeysRes = joi.attempt(
const uniqueKeysRes = joi.validate(
allKeys, this._joiKeysValidator.unique('access'));
} catch (err) {
if (uniqueKeysRes.error) {
this._dumpJoiErrors(uniqueKeysRes.error.details, filePath);
return false;
}
return true;
}

View File

@ -5,7 +5,7 @@ const errors = require('../errors');
* handle errors.
*
* @param {stream.Readable} s - Readable stream
* @param {joi} [joiSchema] - optional validation schema for the JSON object
* @param {@hapi/joi} [joiSchema] - optional validation schema for the JSON object
* @return {Promise} a Promise resolved with the parsed JSON object as a result
*/
async function readJSONStreamObject(s, joiSchema) {

View File

@ -22,13 +22,12 @@
"agentkeepalive": "^4.1.3",
"ajv": "6.12.2",
"async": "~2.1.5",
"base-x": "3.0.8",
"base62": "2.0.1",
"base-x": "3.0.8",
"debug": "~2.6.9",
"diskusage": "^1.1.1",
"ioredis": "4.9.5",
"ipaddr.js": "1.9.1",
"joi": "^17.4.2",
"level": "~5.0.1",
"level-sublevel": "~6.6.5",
"node-forge": "^0.7.1",

View File

@ -1,6 +1,6 @@
const assert = require('assert');
const stream = require('stream');
const joi = require('joi');
const joi = require('@hapi/joi');
const readJSONStreamObject = require('../../../lib/stream/readJSONStreamObject');
class ReqStream extends stream.Readable {

808
yarn.lock

File diff suppressed because it is too large Load Diff