From 18542f78f5bb8eb3c3c22acaf3a2a317503b79fe Mon Sep 17 00:00:00 2001 From: QQ Date: Tue, 17 Nov 2026 08:50:55 +0800 Subject: [PATCH] Import packages/plugin/tests/logging.test.ts --- packages/plugin/tests/logging.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/plugin/tests/logging.test.ts b/packages/plugin/tests/logging.test.ts index c071ea5..1b55b76 100644 --- a/packages/plugin/tests/logging.test.ts +++ b/packages/plugin/tests/logging.test.ts @@ -17,4 +17,16 @@ describe('live debug logging', () => { logger.debug('hidden again') expect(sink.debug).toHaveBeenCalledOnce() }) + + it('redacts password, passphrase, credential and apiKey fields', () => { + const sink = { debug: vi.fn(), info: vi.fn(), warn: vi.fn(), error: vi.fn() } + const logger = new SafeLogger(sink, 'info') + logger.info('auth', { password: 'p1', passphrase: 'p2', credential: 'c1', apiKey: 'k1', ok: 'yes' }) + const line = sink.info.mock.calls[0]?.[0] ?? '' + expect(line).toContain('yes') + expect(line).not.toContain('p1') + expect(line).not.toContain('p2') + expect(line).not.toContain('c1') + expect(line).not.toContain('k1') + }) })