Skip to content

Commit c71aff7

Browse files
author
jordanbreen28
committed
bug: mark password as sensitive in install.json
This commit marks `password` as sensitive in the install.json bolt task param metadata. This prevents password from being shown in plaintext, in the bolt logs. before: ``` Running task puppet_agent::install with '{"retry":5,"collection":"puppetcore8","version":"latest","password":"1234","_task":"puppet_agent::install"}' on [".."] ``` after: ``` Running task puppet_agent::install with '{"retry":5,"collection":"puppetcore8","version":"latest","password":"Sensitive [value redacted]","_task":"puppet_agent::install"}' on [".."] ```
1 parent 22e07b9 commit c71aff7

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

task_spec/spec/acceptance/init_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@ def latest_sources
266266
expect(res).to include('status' => 'success')
267267
expect(res['value']['_output']).to match(%r{Puppet Agent #{installed_version} detected. Nothing to do.})
268268
end
269+
# Verify that the password is not in the output
270+
it 'redacts password in output' do
271+
results = run_task('puppet_agent::install', 'target', { 'collection' => puppet_8_collection, 'password' => '1234' })
272+
results.each do |res|
273+
expect(res).to include('status' => 'success')
274+
expect(res['value']['_output']).to match(%r{"password":\"Sensitive [value redacted]\"})
275+
end
276+
end
269277
end
270278
end
271279
end

tasks/install.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
},
4949
"password": {
5050
"description": "The password to use when downloading from a source location requiring authentication",
51+
"sensitive": true,
5152
"type": "Optional[String]"
5253
}
5354
},

0 commit comments

Comments
 (0)