From 1087a95103978ee9d5359ca3696170c85412a053 Mon Sep 17 00:00:00 2001 From: Dale Driver Date: Fri, 7 Mar 2025 21:46:39 -0800 Subject: [PATCH] Update server.cjs (#17) Redact only sensitive info for logging --- src/backend/server.cjs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/backend/server.cjs b/src/backend/server.cjs index 94d9ab55..4d569cbf 100644 --- a/src/backend/server.cjs +++ b/src/backend/server.cjs @@ -22,8 +22,17 @@ io.on("connection", (socket) => { console.error("Invalid hostConfig received:", hostConfig); return; } - - console.log("Received hostConfig:", hostConfig); + + // Redact only sensitive info for logging + const safeHostConfig = { + ip: hostConfig.ip, + port: hostConfig.port, + user: hostConfig.user, + password: hostConfig.password ? '***REDACTED***' : undefined, + rsaKey: hostConfig.rsaKey ? '***REDACTED***' : undefined, + }; + + console.log("Received hostConfig:", safeHostConfig); const { ip, port, user, password, rsaKey } = hostConfig; const conn = new SSHClient(); @@ -100,4 +109,4 @@ io.on("connection", (socket) => { server.listen(8081, '0.0.0.0', () => { console.log("Server is running on port 8081"); -}); \ No newline at end of file +});