Commit 12045f8 for jssip.net
commit 12045f8c4392a5b2779998ad1ff34156af09103a
Author: José Luis Millán <jmillan@aliax.net>
Date: Fri Dec 19 16:01:12 2025 +0100
UA: Do not log sensitive information
Fixes #941
diff --git a/lib/UA.js b/lib/UA.js
index 919b66a..c352408 100644
--- a/lib/UA.js
+++ b/lib/UA.js
@@ -46,7 +46,18 @@ module.exports = class UA extends EventEmitter
constructor(configuration)
{
- logger.debug('new() [configuration:%o]', configuration);
+ // Check configuration argument.
+ if (!configuration)
+ {
+ throw new TypeError('Not enough arguments');
+ }
+
+ // Hide sensitive information.
+ const sensitiveKeys = [ 'password', 'ha1', 'authorization_jwt' ];
+
+ logger.debug('new() [configuration:%o]',
+ Object.entries(configuration).filter(([ key ]) => !sensitiveKeys.includes(key))
+ );
super();
@@ -78,12 +89,6 @@ module.exports = class UA extends EventEmitter
this._closeTimer = null;
- // Check configuration argument.
- if (configuration === undefined)
- {
- throw new TypeError('Not enough arguments');
- }
-
// Load configuration.
try
{