How to mask parameters and password in Jenkins build history?

Viewed 6468

When using Password parameter to accept user credentials, Jenkins Build History -> Parameters is showing Password in plain text.

enter image description here

How to mask it?

2 Answers

You can use the regular password parameter type, for example using parameters defined in the jenkinsfile: https://jenkins.io/doc/book/pipeline/syntax/#parameters

The problem with that one is that, even if it masks the password when you access the "Parameters" section of a build and when you write it on "Build with parameters", if at any point that value is printed in the logs, it is shown.

To avoid that you have the Mask Passwords Plugin as said previously by Javier C.. The problem with that one is that the plugin at the moment of writing this answer is up for adoption and has security vulnerabilities.

You can use Mask Passwords Plugin.

With this plugin, passwords don't appear as plain text in the job configuration or in the console.

Related