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
1 changed files with 9 additions and 1 deletions

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;