From ec262fd5b2337a32f8a1cacdd25f7740d2b4be2c Mon Sep 17 00:00:00 2001 From: Aditya Gaddam Date: Fri, 28 Jul 2023 09:35:59 -0600 Subject: [PATCH] fix: replaced request with axios --- .env.vivaldi.sample => .env.local.sample | 0 admin/server.js | 635 ++++++---- connector-setup/index.js | 423 ++++--- connector-setup/steps/configureConnection.js | 89 +- latency_test.js | 87 +- lib/clock_skew_detector.js | 57 +- package-lock.json | 1132 ++++++++++++++---- package.json | 5 +- troubleshoot.js | 695 ++++++----- 9 files changed, 2021 insertions(+), 1102 deletions(-) rename .env.vivaldi.sample => .env.local.sample (100%) diff --git a/.env.vivaldi.sample b/.env.local.sample similarity index 100% rename from .env.vivaldi.sample rename to .env.local.sample diff --git a/admin/server.js b/admin/server.js index 8ebf59ee..bbe1da4d 100644 --- a/admin/server.js +++ b/admin/server.js @@ -1,6 +1,7 @@ require('../lib/initConf'); require('../lib/setupProxy'); +const axios = require('axios'); var unzipper = require('unzipper'); var path = require('path'); var archiver = require('archiver'); @@ -12,10 +13,9 @@ var http = require('http'); var express = require('express'); var bodyParser = require('body-parser'); var cookieParser = require('cookie-parser'); -var session = require('express-session') +var session = require('express-session'); var logger = require('morgan'); var xtend = require('xtend'); -var request = require('request'); var urlJoin = require('url-join'); var exec = require('child_process').exec; var app = express(); @@ -27,28 +27,33 @@ var Users = require('../lib/users'); app.set('views', __dirname + '/views'); app.set('view engine', 'ejs'); app.use(express.static(__dirname + '/public')); -app.use(bodyParser.urlencoded({extended:true})); +app.use(bodyParser.urlencoded({ extended: true })); app.use(cookieParser()); -app.use(session({ - secret: 'sojo sut ed oterces le' -})); +app.use( + session({ + secret: 'sojo sut ed oterces le', + }) +); var csrfProtection = csrf({ cookie: true }); var detected_settings = {}; if (process.platform === 'win32') { - exec('"' + __dirname + '//settings_detector.exe"', function(err, stdout, stderr) { - console.log(arguments); - try { - var parsed = JSON.parse(stdout); - console.log(parsed); - if (parsed.error) { - parsed = {}; - return; - } - detected_settings.LDAP_BASE = parsed.baseDN; - detected_settings.LDAP_URL = 'ldap://' + parsed.domainController; - } catch (er) {} - }); + exec( + '"' + __dirname + '//settings_detector.exe"', + function (err, stdout, stderr) { + console.log(arguments); + try { + var parsed = JSON.parse(stdout); + console.log(parsed); + if (parsed.error) { + parsed = {}; + return; + } + detected_settings.LDAP_BASE = parsed.baseDN; + detected_settings.LDAP_URL = 'ldap://' + parsed.domainController; + } catch (er) {} + } + ); } function read_current_config() { @@ -66,16 +71,16 @@ function set_current_config(req, res, next) { } function restart_server(cb) { - // required to test immediately after configuration + // required to test immediately after configuration require('../lib/initConf'); Users = require('../lib/users'); if (process.platform === 'win32') { console.log('Restarting Auth0 ADLDAP Service...'); - return exec('net stop "Auth0 ADLDAP"', function() { - exec('net start "Auth0 ADLDAP"', function() { + return exec('net stop "Auth0 ADLDAP"', function () { + exec('net start "Auth0 ADLDAP"', function () { console.log('Done.'); - setTimeout(function() { + setTimeout(function () { return cb(); }, 2000); }); @@ -87,11 +92,13 @@ function restart_server(cb) { function merge_config(req, res) { var new_config = xtend(req.current_config, req.body); - fs.writeFileSync(__dirname + '/../config.json', - JSON.stringify(new_config, null, 2)); + fs.writeFileSync( + __dirname + '/../config.json', + JSON.stringify(new_config, null, 2) + ); if (req.body.LDAP_URL || req.body.PORT || req.body.SERVER_URL) { - return restart_server(function() { + return restart_server(function () { return res.redirect('/?s=1'); }); } @@ -103,198 +110,298 @@ function run(cmd, args, callback) { var spawn = require('child_process').spawn; var command = spawn(cmd, args); var result = ''; - command.stderr.on('data', function(data) { + command.stderr.on('data', function (data) { result += data.toString(); }); - command.stdout.on('data', function(data) { + command.stdout.on('data', function (data) { result += data.toString(); }); - command.on('close', function(code) { + command.on('close', function (code) { return callback(result); }); } -app.get('/', set_current_config, csrfProtection, function(req, res) { +app.get('/', set_current_config, csrfProtection, function (req, res) { console.log(req.session.LDAP_RESULTS); - res.render('index', xtend(req.current_config, { - SUCCESS: req.query && req.query.s === '1', - LDAP_RESULTS: req.session.LDAP_RESULTS - }, { - detected: detected_settings - }, { - csrfToken: req.csrfToken() - })); + res.render( + 'index', + xtend( + req.current_config, + { + SUCCESS: req.query && req.query.s === '1', + LDAP_RESULTS: req.session.LDAP_RESULTS, + }, + { + detected: detected_settings, + }, + { + csrfToken: req.csrfToken(), + } + ) + ); delete req.session.LDAP_RESULTS; }); -app.post('/ldap', set_current_config, csrfProtection, function(req, res, next) { - // Convert ENABLE_WRITE_BACK and ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD to boolean. - req.body.ENABLE_WRITE_BACK = !!(req.body.ENABLE_WRITE_BACK && req.body.ENABLE_WRITE_BACK === 'on'); - req.body.ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD = !!(req.body.ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD && req.body.ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD === 'on'); - - var config = xtend({}, req.current_config, req.body); - test_config(config, function(err, result) { - if (err) { - return res.render('index', xtend(req.current_config, req.body, { - ERROR: err.message, - LDAP_RESULTS: result - })); - } - req.session.LDAP_RESULTS = result; - console.log(req.session.LDAP_RESULTS); - next(); - }); -}, function(req, res, next) { - if (req.body.PORT || req.current_config.PORT) return next(); - freeport(function(er, port) { - req.body.PORT = port; - next(); - }); -}, merge_config); - -app.post('/server', multipart(), set_current_config, csrfProtection, function(req, res, next) { - if (req.body.PORT || req.current_config.PORT) return next(); - freeport(function(er, port) { - req.body.PORT = port; - next(); - }); -}, function(req, res, next) { - if (!req.files || !req.files.SSL_PFX || req.files.SSL_PFX.size === 0) return next(); - // upload pfx - fs.readFile(req.files.SSL_PFX.path, function(err, pfxContent) { - req.body.SSL_PFX = Buffer.from(pfxContent).toString('base64'); - delete req.files; - next(); - }); -}, merge_config); - -app.post('/ticket', set_current_config, csrfProtection, function(req, res, next) { - if (!req.body.PROVISIONING_TICKET) { - return res.render('index', xtend(req.current_config, { - ERROR: 'The ticket url ' + req.body.PROVISIONING_TICKET + ' is not vaild.' - })); - } - - var info_url = urlJoin(req.body.PROVISIONING_TICKET, '/info'); - - request.get({ - url: info_url, - json: true - }, function(err, resp, body) { - if (err){ - if (err.code === 'ECONNREFUSED') { - console.error('Unable to reach auth0 at: ' + info_url); - return res.render('index', xtend(req.current_config, { - ERROR: 'Unable to connect to Auth0, verify internet connectivity.' - })); - } - - if (err.code === 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' || err.code ==='CERT_UNTRUSTED') { - console.error('The Auth0 certificate at ' + info_url + ' could not be validated', err); - return res.render('index', xtend(req.current_config, { - ERROR: 'The Auth0 server is using a certificate issued by an untrusted Certification Authority. Go to https://auth0.com/docs/connector/ca-certificates for instructions on how to install your certificate Authority. \n ' + err.message - })); - } - - if (err.code === 'DEPTH_ZERO_SELF_SIGNED_CERT') { - console.error('The Auth0 certificate at ' + info_url + ' could not be validated', err); - return res.render('index', xtend(req.current_config, { - ERROR: 'The Auth0 server is using a selg-signed certificate. Go to https://auth0.com/docs/connector/ca-certificates for instructions on how to install your certificate. \n' + err.message - })); +app.post( + '/ldap', + set_current_config, + csrfProtection, + function (req, res, next) { + // Convert ENABLE_WRITE_BACK and ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD to boolean. + req.body.ENABLE_WRITE_BACK = !!( + req.body.ENABLE_WRITE_BACK && req.body.ENABLE_WRITE_BACK === 'on' + ); + req.body.ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD = !!( + req.body.ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD && + req.body.ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD === 'on' + ); + + var config = xtend({}, req.current_config, req.body); + test_config(config, function (err, result) { + if (err) { + return res.render( + 'index', + xtend(req.current_config, req.body, { + ERROR: err.message, + LDAP_RESULTS: result, + }) + ); } - - return res.render('index', xtend(req.current_config, { - ERROR: 'Network error: ' + err.message - })); - } - - if (resp.statusCode !== 200 || !body || !body.adHub) { - return res.render('index', xtend(req.current_config, { - ERROR: 'Wrong ticket url.' - })); + req.session.LDAP_RESULTS = result; + console.log(req.session.LDAP_RESULTS); + next(); + }); + }, + function (req, res, next) { + if (req.body.PORT || req.current_config.PORT) return next(); + freeport(function (er, port) { + req.body.PORT = port; + next(); + }); + }, + merge_config +); + +app.post( + '/server', + multipart(), + set_current_config, + csrfProtection, + function (req, res, next) { + if (req.body.PORT || req.current_config.PORT) return next(); + freeport(function (er, port) { + req.body.PORT = port; + next(); + }); + }, + function (req, res, next) { + if (!req.files || !req.files.SSL_PFX || req.files.SSL_PFX.size === 0) + return next(); + // upload pfx + fs.readFile(req.files.SSL_PFX.path, function (err, pfxContent) { + req.body.SSL_PFX = Buffer.from(pfxContent).toString('base64'); + delete req.files; + next(); + }); + }, + merge_config +); + +app.post( + '/ticket', + set_current_config, + csrfProtection, + function (req, res, next) { + if (!req.body.PROVISIONING_TICKET) { + return res.render( + 'index', + xtend(req.current_config, { + ERROR: + 'The ticket url ' + req.body.PROVISIONING_TICKET + ' is not vaild.', + }) + ); } - req.body.AD_HUB = body.adHub; - - if (!detected_settings.LDAP_URL) { - var adLdapSettings = require('../connector-setup/steps/ad-ldap-settings.js'); - adLdapSettings.discoverSettings(body.connectionDomain, function(config) { - console.dir(config); - detected_settings = config; - next(); + var info_url = urlJoin(req.body.PROVISIONING_TICKET, '/info'); + + axios + .get(info_url) + .then((response) => { + const body = response.data; + if (response.status !== 200 || !body || !body.adHub) { + return res.render( + 'index', + xtend(req.current_config, { + ERROR: 'Wrong ticket url.', + }) + ); + } + + req.body.AD_HUB = body.adHub; + + if (!detected_settings.LDAP_URL) { + var adLdapSettings = require('../connector-setup/steps/ad-ldap-settings.js'); + adLdapSettings.discoverSettings( + body.connectionDomain, + function (config) { + console.dir(config); + detected_settings = config; + next(); + } + ); + } else { + next(); + } + }) + .catch((err) => { + if (err.code === 'ECONNREFUSED') { + console.error('Unable to reach auth0 at: ' + info_url); + return res.render( + 'index', + xtend(req.current_config, { + ERROR: + 'Unable to connect to Auth0, verify internet connectivity.', + }) + ); + } + + if ( + err.code === 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' || + err.code === 'CERT_UNTRUSTED' + ) { + console.error( + 'The Auth0 certificate at ' + info_url + ' could not be validated', + err + ); + return res.render( + 'index', + xtend(req.current_config, { + ERROR: + 'The Auth0 server is using a certificate issued by an untrusted Certification Authority. Go to https://auth0.com/docs/connector/ca-certificates for instructions on how to install your certificate Authority. \n ' + + err.message, + }) + ); + } + + if (err.code === 'DEPTH_ZERO_SELF_SIGNED_CERT') { + console.error( + 'The Auth0 certificate at ' + info_url + ' could not be validated', + err + ); + return res.render( + 'index', + xtend(req.current_config, { + ERROR: + 'The Auth0 server is using a selg-signed certificate. Go to https://auth0.com/docs/connector/ca-certificates for instructions on how to install your certificate. \n' + + err.message, + }) + ); + } + + return res.render( + 'index', + xtend(req.current_config, { + ERROR: 'Network error: ' + err.message, + }) + ); }); - } else { - next(); - } - }); -}, merge_config); + }, + merge_config +); -app.get('/export', set_current_config, function(req, res) { +app.get('/export', set_current_config, function (req, res) { console.log('Exporting configuration.'); - var today = new Date().toISOString() + var today = new Date() + .toISOString() .substring(0, 19) .replace(/\:|\-/g, '') .replace('T', '-'); var archive = archiver('zip', { - zlib: { level: 9 } // Sets the compression level. + zlib: { level: 9 }, // Sets the compression level. }); const files = [ 'config.json', 'lib/profileMapper.js', 'certs/cert.key', - 'certs/cert.pem' + 'certs/cert.pem', ]; - files.forEach(name => { + files.forEach((name) => { const fullPath = path.join(__dirname, '/../', name); - if (!fs.existsSync(fullPath)) { return; } + if (!fs.existsSync(fullPath)) { + return; + } archive.file(fullPath, { name }); }); - res.set('Content-Type', 'application/zip') - res.set('Content-Disposition', 'attachment; filename=connector_export_' + today + '.zip'); + res.set('Content-Type', 'application/zip'); + res.set( + 'Content-Disposition', + 'attachment; filename=connector_export_' + today + '.zip' + ); archive.pipe(res); archive.finalize(); }); -app.post('/import', set_current_config, csrfProtection, multipart(), function(req, res, next) { - console.log('Importing configuration.'); - - if (!req.files || !req.files.IMPORT_FILE || req.files.IMPORT_FILE.size === 0) { - return res.render('index', xtend(req.current_config, { - ERROR: 'Upload a valid zip file.' - })); - } - - var valid_files = ['certs/cert.key', 'certs/cert.pem', 'config.json', 'lib/profileMapper.js']; +app.post( + '/import', + set_current_config, + csrfProtection, + multipart(), + function (req, res, next) { + console.log('Importing configuration.'); + + if ( + !req.files || + !req.files.IMPORT_FILE || + req.files.IMPORT_FILE.size === 0 + ) { + return res.render( + 'index', + xtend(req.current_config, { + ERROR: 'Upload a valid zip file.', + }) + ); + } - fs.createReadStream(req.files.IMPORT_FILE.path) - .pipe(unzipper.Parse()) - .on('entry', (entry) => { - if (!valid_files.includes(entry.path)) { - console.error(`unknown filepath ${entry.path}`); - return entry.autodrain(); - } - const filePath = path.join(__dirname, '/../', entry.path); - console.log('Extracting ' + filePath); - const fileWriteStream = fs.createWriteStream(filePath); - entry.pipe(fileWriteStream); - }) - .on('close', function() { - restart_server(function() { - res.render('index', xtend(read_current_config(), { - SUCCESS: true - })); + var valid_files = [ + 'certs/cert.key', + 'certs/cert.pem', + 'config.json', + 'lib/profileMapper.js', + ]; + + fs.createReadStream(req.files.IMPORT_FILE.path) + .pipe(unzipper.Parse()) + .on('entry', (entry) => { + if (!valid_files.includes(entry.path)) { + console.error(`unknown filepath ${entry.path}`); + return entry.autodrain(); + } + const filePath = path.join(__dirname, '/../', entry.path); + console.log('Extracting ' + filePath); + const fileWriteStream = fs.createWriteStream(filePath); + entry.pipe(fileWriteStream); + }) + .on('close', function () { + restart_server(function () { + res.render( + 'index', + xtend(read_current_config(), { + SUCCESS: true, + }) + ); + }); }); - }); -}); + } +); -app.get('/logs', function(req, res) { +app.get('/logs', function (req, res) { res.writeHead(200, { - "Content-Type": "text/plain" + 'Content-Type': 'text/plain', }); if (!fs.existsSync(__dirname + '/../logs.log')) { @@ -302,11 +409,11 @@ app.get('/logs', function(req, res) { return res.end(); } - fs.readFile(__dirname + '/../logs.log', "utf8", function(err, data) { + fs.readFile(__dirname + '/../logs.log', 'utf8', function (err, data) { if (err) { res.status(500); res.send({ - error: err + error: err, }); } else { res.write(data); @@ -315,12 +422,12 @@ app.get('/logs', function(req, res) { }); }); -app.post('/logs/clear', csrfProtection, function(req, res) { - fs.writeFile(__dirname + '/../logs.log', '', function(err) { +app.post('/logs/clear', csrfProtection, function (req, res) { + fs.writeFile(__dirname + '/../logs.log', '', function (err) { if (err) { res.status(500); res.send({ - error: err + error: err, }); } else { res.status(200); @@ -329,9 +436,9 @@ app.post('/logs/clear', csrfProtection, function(req, res) { }); }); -app.get('/profile-mapper', function(req, res) { +app.get('/profile-mapper', function (req, res) { res.writeHead(200, { - "Content-Type": "text/plain" + 'Content-Type': 'text/plain', }); if (!fs.existsSync(__dirname + '/../lib/profileMapper.js')) { @@ -339,70 +446,80 @@ app.get('/profile-mapper', function(req, res) { return res.end(); } - fs.readFile(__dirname + '/../lib/profileMapper.js', "utf8", function(err, data) { - if (err) { - res.status(500); - res.send({ - error: err - }); - } else { - res.write(data); - res.end(); + fs.readFile( + __dirname + '/../lib/profileMapper.js', + 'utf8', + function (err, data) { + if (err) { + res.status(500); + res.send({ + error: err, + }); + } else { + res.write(data); + res.end(); + } } - }); + ); }); -app.post('/profile-mapper', csrfProtection, function(req, res) { - fs.writeFile(__dirname + '/../lib/profileMapper.js', req.body.code, function(err) { - if (err) { - res.status(500); - res.send({ - error: err - }); - } else { - return restart_server(function() { - res.status(200); - res.end(); - }); +app.post('/profile-mapper', csrfProtection, function (req, res) { + fs.writeFile( + __dirname + '/../lib/profileMapper.js', + req.body.code, + function (err) { + if (err) { + res.status(500); + res.send({ + error: err, + }); + } else { + return restart_server(function () { + res.status(200); + res.end(); + }); + } } - }); + ); }); -app.get('/troubleshooter/run', set_current_config, function(req, res) { - run('node', [__dirname + '/../troubleshoot.js'], function(data) { +app.get('/troubleshooter/run', set_current_config, function (req, res) { + run('node', [__dirname + '/../troubleshoot.js'], function (data) { data = data.replace(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/g, '').trim(); res.writeHead(200, { - "Content-Type": "text/plain" + 'Content-Type': 'text/plain', }); res.write(data); return res.end(); }); }); -app.get('/troubleshooter/export', set_current_config, - function(req, res, next) { +app.get( + '/troubleshooter/export', + set_current_config, + function (req, res, next) { console.log('Exporting test results.'); - run(process.execPath, [__dirname + '/../troubleshoot.js'], function(data) { + run(process.execPath, [__dirname + '/../troubleshoot.js'], function (data) { data = data.replace(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/g, '').trim(); req.body.TEST_RESULTS = data; return next(); }); }, - function(req, res, next) { + function (req, res, next) { console.log('Exporting files.'); - fs.readdir(__dirname + '/../', function(err, list) { + fs.readdir(__dirname + '/../', function (err, list) { if (err) { res.status(500); return res.send({ - error: err + error: err, }); } else { req.body.LOG_FILES = []; - list.forEach(function(item) { + list.forEach(function (item) { if (item.indexOf('.log') >= 0) { req.body.LOG_FILES.push(item); } @@ -411,52 +528,63 @@ app.get('/troubleshooter/export', set_current_config, } }); }, - function(req, res, next) { - var today = new Date().toISOString() + function (req, res, next) { + var today = new Date() + .toISOString() .substring(0, 19) .replace(/\:|\-/g, '') .replace('T', '-'); var archive = archiver('zip', { - zlib: { level: 9 } // Sets the compression level. + zlib: { level: 9 }, // Sets the compression level. }); const files = [ 'config.json', 'lib/profileMapper.js', - 'package.json' + 'package.json', ].concat(req.body.LOG_FILES); - files.forEach(name => { + files.forEach((name) => { const fullPath = path.join(__dirname, '/../', name); - if (!fs.existsSync(fullPath)) { return; } + if (!fs.existsSync(fullPath)) { + return; + } archive.file(fullPath, { name }); }); archive.append(req.body.TEST_RESULTS, { - name: 'test-results.log' + name: 'test-results.log', }); - res.set('Content-Type', 'application/zip') - res.set('Content-Disposition', 'attachment; filename=connector_troubleshoot_' + today + '.zip'); + res.set('Content-Type', 'application/zip'); + res.set( + 'Content-Disposition', + 'attachment; filename=connector_troubleshoot_' + today + '.zip' + ); archive.pipe(res); archive.finalize(); - }); - -app.post('/updater/run', csrfProtection, set_current_config, function(req, res) { - run(__dirname + '/../update-connector.cmd', [], function(data) { - res.writeHead(200, { - "Content-Type": "text/plain" + } +); + +app.post( + '/updater/run', + csrfProtection, + set_current_config, + function (req, res) { + run(__dirname + '/../update-connector.cmd', [], function (data) { + res.writeHead(200, { + 'Content-Type': 'text/plain', + }); + res.write(data); + return res.end(); }); - res.write(data); - return res.end(); - }); -}); - -app.get('/updater/logs', function(req, res) { + } +); +app.get('/updater/logs', function (req, res) { res.writeHead(200, { - "Content-Type": "text/plain" + 'Content-Type': 'text/plain', }); if (!fs.existsSync(os.tmpdir() + '/adldap-update.log')) { @@ -464,64 +592,61 @@ app.get('/updater/logs', function(req, res) { return res.end(); } - fs.readFile(os.tmpdir() + '/adldap-update.log', "utf8", function(err, data) { + fs.readFile(os.tmpdir() + '/adldap-update.log', 'utf8', function (err, data) { if (err) { res.status(500); res.send({ - error: err + error: err, }); } else { - res.write(data.replace(/\n\r\n/g, "\n")); + res.write(data.replace(/\n\r\n/g, '\n')); res.end(); } }); }); -app.get('/version', function(req, res) { +app.get('/version', function (req, res) { var p = JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')); res.writeHead(200, { - "Content-Type": "text/plain" + 'Content-Type': 'text/plain', }); res.write(p.version); return res.end(); }); - -app.get('/users/search', function(req, res) { +app.get('/users/search', function (req, res) { var users = new Users(true); - users.list(req.query.query, {}, function(err, users) { + users.list(req.query.query, {}, function (err, users) { if (err) { res.status(500); res.send({ - error: err + error: err, }); - } - else { + } else { res.json(users); } }); }); -app.get('/users/by-login', function(req, res) { +app.get('/users/by-login', function (req, res) { var users = new Users(true); - users.getByUserName(req.query.query, {}, function(err, users) { + users.getByUserName(req.query.query, {}, function (err, users) { if (err) { res.status(500); res.send({ - error: err + error: err, }); - } - else { + } else { res.send(users); } }); }); -cas.inject(function(err) { - if (err) console.log('Custom CA certificates were not loaded',err); +cas.inject(function (err) { + if (err) console.log('Custom CA certificates were not loaded', err); - http.createServer(app).listen(8357, '127.0.0.1', function() { + http.createServer(app).listen(8357, '127.0.0.1', function () { console.log('Listening on http://localhost:8357.'); }); }); diff --git a/connector-setup/index.js b/connector-setup/index.js index f6951c45..03fbf43c 100644 --- a/connector-setup/index.js +++ b/connector-setup/index.js @@ -1,228 +1,267 @@ require('colors'); -var nconf = require('nconf'); -var crypto = require('../lib/crypto'); -var program = require('commander'); -var async = require('async'); -var request = require('request'); -var urlJoin = require('url-join'); -var cas = require('../lib/add_certs'); -var firewall = require('../lib/firewall'); +const nconf = require('nconf'); +const crypto = require('../lib/crypto'); +const program = require('commander'); +const async = require('async'); +const axios = require('axios'); +const urlJoin = require('url-join'); +const cas = require('../lib/add_certs'); +const firewall = require('../lib/firewall'); const createConnection = require('../lib/ldap').createConnection; -var path = require('path'); +const path = require('path'); //steps -var certificate = require('./steps/certificate'); -var configureConnection = require('./steps/configureConnection'); -var adLdapSettings = require('./steps/ad-ldap-settings'); +const certificate = require('./steps/certificate'); +const configureConnection = require('./steps/configureConnection'); +const adLdapSettings = require('./steps/ad-ldap-settings'); -program - .version(require('../package.json').version) - .parse(process.argv); +program.version(require('../package.json').version).parse(process.argv); exports.run = function (workingPath, callback) { var provisioningTicket, info; - var emptyVars = [ 'LDAP_URL', - 'LDAP_BASE', - 'LDAP_BIND_USER' ]; + var emptyVars = ['LDAP_URL', 'LDAP_BASE', 'LDAP_BIND_USER']; - if(!nconf.get('LDAP_BIND_CREDENTIALS')) { + if (!nconf.get('LDAP_BIND_CREDENTIALS')) { emptyVars.concat(['LDAP_BIND_PASSWORD']); } - async.series([ - function (cb) { - provisioningTicket = nconf.get('PROVISIONING_TICKET'); + async.series( + [ + function (cb) { + provisioningTicket = nconf.get('PROVISIONING_TICKET'); - if(provisioningTicket) return cb(); + if (provisioningTicket) return cb(); - program.prompt('Please enter the ticket number: ', function (pt) { - provisioningTicket = pt; - cb(); - }); - }, - function (cb) { - cas.inject(cb); - }, function (cb) { - var info_url = urlJoin(provisioningTicket, '/info'); - console.log('Loading settings from ticket: ' + info_url); - - request.get({ - url: info_url, - json: true - }, function (err, response, body) { - if (err) { - switch(err.code) { - case 'ECONNREFUSED': - console.log('Unable to reach Auth0 at ' + ticket); - break; - case 'UNABLE_TO_VERIFY_LEAF_SIGNATURE': - case 'CERT_UNTRUSTED': - console.error('The Auth0 server is using a certificate issued by an untrusted Certification Authority.', err) - console.log('Go to https://auth0.com/docs/connector/ca-certificates for instructions on how to install your CA certificate.'); - break; - case 'DEPTH_ZERO_SELF_SIGNED_CERT': - console.error('The Auth0 server is using a self-signed certificate', err) - console.log('Go to https://auth0.com/docs/connector/ca-certificates for instructions on how to install your certificate.'); - break; - default: - console.error('Unexpected error while configuring connection:', err); - } - return cb(err); - } + program.prompt('Please enter the ticket number: ', function (pt) { + provisioningTicket = pt; + cb(); + }); + }, + function (cb) { + cas.inject(cb); + }, + function (cb) { + var info_url = urlJoin(provisioningTicket, '/info'); + console.log('Loading settings from ticket: ' + info_url); + axios + .get(info_url) + .then((response) => { + if (response.status == 404) { + return cb( + new Error('Wrong ticket. Does this connection still exist?') + ); + } - if (response.statusCode == 404) { - return cb (new Error('Wrong ticket. Does this connection still exist?')); - } + var unexpected_response = + response.status !== 200 || + !~(response.headers['content-type'] || '').indexOf( + 'application/json' + ); - var unexpected_response = - response.statusCode !== 200 || - !~(response.headers['content-type'] || '').indexOf('application/json'); + if (unexpected_response) { + var message = + 'Unexpected response from ticket information endpoint. ' + + 'Status code: ' + + response.status + + ' Content-Type: ' + + response.headers['content-type'] + + '.'; + return cb(new Error(message)); + } - if (unexpected_response) { - var message = 'Unexpected response from ticket information endpoint. ' + - 'Status code: ' + response.statusCode + ' Content-Type: ' + response.headers['content-type'] + '.'; - return cb (new Error(message)); - } + info = response.data; - info = body; + cb(); + }) + .catch((err) => { + if (err) { + switch (err.code) { + case 'ECONNREFUSED': + console.log('Unable to reach Auth0 at ' + ticket); + break; + case 'UNABLE_TO_VERIFY_LEAF_SIGNATURE': + case 'CERT_UNTRUSTED': + console.error( + 'The Auth0 server is using a certificate issued by an untrusted Certification Authority.', + err + ); + console.log( + 'Go to https://auth0.com/docs/connector/ca-certificates for instructions on how to install your CA certificate.' + ); + break; + case 'DEPTH_ZERO_SELF_SIGNED_CERT': + console.error( + 'The Auth0 server is using a self-signed certificate', + err + ); + console.log( + 'Go to https://auth0.com/docs/connector/ca-certificates for instructions on how to install your certificate.' + ); + break; + default: + console.error( + 'Unexpected error while configuring connection:', + err + ); + } + return cb(err); + } + }); + }, + function (cb) { + var ldap_url = nconf.get('LDAP_URL'); + var ldap_base = nconf.get('LDAP_BASE'); + if (ldap_url) return cb(); - cb(); - }); - }, - function(cb) { - var ldap_url = nconf.get('LDAP_URL'); - var ldap_base = nconf.get('LDAP_BASE'); + adLdapSettings.discoverSettings( + info.connectionDomain, + function (config) { + var detectedUrl = ''; + var detectedDN = ''; + if (config) { + detectedUrl = config.LDAP_URL || ''; + detectedDN = config.LDAP_BASE || ''; + } + + if (console.restore) console.restore(); - if(ldap_url) return cb(); + program.prompt( + 'Please enter your LDAP server URL [' + detectedUrl + ']: ', + function (url) { + ldap_url = url && url.length > 0 ? url : detectedUrl; - adLdapSettings.discoverSettings(info.connectionDomain, function(config) { - var detectedUrl = ''; - var detectedDN = '' - if (config) { - detectedUrl = config.LDAP_URL || ''; - detectedDN = config.LDAP_BASE || ''; + program.prompt( + 'Please enter the LDAP server base DN [' + detectedDN + ']: ', + function (dn) { + ldap_base = dn && dn.length > 0 ? dn : detectedDN; + nconf.set('LDAP_BASE', ldap_base); + nconf.set('LDAP_URL', ldap_url); + nconf.save(); + + if (console.inject) console.inject(); + + cb(); + } + ); + } + ); + } + ); + }, + function (cb) { + function anonymousSearchEnabled(enabled) { + nconf.set('ANONYMOUS_SEARCH_ENABLED', enabled); + console.log( + 'Is Anonymous LDAP search enabled? ' + (enabled ? 'yes' : 'no') + ); + connection.destroy(); + return cb(); } + const searchOpts = { + filter: '(objectclass=person)', + scope: 'sub', + sizeLimit: 1, + }; + const connection = createConnection(); + connection.search( + nconf.get('LDAP_BASE'), + searchOpts, + function (err, res) { + if (err) { + return anonymousSearchEnabled(false); + } - if (console.restore) console.restore(); - - program.prompt('Please enter your LDAP server URL [' + (detectedUrl) + ']: ', function (url) { - ldap_url = (url && url.length>0) ? url : detectedUrl; + var searchEntry; + res + .once('searchEntry', function (entry) { + searchEntry = entry; + }) + .once('end', function (result) { + const isEnabled = searchEntry && result.status === 0; + anonymousSearchEnabled(isEnabled); + }) + .once('error', function (err) { + // if there are more than one entry matching the search, the server returns the one entry and a SizeLimitExceededError error + anonymousSearchEnabled(err.name === 'SizeLimitExceededError'); + }); + } + ); + }, + function (cb) { + var do_not_configure_firewall = + nconf.get('FIREWALL_RULE_CREATED') || + !info.kerberos || + process.platform !== 'win32'; - program.prompt('Please enter the LDAP server base DN [' + (detectedDN) + ']: ', function (dn) { - ldap_base = (dn && dn.length>0) ? dn : detectedDN; + if (do_not_configure_firewall) { + return cb(); + } - nconf.set('LDAP_BASE', ldap_base); - nconf.set('LDAP_URL', ldap_url); - nconf.save(); + // add a firewall rule the first time + firewall.add_rule({ + name: 'Auth0ConnectorKerberos', + program: path.resolve( + path.join( + __dirname, + '/../node_modules/kerberos-server/kerberosproxy.net/KerberosProxy/bin/Debug/KerberosProxy.exe' + ) + ), + profile: 'private', + }); - if (console.inject) console.inject(); + console.log('Firewall rule added.'); - cb(); - }); + cb(); + }, + function (cb) { + nconf.set('AD_HUB', info.adHub); + nconf.set('PROVISIONING_TICKET', provisioningTicket); + nconf.set('WSFED_ISSUER', info.connectionDomain); + nconf.set('CONNECTION', info.connectionName); + nconf.set('CLIENT_CERT_AUTH', info.certAuth); + nconf.set('KERBEROS_AUTH', info.kerberos); + nconf.set('FIREWALL_RULE_CREATED', info.kerberos); + nconf.set('REALM', info.realm.name); + nconf.set('SITE_NAME', nconf.get('SITE_NAME') || info.connectionName); + nconf.set(info.realm.name, info.realm.postTokenUrl); + emptyVars.forEach(function (ev) { + if (!nconf.get(ev)) nconf.set(ev, ''); }); - }); - }, - function (cb) { - function anonymousSearchEnabled(enabled) { - nconf.set('ANONYMOUS_SEARCH_ENABLED', enabled); - console.log('Is Anonymous LDAP search enabled? ' + (enabled ? 'yes' : 'no')); - connection.destroy(); - return cb(); - } - const searchOpts = { - filter: '(objectclass=person)', - scope: 'sub', - sizeLimit: 1 - }; - const connection = createConnection(); - connection.search(nconf.get('LDAP_BASE'), searchOpts , function (err, res) { - if (err) { - return anonymousSearchEnabled(false); + + nconf.save(cb); + + console.log('Local settings updated.'); + }, + function (cb) { + certificate(workingPath, info, cb); + }, + function (cb) { + var password = nconf.get('LDAP_BIND_PASSWORD'); + if (password) { + nconf.clear('LDAP_BIND_PASSWORD'); + nconf.set('LDAP_BIND_CREDENTIALS', crypto.encrypt(password)); } - - var searchEntry; - res.once('searchEntry', function (entry) { - searchEntry = entry; - }) - .once('end', function(result){ - const isEnabled = searchEntry && result.status===0; - anonymousSearchEnabled(isEnabled); - }) - .once('error',function(err){ - // if there are more than one entry matching the search, the server returns the one entry and a SizeLimitExceededError error - anonymousSearchEnabled(err.name === 'SizeLimitExceededError'); - }); - }); - }, - function (cb) { - var do_not_configure_firewall = nconf.get('FIREWALL_RULE_CREATED') || - !info.kerberos || - process.platform !== 'win32'; - - if (do_not_configure_firewall) { - return cb(); - } - - // add a firewall rule the first time - firewall.add_rule({ - name: 'Auth0ConnectorKerberos', - program: path.resolve(path.join(__dirname, '/../node_modules/kerberos-server/kerberosproxy.net/KerberosProxy/bin/Debug/KerberosProxy.exe')), - profile: 'private' - }); - - console.log('Firewall rule added.'); - - cb(); - }, - function (cb) { - nconf.set('AD_HUB', info.adHub); - nconf.set('PROVISIONING_TICKET', provisioningTicket); - nconf.set('WSFED_ISSUER', info.connectionDomain); - nconf.set('CONNECTION', info.connectionName); - nconf.set('CLIENT_CERT_AUTH', info.certAuth); - nconf.set('KERBEROS_AUTH', info.kerberos); - nconf.set('FIREWALL_RULE_CREATED', info.kerberos); - nconf.set('REALM', info.realm.name); - nconf.set('SITE_NAME', nconf.get('SITE_NAME') || info.connectionName); - nconf.set(info.realm.name, info.realm.postTokenUrl); - emptyVars.forEach(function(ev) { - if (!nconf.get(ev)) nconf.set(ev, ''); - }); - - nconf.save(cb); - - console.log('Local settings updated.'); - }, - function (cb) { - certificate(workingPath, info, cb); - }, - function (cb) { - var password = nconf.get('LDAP_BIND_PASSWORD'); - if (password) { - nconf.clear('LDAP_BIND_PASSWORD'); - nconf.set('LDAP_BIND_CREDENTIALS', crypto.encrypt(password)); - } - cb(); - }, - function (cb) { - configureConnection(program, workingPath, - info, - provisioningTicket, cb); - }, - function (cb) { - console.log('Connector setup complete.'); - if (nconf.get('OVERRIDE_CONFIG')) { - return nconf.save(cb); - } - cb(); + cb(); + }, + function (cb) { + configureConnection(program, workingPath, info, provisioningTicket, cb); + }, + function (cb) { + console.log('Connector setup complete.'); + if (nconf.get('OVERRIDE_CONFIG')) { + return nconf.save(cb); + } + cb(); + }, + ], + function (err) { + if (err) return callback(err); + callback(); } - ], function (err) { - if (err) return callback(err); - callback(); - }); + ); }; diff --git a/connector-setup/steps/configureConnection.js b/connector-setup/steps/configureConnection.js index dea30c0e..7cd82b02 100644 --- a/connector-setup/steps/configureConnection.js +++ b/connector-setup/steps/configureConnection.js @@ -1,13 +1,16 @@ -var urlJoin = require('url-join'); -var request = require('request'); -var fs = require('fs'); -var path = require('path'); +const axios = require('axios'); +var urlJoin = require('url-join'); +var fs = require('fs'); +var path = require('path'); var thumbprint = require('@auth0/thumbprint'); -var nconf = require('nconf'); -var os = require('os'); +var nconf = require('nconf'); +var os = require('os'); -var pemToCert = function(pem) { - var cert = /-----BEGIN CERTIFICATE-----([^-]*)-----END CERTIFICATE-----/g.exec(pem.toString()); +var pemToCert = function (pem) { + var cert = + /-----BEGIN CERTIFICATE-----([^-]*)-----END CERTIFICATE-----/g.exec( + pem.toString() + ); if (cert.length > 0) { return cert[1].replace(/[\n|\r\n]/g, ''); } @@ -20,49 +23,61 @@ var getCurrentThumbprint = function (workingPath) { return thumbprint.calculate(pemToCert(nconf.get('AUTH_CERT'))); } - var cert = pemToCert(fs.readFileSync(path.join(workingPath, 'certs', 'cert.pem')).toString()); + var cert = pemToCert( + fs.readFileSync(path.join(workingPath, 'certs', 'cert.pem')).toString() + ); return thumbprint.calculate(cert); }; module.exports = function (program, workingPath, connectionInfo, ticket, cb) { - var serverUrl = nconf.get('SERVER_URL') || - ('http://' + os.hostname() + ':' + (nconf.get('PORT') || 4000)); + var serverUrl = + nconf.get('SERVER_URL') || + 'http://' + os.hostname() + ':' + (nconf.get('PORT') || 4000); var signInEndpoint = urlJoin(serverUrl, '/wsfed'); - var pem = nconf.get('AUTH_CERT') || fs.readFileSync(path.join(workingPath, 'certs', 'cert.pem')).toString(); + var pem = + nconf.get('AUTH_CERT') || + fs.readFileSync(path.join(workingPath, 'certs', 'cert.pem')).toString(); var cert = pemToCert(pem); - console.log(('Configuring connection ' + connectionInfo.connectionName + '.').yellow); + console.log( + ('Configuring connection ' + connectionInfo.connectionName + '.').yellow + ); console.log(' > Posting certificates and signInEndpoint: ' + signInEndpoint); - request.post({ - url: ticket, - json: { - certs: [cert], + axios + .post(ticket, { + certs: [cert], signInEndpoint: signInEndpoint, - agentMode: nconf.get('AGENT_MODE'), - agentVersion: require('../../package').version - } - }, function (err, response, body) { - if (err) { + agentMode: nconf.get('AGENT_MODE'), + agentVersion: require('../../package').version, + }) + .then((response) => { + if (response.status !== 200) { + console.log( + 'Unexpected status while configuring connection: ' + response.status + ); + return cb(new Error(response.data)); + } + + nconf.set('SERVER_URL', serverUrl); + nconf.set('LAST_SENT_THUMBPRINT', getCurrentThumbprint(workingPath)); + nconf.set('TENANT_SIGNING_KEY', response.data.signingKey || ''); + + console.log( + ('Connection ' + connectionInfo.connectionName + ' configured.').green + ); + cb(); + }) + .catch((err) => { if (err.code === 'ECONNREFUSED') { console.log('Unable to reach Auth0 at ' + ticket); } else { - console.log('Unexpected error while configuring connection: ' + (err.code || err.message)); + console.log( + 'Unexpected error while configuring connection: ' + + (err.code || err.message) + ); } return cb(err); - } - - if (response.statusCode !== 200) { - console.log('Unexpected status while configuring connection: ' + response.statusCode); - return cb(new Error(body)); - } - - nconf.set('SERVER_URL', serverUrl); - nconf.set('LAST_SENT_THUMBPRINT', getCurrentThumbprint(workingPath)); - nconf.set('TENANT_SIGNING_KEY', response.body.signingKey || ''); - - console.log(('Connection ' + connectionInfo.connectionName + ' configured.').green); - cb(); - }); + }); }; diff --git a/latency_test.js b/latency_test.js index fc556950..e9597cd2 100644 --- a/latency_test.js +++ b/latency_test.js @@ -1,11 +1,12 @@ -var latency_test = module.exports; -var request = require('request'); -var _ = require('lodash'); -var async = require('async'); -var nconf = require('nconf'); -var url = require('url'); -var test_url = 'https://' + url.parse(nconf.get('PROVISIONING_TICKET')).host + '/test'; -var exit = require('./lib/exit'); +var latency_test = module.exports; +const axios = require('axios'); +const _ = require('lodash'); +const async = require('async'); +const nconf = require('nconf'); +const url = require('url'); +const test_url = + 'https://' + url.parse(nconf.get('PROVISIONING_TICKET')).host + '/test'; +const exit = require('./lib/exit'); /** * test the url and return the ns @@ -15,47 +16,57 @@ var exit = require('./lib/exit'); */ latency_test.run = function (done) { var start = process.hrtime(); - request.get(test_url, function(err){ - if (err) return done(err); - var took = process.hrtime(start); - done(null, took[0] * 1e9 + took[1]); - }); + axios + .get(test_url) + .then((response) => { + var took = process.hrtime(start); + done(null, took[0] * 1e9 + took[1]); + }) + .catch((err) => done(err)); }; latency_test.run_many = function (n, done) { - async.mapSeries(_.range(n), function (n, callback) { - latency_test.run(callback); - }, function (err, times){ - if (err) { - console.log('Error when doing the latency test, exiting.'); - exit(1); - } + async.mapSeries( + _.range(n), + function (n, callback) { + latency_test.run(callback); + }, + function (err, times) { + if (err) { + console.log('Error when doing the latency test, exiting.'); + exit(1); + } - var sum = times.reduce(function (prev, curr) { - return prev + curr; - }, 0); + var sum = times.reduce(function (prev, curr) { + return prev + curr; + }, 0); - var max = times.reduce(function (prev, curr) { - return Math.max(prev, curr); - }, 0); + var max = times.reduce(function (prev, curr) { + return Math.max(prev, curr); + }, 0); - var min = times.reduce(function (prev, curr) { - return Math.min(prev, curr); - }, Infinity); + var min = times.reduce(function (prev, curr) { + return Math.min(prev, curr); + }, Infinity); - var result = [sum / n, max, min].map(function (nanos) { - return (nanos / 1e6).toFixed(2); - }); + var result = [sum / n, max, min].map(function (nanos) { + return (nanos / 1e6).toFixed(2); + }); - console.log('latency test took avg: %d ms, max: %d ms, min: %d ms', - result[0], result[1], result[2]); + console.log( + 'latency test took avg: %d ms, max: %d ms, min: %d ms', + result[0], + result[1], + result[2] + ); - if (done) { - done(null, result); + if (done) { + done(null, result); + } } - }); + ); }; if (require.main === module) { latency_test.run_many(10); -} \ No newline at end of file +} diff --git a/lib/clock_skew_detector.js b/lib/clock_skew_detector.js index 8a345c2b..5a9ea58d 100644 --- a/lib/clock_skew_detector.js +++ b/lib/clock_skew_detector.js @@ -1,35 +1,40 @@ -var request = require('request'); -var nconf = require('nconf'); -var url = require('url'); -var test_url = 'https://' + url.parse(nconf.get('PROVISIONING_TICKET')).host + '/test'; -var exit = require('./exit'); +const axios = require('axios'); +const nconf = require('nconf'); +const url = require('url'); +const test_url = + 'https://' + url.parse(nconf.get('PROVISIONING_TICKET')).host + '/test'; +const exit = require('./exit'); -function check (callback) { - request.get({ - uri: test_url, - json: true - }, function (err, resp, body) { - if (err || !body || !body.clock) { - return callback(); - } +function check(callback) { + axios + .get(test_url) + .then((response) => { + const body = response.data; - var auth0_time = body.clock; - var local_time = new Date().getTime(); - var dif = Math.abs(auth0_time - local_time); + if (!body || !body.clock) { + return callback(); + } - if (dif > 5000) { - var message = [ 'Clock skew detected.', - '- Local time: ' + new Date(local_time), - '- Auth0 time: ' + new Date(auth0_time)].join('\n'); + const auth0_time = body.clock; + const local_time = new Date().getTime(); + const dif = Math.abs(auth0_time - local_time); - return callback(new Error(message)); - } + if (dif > 5000) { + var message = [ + 'Clock skew detected.', + '- Local time: ' + new Date(local_time), + '- Auth0 time: ' + new Date(auth0_time), + ].join('\n'); - callback(); - }); + return callback(new Error(message)); + } + }) + .finally(() => { + return callback(); + }); } -function schedule () { +function schedule() { setTimeout(function () { check(function (err) { if (err) { @@ -41,4 +46,4 @@ function schedule () { }, 5000); } -schedule(); \ No newline at end of file +schedule(); diff --git a/package-lock.json b/package-lock.json index b4d5b5ae..c1b69ac1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@auth0/thumbprint": "0.0.6", "archiver": "^3.0.0", "async": "~2.6.4", + "axios": "^1.4.0", "binary": "^0.3.0", "body-parser": "^1.19.2", "cb": "~0.1.0", @@ -41,7 +42,6 @@ "passport-local": "~0.1.6", "passport-ssl-certificate": "https://github.com/jaredhanson/passport-ssl-certificate.git#826c16d040841ec4b20db1a4cfe8bac81c931462", "passport-windowsauth": "^3.0.0", - "request": "^2.88.0", "rimraf": "~2.7.1", "selfsigned": "^1.10.4", "stream-rotate": "crigot/stream-rotate#31fe967e6b1d5fdbaf641091877e39e54ae0dd8c", @@ -57,6 +57,7 @@ "devDependencies": { "bump-version": "^0.5.0", "chai": "~1.7.2", + "eslint": "^8.45.0", "mocha": "^8.2.1", "proxyquire": "^2.1.3", "sinon": "^9.0.3", @@ -66,11 +67,202 @@ "node": "^18.16.0" } }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@auth0/thumbprint": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/@auth0/thumbprint/-/thumbprint-0.0.6.tgz", "integrity": "sha512-+YciWHxNUOE78T+xoXI1fMI6G1WdyyAay8ioaMZhvGOJ+lReYzj0b7mpfNr5WtjGrmtWPvPOOxh0TO+5Y2M/Hw==" }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.6.2.tgz", + "integrity": "sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.0.tgz", + "integrity": "sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@eslint/js": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.44.0.tgz", + "integrity": "sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", + "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@sentry-internal/tracing": { "version": "7.56.0", "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.56.0.tgz", @@ -207,6 +399,27 @@ "node": ">= 0.6" } }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -246,6 +459,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -410,18 +624,28 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", - "engines": { - "node": "*" + "node_modules/axios": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, - "node_modules/aws4": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", - "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" + "node_modules/axios/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } }, "node_modules/backoff": { "version": "2.5.0", @@ -474,14 +698,6 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, "node_modules/big-integer": { "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", @@ -692,6 +908,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -704,11 +929,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" - }, "node_modules/cb": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/cb/-/cb-0.1.1.tgz", @@ -1072,6 +1292,20 @@ "node": ">= 6.9.0" } }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/csrf": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/csrf/-/csrf-3.0.6.tgz", @@ -1182,6 +1416,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "node_modules/define-properties": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", @@ -1246,6 +1486,18 @@ "node": "*" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/dtrace-provider": { "version": "0.8.8", "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.8.tgz", @@ -1294,15 +1546,6 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -1376,6 +1619,270 @@ "node": ">=0.8.0" } }, + "node_modules/eslint": { + "version": "8.45.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.45.0.tgz", + "integrity": "sha512-pd8KSxiQpdYRfYa9Wufvdoct3ZPQQuVuU5O6scNgMuOMYuxvH0IGaYK0wUFjo4UYYQQCUndlXiMbnxopwvvTiw==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.1.0", + "@eslint/js": "8.44.0", + "@humanwhocodes/config-array": "^0.11.10", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.0", + "eslint-visitor-keys": "^3.4.1", + "espree": "^9.6.0", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz", + "integrity": "sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/eslint/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -1521,11 +2028,6 @@ "node": ">= 0.8" } }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, "node_modules/extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -1545,12 +2047,41 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } }, "node_modules/fill-keys": { "version": "1.0.2", @@ -1619,32 +2150,64 @@ "flat": "cli.js" } }, - "node_modules/foreach": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.6.tgz", - "integrity": "sha512-k6GAGDyqLe9JaebCsFCoudPPWfihKu8pylYXRlqP1J7ms39iPoTtk2fviNglIeQEwdh0bQeKJ01ZPyuyQvKzwg==" - }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, "engines": { - "node": "*" + "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], "engines": { - "node": ">= 0.12" + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } } }, + "node_modules/foreach": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.6.tgz", + "integrity": "sha512-k6GAGDyqLe9JaebCsFCoudPPWfihKu8pylYXRlqP1J7ms39iPoTtk2fviNglIeQEwdh0bQeKJ01ZPyuyQvKzwg==" + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -1743,14 +2306,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -1826,6 +2381,33 @@ "node": ">=10" } }, + "node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globals/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globalthis": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", @@ -1846,6 +2428,12 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "node_modules/growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -1855,27 +2443,6 @@ "node": ">=4.x" } }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "deprecated": "this library is no longer supported", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -1979,20 +2546,6 @@ "node": ">= 0.8" } }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, "node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -2059,6 +2612,40 @@ } ] }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/indexof": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", @@ -2176,6 +2763,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-obj": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", @@ -2185,11 +2781,6 @@ "node": ">=8" } }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" - }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -2218,25 +2809,23 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" - }, - "node_modules/json-schema": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true }, "node_modules/jsonwebtoken": { "version": "8.5.1", @@ -2259,33 +2848,6 @@ "npm": ">=1.4.28" } }, - "node_modules/jsprim": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", - "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/jsprim/node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "node_modules/just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -2391,6 +2953,19 @@ "node": ">=10.13.0" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/listenercount": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", @@ -2479,6 +3054,12 @@ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", @@ -2974,6 +3555,12 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/nconf": { "version": "0.6.7", "resolved": "https://github.com/jfromaniello/nconf/tarball/master", @@ -3057,14 +3644,6 @@ "node": ">=0.10.0" } }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "engines": { - "node": "*" - } - }, "node_modules/object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", @@ -3125,6 +3704,23 @@ "wordwrap": "~0.0.2" } }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/options": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", @@ -3163,6 +3759,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -3323,6 +3931,15 @@ "node": ">=0.10.0" } }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", @@ -3339,11 +3956,6 @@ "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==" }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" - }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -3380,6 +3992,15 @@ "node": ">= 0.6" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -3397,6 +4018,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/proxyquire": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz", @@ -3408,15 +4034,11 @@ "resolve": "^1.11.1" } }, - "node_modules/psl": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", - "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" - }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, "engines": { "node": ">=6" } @@ -3435,6 +4057,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/random-bytes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", @@ -3499,37 +4141,6 @@ "node": ">=8.10.0" } }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -3556,6 +4167,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -3589,6 +4219,29 @@ "node": ">=8.0" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -3740,6 +4393,27 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -3826,30 +4500,6 @@ "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", "dev": true }, - "node_modules/sshpk": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", - "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", @@ -3983,6 +4633,12 @@ "node": ">=6" } }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -4008,18 +4664,6 @@ "node": ">=0.6" } }, - "node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, "node_modules/traverse": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", @@ -4050,22 +4694,18 @@ "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, "dependencies": { - "safe-buffer": "^5.0.1" + "prelude-ls": "^1.2.1" }, "engines": { - "node": "*" + "node": ">= 0.8.0" } }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" - }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -4171,6 +4811,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -4193,15 +4834,6 @@ "node": ">= 0.4.0" } }, - "node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "bin": { - "uuid": "bin/uuid" - } - }, "node_modules/valid-url": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/valid-url/-/valid-url-1.0.9.tgz", diff --git a/package.json b/package.json index 69250fd6..34948007 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,8 @@ "description": "ADLDAP Federation Connector", "main": "server.js", "scripts": { + "lint:check": "npx eslint admin/**/*.js connector-setup/**/*.js lib/** test/**/*.js", + "lint:fix": "npx eslint admin/** connector-setup/** lib/** test/** --fix", "test": "NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --timeout 50000 --reporter spec --exit", "snyk": "snyk test", "start": "node server.js", @@ -25,6 +27,7 @@ "@auth0/thumbprint": "0.0.6", "archiver": "^3.0.0", "async": "~2.6.4", + "axios": "^1.4.0", "binary": "^0.3.0", "body-parser": "^1.19.2", "cb": "~0.1.0", @@ -54,7 +57,6 @@ "passport-local": "~0.1.6", "passport-ssl-certificate": "https://github.com/jaredhanson/passport-ssl-certificate.git#826c16d040841ec4b20db1a4cfe8bac81c931462", "passport-windowsauth": "^3.0.0", - "request": "^2.88.0", "rimraf": "~2.7.1", "selfsigned": "^1.10.4", "stream-rotate": "crigot/stream-rotate#31fe967e6b1d5fdbaf641091877e39e54ae0dd8c", @@ -70,6 +72,7 @@ "devDependencies": { "bump-version": "^0.5.0", "chai": "~1.7.2", + "eslint": "^8.45.0", "mocha": "^8.2.1", "proxyquire": "^2.1.3", "sinon": "^9.0.3", diff --git a/troubleshoot.js b/troubleshoot.js index 36a81448..cccd62c3 100644 --- a/troubleshoot.js +++ b/troubleshoot.js @@ -2,54 +2,54 @@ require('colors'); require('./lib/initConf'); require('./lib/setupProxy'); -var _ = require('lodash'); -var fs = require('fs'); -var url = require('url'); -var path = require('path'); -var ldap = require('./lib/ldap'); -var async = require('async'); -var nconf = require('nconf'); -var request = require('request'); -var winston = require('winston'); -var thumbprint = require('@auth0/thumbprint'); -var WebSocket = require('ws'); -var isWindows = (process.platform == 'win32'); -var cas = require('./lib/add_certs'); -var tls = require('tls'); -var https = require('https'); +const axios = require('axios'); +const _ = require('lodash'); +const fs = require('fs'); +const url = require('url'); +const path = require('path'); +const ldap = require('./lib/ldap'); +const async = require('async'); +const nconf = require('nconf'); +const winston = require('winston'); +const thumbprint = require('@auth0/thumbprint'); +const WebSocket = require('ws'); +const isWindows = process.platform == 'win32'; +const cas = require('./lib/add_certs'); +const tls = require('tls'); +const https = require('https'); -var logger = new winston.Logger({ - transports: [ - new winston.transports.Console({ - timestamp: function() { - var date = new Date(); - var hour = date.getHours(); - hour = (hour < 10 ? "0" : "") + hour; - var min = date.getMinutes(); - min = (min < 10 ? "0" : "") + min; - var sec = date.getSeconds(); - sec = (sec < 10 ? "0" : "") + sec; - return hour + ":" + min + ":" + sec; - }, - level: 'debug', - handleExceptions: true, - json: false, - colorize: true - }) - ], - exitOnError: false +const logger = new winston.Logger({ + transports: [ + new winston.transports.Console({ + timestamp: function () { + var date = new Date(); + var hour = date.getHours(); + hour = (hour < 10 ? '0' : '') + hour; + var min = date.getMinutes(); + min = (min < 10 ? '0' : '') + min; + var sec = date.getSeconds(); + sec = (sec < 10 ? '0' : '') + sec; + return hour + ':' + min + ':' + sec; + }, + level: 'debug', + handleExceptions: true, + json: false, + colorize: true, + }), + ], + exitOnError: false, }); -logger.trying = function(message, arg) { - if (!arg) arg = ''; - logger.info((isWindows ? '* ' : '\u272D ').yellow + message, arg); +logger.trying = function (message, arg) { + if (!arg) arg = ''; + logger.info((isWindows ? '* ' : '\u272D ').yellow + message, arg); }; -logger.success = function(message, arg) { - if (!arg) arg = ''; - logger.info((isWindows ? '\u221A ' : '\u2714 ').green + message, arg); +logger.success = function (message, arg) { + if (!arg) arg = ''; + logger.info((isWindows ? '\u221A ' : '\u2714 ').green + message, arg); }; -logger.failed = function(message, arg) { - if (!arg) arg = ''; - logger.error((isWindows ? '\u00D7 ' : '\u2716 ').red + message, arg); +logger.failed = function (message, arg) { + if (!arg) arg = ''; + logger.error((isWindows ? '\u00D7 ' : '\u2716 ').red + message, arg); }; process.on('uncaughtException', function (err) { @@ -58,286 +58,375 @@ process.on('uncaughtException', function (err) { console.log('\n Troubleshooting AD LDAP connector\n'); -async.series([ - function(callback){ - cas.inject(callback); - }, - function(callback){ - var HTTP_PROXY = process.env.HTTP_PROXY || process.env.http_proxy; - if (HTTP_PROXY) { - logger.info('Proxy configured: %s', HTTP_PROXY); - } else { - logger.info('No proxy server configured.'); - } - callback(); - }, - function(callback){ - logger.trying('Testing connectivity to Auth0...'); +async.series( + [ + function (callback) { + cas.inject(callback); + }, + function (callback) { + var HTTP_PROXY = process.env.HTTP_PROXY || process.env.http_proxy; + if (HTTP_PROXY) { + logger.info('Proxy configured: %s', HTTP_PROXY); + } else { + logger.info('No proxy server configured.'); + } + callback(); + }, + function (callback) { + logger.trying('Testing connectivity to Auth0...'); - var connectivity_url = 'https://login.auth0.com/test'; - if (nconf.get('PROVISIONING_TICKET')) { - connectivity_url = 'https://' + url.parse(nconf.get('PROVISIONING_TICKET')).host + '/test'; - } + var connectivity_url = 'https://login.auth0.com/test'; + if (nconf.get('PROVISIONING_TICKET')) { + connectivity_url = + 'https://' + + url.parse(nconf.get('PROVISIONING_TICKET')).host + + '/test'; + } - logger.info(' > Test endpoint: ' + connectivity_url.green); + logger.info(' > Test endpoint: ' + connectivity_url.green); - request.get({ - uri: connectivity_url, - json: true - }, function (err, res, body) { - if (err || res.statusCode !== 200) { - logger.failed('Error connecting to Auth0.'); - if (err) - logger.error(' > Error: %s', JSON.stringify(err)); - if (res) - logger.error(' > Status: %s', res.statusCode); - if (body) - logger.error(' > Body: %s', body.replace(/\n$/, '')); - } else { - logger.success('Connection to test endpoint %s.', 'succeeded'.green); - } - callback(); - }); - }, - function(callback){ - logger.trying('Testing hub connectivity (WS).'); + axios + .get(connectivity_url) + .then((response) => { + if (response.status !== 200) { + logger.failed('Error connecting to Auth0.'); + logger.error(' > Status: %s', res.status); + logger.error(' > Body: %s', response.data.replace(/\n$/, '')); + } else { + logger.success( + 'Connection to test endpoint %s.', + 'succeeded'.green + ); + } + callback(); + }) + .catch((err) => { + logger.error(' > Error: %s', JSON.stringify(err)); + }); + }, + function (callback) { + logger.trying('Testing hub connectivity (WS).'); - var hubUrl = nconf.get('AD_HUB'); - if (!hubUrl) { - hubUrl = "https://login.auth0.com/lo/hub"; - logger.warn('Could not load AD_HUB from config. Setting to default.'); - } + var hubUrl = nconf.get('AD_HUB'); + if (!hubUrl) { + hubUrl = 'https://login.auth0.com/lo/hub'; + logger.warn('Could not load AD_HUB from config. Setting to default.'); + } - var socket_server_address = hubUrl.replace(/^http/i, 'ws'); - var ws = new WebSocket(socket_server_address); - ws.on('open', function () { - logger.success('Connection to hub %s.', 'succeeded'.green); - ws.close(); - callback(); - }).on('message', function (msg) { - logger.success('Message received: %s.', msg); - ws.close(); - callback(); - }).on('error', function (err) { - logger.failed('Connection to hub %s.', 'failed'.red); - logger.error(' > Body: %s', err.message.replace(/\n$/, '')); - ws.close(); - callback(); - }); - }, - function(callback){ - logger.trying('Testing clock skew...'); + var socket_server_address = hubUrl.replace(/^http/i, 'ws'); + var ws = new WebSocket(socket_server_address); + ws.on('open', function () { + logger.success('Connection to hub %s.', 'succeeded'.green); + ws.close(); + callback(); + }) + .on('message', function (msg) { + logger.success('Message received: %s.', msg); + ws.close(); + callback(); + }) + .on('error', function (err) { + logger.failed('Connection to hub %s.', 'failed'.red); + logger.error(' > Body: %s', err.message.replace(/\n$/, '')); + ws.close(); + callback(); + }); + }, + function (callback) { + logger.trying('Testing clock skew...'); - var clock_url = 'https://login.auth0.com/test'; - if (nconf.get('PROVISIONING_TICKET')) { - clock_url = 'https://' + url.parse(nconf.get('PROVISIONING_TICKET')).host + '/test'; - } + var clock_url = 'https://login.auth0.com/test'; + if (nconf.get('PROVISIONING_TICKET')) { + clock_url = + 'https://' + + url.parse(nconf.get('PROVISIONING_TICKET')).host + + '/test'; + } - request.get({ - uri: clock_url, - json: true - }, function (err, resp, body) { - if (err || !body || !body.clock) { - logger.failed('Error calling the test endpoint.'); - return callback(); - } + axios + .get(clock_url) + .then((response) => { + const body = response.data; - var auth0_time = body.clock; - var local_time = new Date().getTime(); - var diff = Math.abs(auth0_time - local_time); - if (diff > 5000) { - logger.failed('Clock skew detected:'); - logger.error(' > Local time: ' + new Date(local_time).toISOString().replace(/T/, ' ').replace(/\..+/, '')); - logger.error(' > Auth0 time: ' + new Date(auth0_time).toISOString().replace(/T/, ' ').replace(/\..+/, '').red); - } - else { - logger.success('Everything %s. No clock skew detected.', 'OK'.green); - } + if (!body || !body.clock) { + logger.failed('Error calling the test endpoint.'); + return; + } - callback(); - }); - }, - function(callback){ - logger.trying('Testing certificates...'); + const auth0_time = body.clock; + const local_time = new Date().getTime(); + const diff = Math.abs(auth0_time - local_time); + if (diff > 5000) { + logger.failed('Clock skew detected:'); + logger.error( + ' > Local time: ' + + new Date(local_time) + .toISOString() + .replace(/T/, ' ') + .replace(/\..+/, '') + ); + logger.error( + ' > Auth0 time: ' + + new Date(auth0_time) + .toISOString() + .replace(/T/, ' ') + .replace(/\..+/, '').red + ); + } else { + logger.success( + 'Everything %s. No clock skew detected.', + 'OK'.green + ); + } + }) + .catch((err) => { + logger.failed('Error calling the test endpoint.'); + }) + .finally(() => { + return callback(); + }); + }, + function (callback) { + logger.trying('Testing certificates...'); - var certPath = path.join(__dirname, 'certs', 'cert.pem'); - fs.exists(certPath, function (exists) { - var local_thumbprint; - var server_thumbprint; + var certPath = path.join(__dirname, 'certs', 'cert.pem'); + fs.exists(certPath, function (exists) { + var local_thumbprint; + var server_thumbprint; - if (!exists) { - logger.warn(' > Local certificate ' + 'certs/cert.pem'.yellow + ' does not exist. Cannot read thumbprint.'); - } - else { - var certContents = fs.readFileSync(path.join(__dirname, 'certs', 'cert.pem')).toString(); - var cert = /-----BEGIN CERTIFICATE-----([^-]*)-----END CERTIFICATE-----/g.exec(certContents); - if (cert.length > 0) { - cert = cert[1].replace(/[\n|\r\n]/g, ''); - } + if (!exists) { + logger.warn( + ' > Local certificate ' + + 'certs/cert.pem'.yellow + + ' does not exist. Cannot read thumbprint.' + ); + } else { + var certContents = fs + .readFileSync(path.join(__dirname, 'certs', 'cert.pem')) + .toString(); + var cert = + /-----BEGIN CERTIFICATE-----([^-]*)-----END CERTIFICATE-----/g.exec( + certContents + ); + if (cert.length > 0) { + cert = cert[1].replace(/[\n|\r\n]/g, ''); + } - local_thumbprint = thumbprint.calculate(cert); - logger.info(' > Local thumbprint: ' + local_thumbprint); - } + local_thumbprint = thumbprint.calculate(cert); + logger.info(' > Local thumbprint: ' + local_thumbprint); + } - if (!nconf.get("PROVISIONING_TICKET")) { - logger.warn(' > ' + 'PROVISIONING_TICKET'.yellow + ' not set. Cannot compare with connection thumbprint (This is optional).'); - return callback(); - } + if (!nconf.get('PROVISIONING_TICKET')) { + logger.warn( + ' > ' + + 'PROVISIONING_TICKET'.yellow + + ' not set. Cannot compare with connection thumbprint (This is optional).' + ); + return callback(); + } + var info_url = nconf.get('PROVISIONING_TICKET') + '/info'; + axios + .get(info_url) + .then((response) => { + if (response.status !== 200) { + logger.error( + ' > Error loading certificate from Auth0: %s', + response.status + ); + logger.warn(' > Cannot compare with connection thumbprint.'); + } else { + var thumbprints = response.data.thumbprints; + if (!thumbprints || thumbprints.length === 0) { + logger.error( + ' > No thumbprints available in the connection information. Cannot compare certificates.' + ); + } else { + server_thumbprint = response.data.thumbprints[0]; + logger.info(' > Server thumbprint: ' + server_thumbprint); + } + } - var info_url = nconf.get('PROVISIONING_TICKET') + '/info'; - request.get({ - uri: info_url, - json: true - }, function (err, res, body) { - if (res && res.statusCode !== 200 || err) { - logger.error(' > Error loading certificate from Auth0: %s', res && res.statusCode || err); - logger.warn(' > Cannot compare with connection thumbprint.'); - } else { - var thumbprints = body.thumbprints - if (!thumbprints || thumbprints.length === 0) { - logger.error(' > No thumbprints available in the connection information. Cannot compare certificates.'); - } - else { - server_thumbprint = body.thumbprints[0]; - logger.info(' > Server thumbprint: ' + server_thumbprint); - } - } + if (local_thumbprint && server_thumbprint) { + if (local_thumbprint === server_thumbprint) { + logger.success('Local and server certificates match.'); + } else { + logger.failed( + 'Local and server certificates ' + 'don\'t match'.red + '.' + ); + } + } + }) + .catch((err) => { + logger.error(' > Error loading certificate from Auth0: %s', err); + logger.warn(' > Cannot compare with connection thumbprint.'); + }) + .finally(() => { + return callback(); + }); + }); + }, + function (callback) { + logger.trying('Running NLTEST...'); - if (local_thumbprint && server_thumbprint) { - if (local_thumbprint === server_thumbprint) { - logger.success('Local and server certificates match.'); - } - else { - logger.failed('Local and server certificates ' + 'don\'t match'.red + '.'); - } - } + if (!isWindows) { + logger.warn(' > NLTEST can only run on Windows.'); + return callback(); + } - callback(); - }); - }); - }, - function(callback) { - logger.trying('Running NLTEST...'); + try { + var output = ''; + var spawn = require('child_process').spawn; + var nltest = spawn('nltest', ['/dsgetdc:']); + nltest.on('error', function (err) { + logger.failed('Running NLTEST %s.', 'failed'.red); + if (err && err.message) + logger.error( + ' > Error: %s', + err.message.replace(/\r\n|\r|\n/, '').red + ); + return callback(); + }); + nltest.stdout.on('data', function (data) { + output += data; + }); + nltest.stderr.on('data', function (data) { + output += data; + }); + nltest.on('close', function (code) { + if (output) { + var lines = output + .replace(/^\s+|\s+$/g, '') + .replace(/\r\n\s+/g, '\r\n') + .split(/\r\n/g); + for (var i = 0; i < lines.length; i++) { + if (code === 0) logger.info(' > ' + lines[i]); + else logger.error(' > ' + lines[i]); + } + } + return callback(); + }); + } catch (err) { + logger.failed('Running NLTEST %s.', 'failed'.red); + if (err && err.message) + logger.error( + ' > Error: %s', + err.message.replace(/\r\n|\r|\n/, '').red + ); + return callback(); + } + }, + function (callback) { + logger.trying('Testing SSL connectivity to LDAP.'); - if (!isWindows) { - logger.warn(' > NLTEST can only run on Windows.'); - return callback(); - } + if (!nconf.get('LDAP_URL')) { + logger.warn( + ' > ' + 'LDAP_URL'.yellow + ' not set. Cannot test SSL connectivity.' + ); + return callback(); + } - try { - var output = ''; - var spawn = require('child_process').spawn; - var nltest = spawn('nltest', ['/dsgetdc:']); - nltest.on('error', function (err) { - logger.failed('Running NLTEST %s.', 'failed'.red); - if (err && err.message) - logger.error(' > Error: %s', err.message.replace(/\r\n|\r|\n/, '').red); - return callback(); - }); - nltest.stdout.on('data', function (data) { output += data; }); - nltest.stderr.on('data', function (data) { output += data; }); - nltest.on('close', function (code) { - if (output) { - var lines = output.replace(/^\s+|\s+$/g,'').replace(/\r\n\s+/g,'\r\n').split(/\r\n/g); - for (var i=0; i ' + lines[i]); - else - logger.error(' > ' + lines[i]); - } - } - return callback(); - }); - } catch (err) { - logger.failed('Running NLTEST %s.', 'failed'.red); - if (err && err.message) - logger.error(' > Error: %s', err.message.replace(/\r\n|\r|\n/, '').red); - return callback(); - } - }, - function(callback) { - logger.trying('Testing SSL connectivity to LDAP.'); - - if (!nconf.get('LDAP_URL')) { - logger.warn(' > ' + 'LDAP_URL'.yellow + ' not set. Cannot test SSL connectivity.'); - return callback(); - } + const { host, protocol, port } = url.parse(nconf.get('LDAP_URL')); + if (protocol !== 'ldaps:') { + return callback(); + } + logger.info(' > Host: ' + host); - const { host, protocol, port } = url.parse(nconf.get('LDAP_URL')); - if(protocol !== 'ldaps:') { - return callback(); - } - logger.info(' > Host: ' + host); + tls + .connect({ + host, + port: port || 636, + ca: https.globalAgent.options.ca, + }) + .once('secureConnect', () => { + logger.success('Connection to LDAP %s.', 'succeeded'.green); + callback(); + }) + .once('error', (err) => { + logger.error( + ' > Error: %s', + err.message.replace(/\r\n|\r|\n/, '').trim().red + ); + callback(err); + }); + }, + function (callback) { + logger.trying('Testing LDAP connectivity.'); + if (!nconf.get('LDAP_BASE')) { + logger.warn( + ' > ' + 'LDAP_BASE'.yellow + ' not set. Cannot test connectivity.' + ); + return callback(); + } - tls.connect({ - host, - port: port || 636, - ca: https.globalAgent.options.ca, - }).once('secureConnect', () => { - logger.success('Connection to LDAP %s.', 'succeeded'.green); - callback() - }).once('error', err => { - logger.error(' > Error: %s', err.message.replace(/\r\n|\r|\n/, '').trim().red); - callback(err); - }) - }, - function(callback) { - logger.trying('Testing LDAP connectivity.'); - if (!nconf.get("LDAP_BASE")) { - logger.warn(' > ' + 'LDAP_BASE'.yellow + ' not set. Cannot test connectivity.'); - return callback(); - } + logger.info(' > LDAP BASE: %s', nconf.get('LDAP_BASE')); - logger.info(' > LDAP BASE: %s', nconf.get("LDAP_BASE")) + var opts = { + scope: 'sub', + sizeLimit: 5, + filter: nconf.get('LDAP_SEARCH_ALL_QUERY'), + }; - var opts = { - scope: 'sub', - sizeLimit: 5, - filter: nconf.get('LDAP_SEARCH_ALL_QUERY') - }; + try { + ldap.client.search(nconf.get('LDAP_BASE'), opts, function (err, res) { + if (err) { + logger.failed('Connection to LDAP %s.', 'failed'.red); + if (err && err.message) + logger.error( + ' > Error: %s', + err.message.replace(/\r\n|\r|\n/, '').red + ); + return callback(); + } - try { - ldap.client.search(nconf.get("LDAP_BASE"), opts, function(err, res) { - if (err) { - logger.failed('Connection to LDAP %s.', 'failed'.red); - if (err && err.message) - logger.error(' > Error: %s', err.message.replace(/\r\n|\r|\n/, '').red); - return callback(); - } - - var entries = []; - res.on('searchEntry', function(entry) { - logger.info(' > Found user: %s', entry.object.sAMAccountName || entry.object.mail || entry.object.name); - entries.push(entry); - }); - res.on('error', function(err) { - if (err.message === 'Size Limit Exceeded' && entries.length > 0) { - logger.success('Connection to LDAP %s.', 'succeeded'.green); - return callback(); - } - logger.failed('Connection to LDAP %s.', 'failed'.red); - if (err && err.message) - logger.error(' > Error: %s', err.message.replace(/\r\n|\r|\n/, '').trim().red); - return callback(); - }); - res.on('end', function() { - console.log('end'); - if (!entries || entries.length === 0) { - logger.error(' > Error: %s', 'Unable to find users. Verify the permissions for the current user.'.red); - } - return callback(); - }); - }); - } catch (e) { - logger.failed('Connection to LDAP %s.', 'failed'.red); - if (e && e.message) - logger.error(' > Error: %s', e.message.replace(/\r\n|\r|\n/, '').red); - return callback(); - } - } -], -function(err){ - logger.info('Done!\n'); - process.exit(0); -}); + var entries = []; + res.on('searchEntry', function (entry) { + logger.info( + ' > Found user: %s', + entry.object.sAMAccountName || + entry.object.mail || + entry.object.name + ); + entries.push(entry); + }); + res.on('error', function (err) { + if (err.message === 'Size Limit Exceeded' && entries.length > 0) { + logger.success('Connection to LDAP %s.', 'succeeded'.green); + return callback(); + } + logger.failed('Connection to LDAP %s.', 'failed'.red); + if (err && err.message) + logger.error( + ' > Error: %s', + err.message.replace(/\r\n|\r|\n/, '').trim().red + ); + return callback(); + }); + res.on('end', function () { + console.log('end'); + if (!entries || entries.length === 0) { + logger.error( + ' > Error: %s', + 'Unable to find users. Verify the permissions for the current user.' + .red + ); + } + return callback(); + }); + }); + } catch (e) { + logger.failed('Connection to LDAP %s.', 'failed'.red); + if (e && e.message) + logger.error( + ' > Error: %s', + e.message.replace(/\r\n|\r|\n/, '').red + ); + return callback(); + } + }, + ], + function (err) { + logger.info('Done!\n'); + process.exit(0); + } +);