Skip to content

Commit e501d5a

Browse files
committed
security: implement secure error handling to prevent information disclosure
1 parent c179ac8 commit e501d5a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/lib/encryption/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from './constants';
77
import { secureStorage } from './secureStorage';
88
import { SecureString } from '../utils/secureString';
9-
import { SecureError, SECURE_ERRORS, logSecureError } from '../errors/SecureError';
9+
import { SecureError, logSecureError } from '../errors/SecureError';
1010

1111
export interface EncryptedNote {
1212
encryptedTitle: string;

src/lib/errors/SecureError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function logSecureError(error: SecureError, context?: string): void {
102102
console.warn('[SECURITY]', logData);
103103
break;
104104
case 'low':
105-
console.info('[SECURITY]', logData);
105+
console.warn('[SECURITY]', logData);
106106
break;
107107
}
108108
}

src/services/webSocketService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
verifyWebSocketMessage,
1717
clearMessageAuth,
1818
} from '@/lib/utils/messageAuth';
19-
import { SecureError, logSecureError, SECURE_ERRORS } from '@/lib/errors/SecureError';
19+
import { SecureError, logSecureError } from '@/lib/errors/SecureError';
2020

2121
// Debug logging utility with security safeguards
2222
// Set to false to disable debug logs, or use DEBUG_WEBSOCKET=true env var to enable
@@ -524,7 +524,7 @@ class WebSocketService implements WebSocketServiceInterface {
524524
this.eventHandlers.onAuthenticated?.(message.userId);
525525
break;
526526

527-
case 'auth_failed':
527+
case 'auth_failed': {
528528
this.state.isAuthenticated = false;
529529
this.state.userId = null;
530530
debugLog('Auth', `Authentication failed: ${message.message}`);
@@ -544,6 +544,7 @@ class WebSocketService implements WebSocketServiceInterface {
544544
code: 'AUTH_FAILED',
545545
});
546546
break;
547+
}
547548

548549
case 'note_sync':
549550
// Validate note sync message structure

0 commit comments

Comments
 (0)