diff --git a/backend/src/entities/connection/use-cases/test-connection.use.case.ts b/backend/src/entities/connection/use-cases/test-connection.use.case.ts index 55e07340..a570c385 100644 --- a/backend/src/entities/connection/use-cases/test-connection.use.case.ts +++ b/backend/src/entities/connection/use-cases/test-connection.use.case.ts @@ -41,8 +41,16 @@ export class TestConnectionUseCase update_info: { connectionId, masterPwd }, connection_parameters: connectionData, } = inputData; + const foundConnection = await this._dbContext.connectionRepository.findOne({ + where: { id: connectionId }, + }); + if (foundConnection.masterEncryption && !masterPwd) { + return { + result: false, + message: Messages.MASTER_PASSWORD_MISSING, + }; + } if (connectionId) { - let toUpdate; try { toUpdate = await this._dbContext.connectionRepository.findAndDecryptConnection(connectionId, masterPwd); diff --git a/backend/src/exceptions/utils/process-exception-message.ts b/backend/src/exceptions/utils/process-exception-message.ts index 50d5e5b9..67bffe60 100644 --- a/backend/src/exceptions/utils/process-exception-message.ts +++ b/backend/src/exceptions/utils/process-exception-message.ts @@ -28,6 +28,8 @@ export function processExceptionMessage(message: string): string { return PROCESSING_MESSAGES_REPLACE.VIOLATES_FOREIGN_CONSTRAINT_MSSQL(msgInLowerCase); case msgInLowerCase.includes(PROCESSING_MESSAGES_FIND.SELECT_COMMAND_DENIED_MYSQL): return PROCESSING_MESSAGES_REPLACE.SELECT_COMMAND_DENIED_MYSQL(msgInLowerCase); + case msgInLowerCase.includes(PROCESSING_MESSAGES_FIND.Malformed_UTF_data): + return PROCESSING_MESSAGES_REPLACE.Malformed_UTF_data; default: return message; } diff --git a/backend/src/exceptions/utils/processing-messages-find.ts b/backend/src/exceptions/utils/processing-messages-find.ts index 2c97f439..0a0cc6e9 100644 --- a/backend/src/exceptions/utils/processing-messages-find.ts +++ b/backend/src/exceptions/utils/processing-messages-find.ts @@ -13,4 +13,5 @@ export const PROCESSING_MESSAGES_FIND = { VIOLATES_FOREIGN_CONSTRAINT_MYSQL: 'cannot delete or update a parent row: a foreign key constraint fails', VIOLATES_FOREIGN_CONSTRAINT_MSSQL: 'statement conflicted with the reference constraint', SELECT_COMMAND_DENIED_MYSQL: 'select command denied to user', + Malformed_UTF_data: 'malformed utf-8 data', }; diff --git a/backend/src/exceptions/utils/processing-messages-replace.ts b/backend/src/exceptions/utils/processing-messages-replace.ts index 5e246fc6..fd3fd70d 100644 --- a/backend/src/exceptions/utils/processing-messages-replace.ts +++ b/backend/src/exceptions/utils/processing-messages-replace.ts @@ -70,4 +70,6 @@ export const PROCESSING_MESSAGES_REPLACE = { `; return message; }, + + Malformed_UTF_data: 'Failed to decrypt connection. Please check that master password is correct.', };