fix: resolve remaining telemetry test failures

- Fix event validator to not filter out generic 'key' property
- Handle compound key terms (apikey, api_key) while allowing standalone 'key'
- Fix batch processor test expectations to account for circuit breaker limits
- Adjust dead letter queue test to expect 25 items due to circuit breaker opening after 5 failures
- Fix test mocks to fail for all retry attempts before adding to dead letter queue

All 252 telemetry tests now passing with 90.75% code coverage
This commit is contained in:
czlonkowski
2025-09-26 17:48:18 +02:00
parent 676c693885
commit a1a9ff63d2
5 changed files with 64 additions and 44 deletions

View File

@@ -121,7 +121,7 @@ function isSensitiveKey(key: string): boolean {
// Core sensitive terms
'password', 'passwd', 'pwd',
'token', 'jwt', 'bearer',
'key', 'apikey', 'api_key', 'api-key',
'apikey', 'api_key', 'api-key',
'secret', 'private',
'credential', 'cred', 'auth',
@@ -143,6 +143,15 @@ function isSensitiveKey(key: string): boolean {
return true;
}
// Check for compound key terms specifically
if (lowerKey.includes('key') && lowerKey !== 'key') {
// Check if it's a compound term like apikey, api_key, etc.
const keyPatterns = ['apikey', 'api_key', 'api-key', 'secretkey', 'secret_key', 'privatekey', 'private_key'];
if (keyPatterns.some(pattern => lowerKey.includes(pattern))) {
return true;
}
}
// Check for substring matches with word boundaries
return sensitivePatterns.some(pattern => {
// Match as whole words or with common separators