Skip to content

file resource type displays Sensitive information in clear text in output when Deferred #9384

Closed
@bobnegri

Description

@bobnegri

Describe the Bug

We are passing a Sensitive object from vault_lookup to the file resource type using stdlib::deferrable_epp.
Running puppet agent --test results in the updated secret being rendered to the screen in plain text.

Expected Behavior

The file resource type should not render Sensitive variable values in clear text in file difference output. The value rendered to output should be changed from Redacted to Redacted.

Steps to Reproduce

Steps to reproduce the behavior:

$my_vars = {
  'url' => $external_url,
  'app_id' => $external_app_id,
  'app_token => Deferred('vault_lookup::lookup', [
      $path_to_app_id_token, {
          'vault_addr' => $vault_url,
          'cert_role'  => $servertype,
          'field'      => 'app_id_token_pw',
      },
  ]),
}

file { '/opt/my_app/my_script.sh':
  ensure  => file,
  owner   => 'root',
  group   => 'root',
  mode    => '0750',
  content => stdlib::deferrable_epp("${module_name}/opt/my_app/my_script.sh.epp", $my_vars),
}
  1. In HashiCorp vault, update the token value.
  2. On the Linux server, execute: sudo puppet agent --test
  3. The output should show the new token value and the old token value in clear text.

Environment

  • Version puppet-agent 8.5.1, puppetlabs-stdlib 9.6.0, and puppet-vault_lookup 1.1.0
  • Platform Ubuntu 22.04

Additional Context

I'm pretty sure the secret was not displayed when it changed under puppet 7.24.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagedJira issue has been created for this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions