Skip to content

Commit 9def102

Browse files
committed
Fixing unit tests
1 parent 436d562 commit 9def102

10 files changed

Lines changed: 5567 additions & 5 deletions

electron/ipc.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,22 @@ function sanitizeJSON(obj: any): any {
7777
if (obj && typeof obj === 'object') {
7878
const sanitized: any = {};
7979
for (const [key, value] of Object.entries(obj)) {
80-
// Redact keys that contain sensitive information
80+
// Skip (don't include) keys that contain sensitive information
8181
// BUT preserve tokenUsage and similar metrics
8282
const keyLower = key.toLowerCase();
83-
const shouldRedact = (
83+
const shouldSkip = (
8484
keyLower === 'apikey' ||
8585
keyLower === 'api_key' ||
8686
keyLower === 'secret' ||
8787
keyLower === 'password' ||
8888
(keyLower.includes('token') && !keyLower.includes('tokenusage') && !keyLower.includes('tokens'))
8989
);
9090

91-
if (shouldRedact) {
92-
sanitized[key] = '[REDACTED]';
93-
} else {
91+
if (!shouldSkip) {
92+
// Only include non-sensitive keys
9493
sanitized[key] = sanitizeJSON(value);
9594
}
95+
// If shouldSkip is true, we simply don't add the key to sanitized object
9696
}
9797
return sanitized;
9898
}

0 commit comments

Comments
 (0)