rpallela
rpallela

Reputation: 11

Jenkins hide secrets in logs

I am seeing the following issues While secrets/passwords are redacted in jenkins console log, redirecting output to a file prints teh secrets / passwords in plain text even with mask passwords plugin enabled

Steps to reproduce: Create new freestyle job and do teh following steps

  1. Select 'Inject passwords to the build as environment variables'
  2. Select 'Global passwords'
  3. Select 'Mask password parameters';
  4. Add BuildStep 'Execute Shell'; In the shell enter
env 2>&1 | tee "log.log"
  1. Save the config
  2. Build
  3. Workspace
  4. List item

open log.log and you will see the passwords printed in plain text

Is there any way to hide passwords / secrets from redirected output?

Upvotes: 1

Views: 1003

Answers (1)

towel
towel

Reputation: 2214

Unfortunately no. Once you redirect output to a file it's no longer managed by Jenkins and you have provide your own secret obfuscation.

Upvotes: 1

Related Questions