✏️ Hide host in debug logs to prevent leak when posting logs on issue

This commit is contained in:
Sebastien Clement 2020-11-17 23:26:25 +01:00
parent cf93b87591
commit b4fb25d3d4

View File

@ -19,6 +19,7 @@ const pipeline = promisify(stream.pipeline);
class WebdavTools {
constructor() {
this.host = null;
this.client = null;
this.baseUrl = null;
this.username = null;
@ -27,6 +28,7 @@ class WebdavTools {
init(ssl, host, username, password, accept_selfsigned_cert) {
return new Promise((resolve, reject) => {
this.host = host;
let status = statusTools.getStatus();
logger.info("Initilizing and checking webdav client...");
this.baseUrl = (ssl === "true" ? "https" : "http") + "://" + host + endpoint;
@ -216,7 +218,8 @@ class WebdavTools {
if (conf.ssl === "true") {
options["https"] = { rejectUnauthorized: conf.self_signed === "false" };
}
logger.debug(`...URI: ${encodeURI(this.baseUrl + path)} rejectUnauthorized: ${options["https"]["rejectUnauthorized"]}`);
logger.debug(`...URI: ${encodeURI(this.baseUrl.replace(this.host, 'host.hiden') + path)}`);
logger.debug(`...rejectUnauthorized: ${options["https"]["rejectUnauthorized"]}`);
got.stream
.put(encodeURI(this.baseUrl + path), options)
@ -311,7 +314,8 @@ class WebdavTools {
if (conf.ssl === "true") {
options["https"] = { rejectUnauthorized: conf.self_signed === "false" };
}
logger.debug(`...URI: ${encodeURI(this.baseUrl + path)} rejectUnauthorized: ${options["https"]["rejectUnauthorized"]}`);
logger.debug(`...URI: ${encodeURI(this.baseUrl.replace(this.host, 'host.hiden') + path)}`);
logger.debug(`...rejectUnauthorized: ${options["https"]["rejectUnauthorized"]}`);
pipeline(
got.stream.get(encodeURI(this.baseUrl + path), options).on("downloadProgress", (e) => {
let percent = Math.round(e.percent * 100) / 100;