diff options
author | John Snow <thelunaticscripter@outlook.com> | 2017-06-07 20:27:46 -0500 |
---|---|---|
committer | Thom May <thom@chef.io> | 2018-03-22 11:10:49 +0000 |
commit | 2871753e372d9dab4fa58d8989e6a7a4f3dfc05f (patch) | |
tree | bb39d8c2e644b69ab5695513dd9f967d0e188ff6 /lib | |
parent | 65d26d53a70a7813c36e29f819868aadacd612f9 (diff) | |
download | chef-2871753e372d9dab4fa58d8989e6a7a4f3dfc05f.tar.gz |
Suppress nested causes for sensitive exceptions
This will prevent sensitive data from leaking into debug_stacktrace output.
Signed-off-by: John Snow <thelunaticscripter@outlook.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/application.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb index b8acf41557..0d221ec878 100644 --- a/lib/chef/application.rb +++ b/lib/chef/application.rb @@ -360,10 +360,12 @@ class Chef def debug_stacktrace(e) message = "#{e.class}: #{e}\n#{e.backtrace.join("\n")}" - cause = e.cause if e.respond_to?(:cause) - until cause.nil? - message << "\n\n>>>> Caused by #{cause.class}: #{cause}\n#{cause.backtrace.join("\n")}" - cause = cause.respond_to?(:cause) ? cause.cause : nil + unless (e.message =~ /suppressed for sensitive resource/) + cause = e.cause if e.respond_to?(:cause) + until cause.nil? + message << "\n\n>>>> Caused by #{cause.class}: #{cause}\n#{cause.backtrace.join("\n")}" + cause = cause.respond_to?(:cause) ? cause.cause : nil + end end chef_stacktrace_out = "Generated at #{Time.now}\n" |