update depedencies, changes to support updated authentication-module
[squeep-indie-auther] / test / src / logger.js
index 3441f940d40251caa678b4e20f5d1f2c839c2ddb..cb5914b3584cb100ba15e91054d9a5758005c9e4 100644 (file)
@@ -51,6 +51,32 @@ describe('Logger', function () {
     assert(logger.backend.info.args[0][0].includes('"********"'));
   });
 
+  it('masks noisy cookie header', function () {
+    logger.info('testScope', 'message', {
+      ctx: {
+        cookie: {
+          squeepSession: 'blahblahblahblahblah',
+        },
+      },
+    });
+    assert(logger.backend.info.called);
+    assert(logger.backend.info.args[0][0].includes('[scrubbed 20 bytes]'));
+  });
+
+  it('masks otp values', function () {
+    logger.info('teestScope', 'message', {
+      ctx: {
+        otpKey: '1234567890123456789012',
+        otpConfirmKey: '1234567890123456789012',
+        otpConfirmBox: 'xxxMysteryxxx',
+        otpState: 'xxxMysteryxxx',
+      }
+    });
+    assert(logger.backend.info.called);
+    assert(!logger.backend.info.args[0][0].includes('"1234567890123456789012"'));
+    assert(!logger.backend.info.args[0][0].includes('"xxxMysteryxxx"'));
+  });
+
   it('strips uninteresting scope dross', function () {
     logger.info('testScope', 'message', {
       ctx: {