fix(logging): suppress external player arguments

This commit is contained in:
4gray committed 2026-07-18 21:14:44 +02:00
1 parent 535dc809f0
commit b770c97c11
2 files changed
+24

No files matched your search

@@ -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');
});
});
@@ -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 = [