From 42c01f241cb9663ba1bbe6875011bf814c53ea9b Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 14 Sep 2018 10:24:34 -0700 Subject: [PATCH] Mark password as sensitive in logs --- plugins/commands/cloud/client/client.rb | 2 ++ test/unit/plugins/commands/cloud/client_test.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/commands/cloud/client/client.rb b/plugins/commands/cloud/client/client.rb index 3ca4826fe..f0df2782e 100644 --- a/plugins/commands/cloud/client/client.rb +++ b/plugins/commands/cloud/client/client.rb @@ -61,6 +61,7 @@ module VagrantPlugins def login(description: nil, code: nil) @logger.info("Logging in '#{username_or_email}'") + Vagrant::Util::CredentialScrubber.sensitive(password) response = post( "/api/v1/authenticate", { user: { @@ -85,6 +86,7 @@ module VagrantPlugins def request_code(delivery_method) @env.ui.warn("Requesting 2FA code via #{delivery_method.upcase}...") + Vagrant::Util::CredentialScrubber.sensitive(password) response = post( "/api/v1/two-factor/request-code", { user: { diff --git a/test/unit/plugins/commands/cloud/client_test.rb b/test/unit/plugins/commands/cloud/client_test.rb index 9cdfe8ac0..649a3705c 100644 --- a/test/unit/plugins/commands/cloud/client_test.rb +++ b/test/unit/plugins/commands/cloud/client_test.rb @@ -76,7 +76,7 @@ describe VagrantPlugins::CloudCommand::Client do } let(:login) { "foo" } - let(:password) { "bar" } + let(:password) { "supersecretpassword" } let(:description) { "Token description" } let(:headers) { @@ -182,7 +182,7 @@ describe VagrantPlugins::CloudCommand::Client do } let(:login) { "foo" } - let(:password) { "bar" } + let(:password) { "supersecretpassword" } let(:delivery_method) { "sms" } let(:headers) {