diff --git a/apps/electron-backend/src/app/events/settings.events.spec.ts b/apps/electron-backend/src/app/events/settings.events.spec.ts index 179338e90..fa0825ea3 100644 --- a/apps/electron-backend/src/app/events/settings.events.spec.ts +++ b/apps/electron-backend/src/app/events/settings.events.spec.ts @@ -45,4 +45,26 @@ describe('SETTINGS_UPDATE logging', () => { expect(output).toContain('de'); expect(output).toContain('enabled'); }); + + it('does not print credentials embedded in external player arguments', () => { + const authorizationSecret = 'player-authorization-secret'; + const cookieSecret = 'player-cookie-secret'; + const handler = handlers.get('SETTINGS_UPDATE'); + + expect(handler).toBeDefined(); + handler?.( + {}, + { + language: 'de', + mpvPlayerArguments: `--http-header-fields=Authorization: Bearer ${authorizationSecret}`, + vlcPlayerArguments: `--http-referrer=https://example.com --http-cookie=Cookie: ${cookieSecret}`, + } + ); + + const output = JSON.stringify((console.log as jest.Mock).mock.calls); + expect(output).not.toContain(authorizationSecret); + expect(output).not.toContain(cookieSecret); + expect(output).toContain('language'); + expect(output).toContain('de'); + }); }); diff --git a/libs/shared/logging/src/lib/redact-sensitive-data.ts b/libs/shared/logging/src/lib/redact-sensitive-data.ts index 4f5e9f8ef..4c5201f60 100644 --- a/libs/shared/logging/src/lib/redact-sensitive-data.ts +++ b/libs/shared/logging/src/lib/redact-sensitive-data.ts @@ -18,6 +18,7 @@ const SENSITIVE_KEY_NAMES = new Set([ 'login', 'mac', 'macaddress', + 'mpvplayerarguments', 'passwd', 'password', 'pwd', @@ -28,6 +29,7 @@ const SENSITIVE_KEY_NAMES = new Set([ 'sn', 'token', 'username', + 'vlcplayerarguments', ]); const SENSITIVE_KEY_SUFFIXES = [