Skip to content

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

@dg42xyz

Description

@dg42xyz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions