From a01b8a5eecb33e72cf3f266eb31ad8773b0dd65a Mon Sep 17 00:00:00 2001 From: Dmitry Shestoperov Date: Tue, 26 Sep 2017 21:31:54 -0400 Subject: password property of mount resurce is sensitive Signed-off-by: Dmitry Shestoperov --- lib/chef/resource/mount.rb | 11 +++-------- spec/unit/resource/mount_spec.rb | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb index 7e601b861a..6ea37d760f 100644 --- a/lib/chef/resource/mount.rb +++ b/lib/chef/resource/mount.rb @@ -34,6 +34,8 @@ class Chef property :supports, Hash, default: lazy { { remount: false } }, coerce: proc { |x| x.is_a?(Array) ? x.each_with_object({}) { |i, m| m[i] = true } : x } + property :password, String, sensitive: true + def initialize(name, run_context = nil) super @mount_point = name @@ -147,14 +149,7 @@ class Chef set_or_return( :username, arg, - :kind_of => [ String ] - ) - end - - def password(arg = nil) - set_or_return( - :password, - arg, + :sensitive => true, :kind_of => [ String ] ) end diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb index 466b6ac8c0..caa2e2f65a 100644 --- a/spec/unit/resource/mount_spec.rb +++ b/spec/unit/resource/mount_spec.rb @@ -205,7 +205,7 @@ describe Chef::Resource::Mount do state = @resource.state_for_resource_reporter expect(state[:mount_point]).to eq("T:") expect(state[:username]).to eq("Administrator") - expect(state[:password]).to eq("Jetstream123!") + expect(state[:password]).to eq("*sensitive value suppressed*") expect(state[:domain]).to eq("TEST_DOMAIN") expect(state[:device_type]).to eql(:device) expect(state[:fstype]).to eq("auto") -- cgit v1.2.1