fix: Redact environment variable values in debug output

Chnage-type: patch
Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
Cameron Diver 2018-10-18 14:58:05 +01:00
parent 2a94a7b730
commit 6ad3a7981d
No known key found for this signature in database
GPG Key ID: 69264F9C923F55C1

View File

@ -609,10 +609,12 @@ export class Service {
// so that if we end up in a restart loop, we know exactly why // so that if we end up in a restart loop, we know exactly why
console.log(`Replacing container for service ${this.serviceName} because of config changes:`); console.log(`Replacing container for service ${this.serviceName} because of config changes:`);
if (!nonArrayEquals) { if (!nonArrayEquals) {
console.log(' Non-array fields: ', JSON.stringify(diff( // Try not to leak any sensitive information
thisOmitted, const diffObj = diff(thisOmitted, otherOmitted) as ServiceConfig;
otherOmitted, if (diffObj.environment != null) {
))); diffObj.environment = _.mapValues(diffObj.environment, () => 'hidden');
}
console.log(' Non-array fields: ', JSON.stringify(diffObj));
} }
if (differentArrayFields.length > 0) { if (differentArrayFields.length > 0) {
console.log(' Array Fields: ', differentArrayFields.join(',')); console.log(' Array Fields: ', differentArrayFields.join(','));