1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Flag misconfigured project credentialSecret

This commit is contained in:
Nick O'Leary 2017-12-19 14:00:58 +00:00
parent 33a5b84181
commit 05f90394db
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -205,8 +205,16 @@ var api = module.exports = {
var clearInvalidFlag = false;
if (credentials.hasOwnProperty("$")) {
if (encryptionEnabled === false) {
// The credentials appear to be encrypted, but our config
// thinks they are not.
var error = new Error("Failed to decrypt credentials");
error.code = "credentials_load_failed";
if (activeProject) {
// This is a project with a bad key. Mark it as invalid
// TODO: this delves too deep into Project structure
activeProject.credentialSecretInvalid = true;
return when.reject(error);
}
return when.reject(error);
}
// These are encrypted credentials
@ -219,7 +227,7 @@ var api = module.exports = {
log.warn(log._("nodes.credentials.error",{message:err.toString()}))
var error = new Error("Failed to decrypt credentials");
error.code = "credentials_load_failed";
if (projectKey) {
if (activeProject) {
// This is a project with a bad key. Mark it as invalid
// TODO: this delves too deep into Project structure
activeProject.credentialSecretInvalid = true;