hash key and block update
MODIFY
src/server/rest/v1/service/SettingService.ts
src/server/rest/v1/service/SettingService.ts
@@ -72,6 +72,11 @@ export default class SettingService {
// Process the sensitive data if any
// Hash sensitive data before being sent to the front end
Cypher.hashSensitiveDataInJSON(setting);
+
+ // If Crypto Settings, hash key
+ if (setting.identifier === 'crypto') {
+ setting.content.crypto.key = Cypher.hash(setting.content.crypto.key);
+ }
// Return
res.json(setting);
next();
@@ -97,7 +102,13 @@ export default class SettingService {
for (const setting of settings.result) {
// Hash sensitive data before being sent to the front end
Cypher.hashSensitiveDataInJSON(setting);
+
+ // If Crypto Settings, hash key
+ if (setting.identifier === 'crypto') {
+ setting.content.crypto.key = Cypher.hash(setting.content.crypto.key);
+ }
}
+
// Return
res.json(settings);
next();
@@ -149,6 +160,18 @@ export default class SettingService {
value: settingUpdate.id
});
}
+ if (settingUpdate.identifier === 'crypto') {
+ throw new AppError({
+ source: Constants.CENTRAL_SERVER,
+ errorCode: HTTPError.CYPHER_INVALID_SENSITIVE_DATA_ERROR,
+ message: 'No support for Crypto Setting change yet.',
+ module: MODULE_NAME,
+ method: 'handleUpdateSetting',
+ user: req.user
+ });
+ }
+
+
// Get Setting
const setting = await SettingStorage.getSetting(req.user.tenantID, settingUpdate.id);
UtilsService.assertObjectExists(action, setting, `Setting with ID '${settingUpdate.id}' does not exist`,

hash key and block update