summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorblabade <107531905+blabade@users.noreply.github.com>2022-07-07 19:44:07 +0530
committerGitHub <noreply@github.com>2022-07-07 19:44:07 +0530
commit416704635ddddb61618184cfb5860b5859357711 (patch)
tree2618dd1eb19400146eb317bdbf3b1ab00115d9f8 /lib/chef
parent8ec9f0cbd5a092c2ca8a9630e9d577042c74285b (diff)
parent8c139ab355803a3487f91cd89121a57731a5f3e6 (diff)
downloadchef-416704635ddddb61618184cfb5860b5859357711.tar.gz
Merge pull request #13014 from chef/fix_desired_state_issue
Fixed sensitive properties unsuppressed content issue
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/mixin/properties.rb6
-rw-r--r--lib/chef/resource.rb2
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/mixin/properties.rb b/lib/chef/mixin/properties.rb
index c42e3889b0..4e00a09002 100644
--- a/lib/chef/mixin/properties.rb
+++ b/lib/chef/mixin/properties.rb
@@ -274,6 +274,12 @@ class Chef
result
end
+ # This method returns list of sensitive properties
+ # @return [Array<Property>] All sensitive properties.
+ def sensitive_properties
+ properties.values.empty? ? [] : properties.values.select(&:sensitive?)
+ end
+
# Returns the name of the name property. Returns nil if there is no name property.
#
# @return [Symbol] the name property for this resource
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index d6c5fe7cdf..c9776fe346 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -660,8 +660,8 @@ class Chef
text << "#{resource_name}(\"#{name}\") do\n"
all_props = {}
- self.class.state_properties.map do |p|
+ self.class.sensitive_properties.map do |p|
all_props[p.name.to_s] = p.sensitive? ? '"*sensitive value suppressed*"' : value_to_text(p.get(self))
rescue Chef::Exceptions::ValidationFailed
# This space left intentionally blank, the property was probably required or had an invalid default.