Skip to content

Commit 9be9a09

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 9be9a09

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

task_spec/spec/acceptance/init_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,22 @@ 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 = bolt_config.merge!(
272+
'log' => {
273+
'console' => {
274+
'level' => 'debug'
275+
}
276+
},
277+
)
278+
279+
results = run_task('puppet_agent::install', 'target', { 'collection' => puppet_8_collection, 'password' => '1234' }, config: config)
280+
results.each do |res|
281+
puts res
282+
expect(res).to include('status' => 'success')
283+
expect(res['value']['_output']).to match(%r{"password":\"Sensitive [value redacted]\"})
284+
end
269285
end
270286
end
271287
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)