Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensitive attribute is not respected in shell_out when a timeout occurs #201

Open
dg42xyz opened this issue Jan 31, 2020 · 2 comments
Open

Comments

@dg42xyz
Copy link

dg42xyz commented Jan 31, 2020

Description

The sensitive attribute does not work in a shell_out block when the command times out. This is very similar to issue chef/chef#7517

Chef Version

chef_version=14.12.3

Platform Version

platform=windows
platform_version=10.0.14393 (Windows Server 2016)

Replication Case

Create a recipe with the following code:

shell_out!('sleep 10; echo "my super secret"', timeout: 5, sensitive: true)

Client Output

Synchronizing Cookbooks:
         - sensitive_test (0.1.0)
       Installing Cookbook Gems:
       Compiling Cookbooks...
       
       ================================================================================
       Recipe Compile Error in C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/cookbooks/sensitive_test/recipes/default.rb
       ================================================================================
       
       Mixlib::ShellOut::CommandTimeout
       --------------------------------
       command timed out:
       Command execution failed. STDOUT/STDERR suppressed for sensitive resource
       ProcessId: 2824
       app_name: C:\Windows\system32\cmd.exe
       command_line: cmd /c "sleep 10; echo "my super secret""
       timeout: 5
       
       System Info:
       ------------
       chef_version=14.12.3
       platform=windows
       platform_version=10.0.14393
       ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]
       program_name=C:/opscode/chef/bin/chef-client
       executable=C:/opscode/chef/bin/chef-client
       
       
       Running handlers:
       [2020-01-31T21:00:21+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2020-01-31T21:00:21+00:00] ERROR: Exception handlers complete
       Chef Client failed. 0 resources updated in 14 seconds
       [2020-01-31T21:00:21+00:00] FATAL: Stacktrace dumped to C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
       [2020-01-31T21:00:21+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2020-01-31T21:00:21+00:00] FATAL: Mixlib::ShellOut::CommandTimeout: command timed out:
       Command execution failed. STDOUT/STDERR suppressed for sensitive resource
       ProcessId: 2824
       app_name: C:\Windows\system32\cmd.exe
       command_line: cmd /c "sleep 10; echo "my super secret""
       timeout: 5
@lamont-granquist
Copy link
Contributor

This is a bug in the windows implementation of mixlib-shellout not in chef-client code

@lamont-granquist lamont-granquist transferred this issue from chef/chef Jan 31, 2020
@shancz
Copy link

shancz commented Nov 30, 2021

Hi,

I'm facing a similar issue on AIX where I need to handle _out time out.
I need a way to handle the shell out exception. Any example will be greatly appreciated.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants