Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ const Constants = {
RECONNECT_INVERVAL_MS: 1000
}

// Redact sensitive fields from the client config for logging purposes
function redactClientConfig(clientConfig) {
const redacted = { ...clientConfig }
for (const field of ['privateKey', 'password', 'passphrase']) {
if (redacted[field]) {
redacted[field] = '[REDACTED]'
}
}
return redacted
}

class SSHInstance extends InstanceBase {
constructor(internal) {
super(internal)
Expand Down Expand Up @@ -111,7 +122,7 @@ class SSHInstance extends InstanceBase {

this.sshClient.on('error', (err) => {
this.log('error', 'Server connection error: ' + err)
this.log('error', JSON.stringify(clientConfig))
this.log('error', JSON.stringify(redactClientConfig(clientConfig)))
this.updateStatus(InstanceStatus.ConnectionFailure)
this.queueReconnect()
})
Expand Down