fix(#289): Prevent private key decryption error data leaks
Modified decrypt() error handling to only log error type without stack traces, error details, or encrypted content. Added test to verify sensitive data is not exposed in logs. Security improvement: Prevents leakage of encrypted data or partial decryption results through error logs. Fixes #289 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -90,7 +90,10 @@ export class CryptoService {
|
||||
|
||||
return decrypted;
|
||||
} catch (error) {
|
||||
this.logger.error("Decryption failed", error);
|
||||
// Security: Do not log error details which may contain sensitive data
|
||||
// Only log error type/code without stack trace or encrypted content
|
||||
const errorType = error instanceof Error ? error.constructor.name : "Unknown";
|
||||
this.logger.error(`Decryption failed: ${errorType}`);
|
||||
throw new Error("Failed to decrypt data");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user