Skip to content

Commit d8fbc20

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 d8fbc20

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

task_spec/spec/acceptance/init_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,18 @@ 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+
# verify that the password is not in the output
280+
expect { run_task('puppet_agent::install', 'target', { 'collection' => puppet_8_collection, 'password' => '1234' }, config: config) }.to output(%r{"password":\"Sensitive [value redacted]\"}).to_stdout
269281
end
270282
end
271283
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)