Skip to content

Commit 94ad6e4

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 94ad6e4

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

task_spec/spec/acceptance/init_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,23 @@ 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+
270+
# Verify that the password is not in the output
271+
config = {
272+
'modulepath' => File.join(Dir.pwd, '..', 'fixtures', 'modules'),
273+
'log' => {
274+
'console' => {
275+
'level' => 'debug'
276+
}
277+
}
278+
}
279+
# require 'pry-byebug'
280+
# binding.pry
281+
results = run_task('puppet_agent::install', 'target', { 'collection' => puppet_8_collection, 'password' => '1234' }, config: config)
282+
results.each do |res|
283+
expect(res).to include('status' => 'success')
284+
expect(res['value']['_output']).to match(%r{"password":\"Sensitive [value redacted]\"})
285+
end
269286
end
270287
end
271288
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)