[JIRA] (JENKINS-44860) Disable masking of usernames

28 views
Skip to first unread message

oliver.lockwood@cantab.net (JIRA)

unread,
Apr 23, 2018, 5:42:03 AM4/23/18
to jenkinsc...@googlegroups.com
Oliver Lockwood commented on Improvement JENKINS-44860
 
Re: Disable masking of usernames

We came across this issue last week as well and, having discovered this issue, are contemplating contributing a fix.

Just to be clear, we'd like to:

  • use the username/password credentials type
  • use the pipeline script
    {{withCredentials([usernamePassword(credentialsId: 'MY_CRED_ID', usernameVariable: 'USER_ENV_VAR', passwordVariable: 'PASSWORD_ENV_VAR')]) { ... }}}
    to provide username and password as environment variables to the pipeline script closure and e.g. any shell commands within it
  • have any instances of whatever the password is be masked in console output
  • NOT have any instances of whatever the username is masked in console output.

This would then correlate correctly with the view on the jenkinsUrl/credentials page, which shows user-name/****** (description) in the Name column for credentials of this type.

Jesse Glick we already found the UsernamePasswordMultiBinding class; but it looks to us (perhaps naively?) that the return value of the `bind()` method is used in BindingStep.Execution.start() both for actually providing the environment variables (through the use of EnvironmentExpanderand for obfuscating the secrets into **** (through the use of Filter).  So it's not clear to me how the patch you're suggesting would allow us to still provide the username from a Credential without it being obfuscated.  Have I misunderstood your comment?  Many thanks.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

oliver.lockwood@cantab.net (JIRA)

unread,
Apr 23, 2018, 5:43:02 AM4/23/18
to jenkinsc...@googlegroups.com
Oliver Lockwood edited a comment on Improvement JENKINS-44860
We came across this issue last week as well and, having discovered this issue, are contemplating contributing a fix.

Just to be clear, we'd like to:
* use the username/password credentials type
* use the
following pipeline script  to provide username and password as environment variables to the pipeline script closure and e.g. any shell commands within it:
{{withCredentials([usernamePassword(credentialsId: 'MY_CRED_ID', usernameVariable: 'USER_ENV_VAR', passwordVariable: 'PASSWORD_ENV_VAR')]) \{ ... }}}
to provide username and password as environment variables to the pipeline script closure and e.g. any shell commands within it
* have any instances of whatever the password is be masked in console output
* NOT have any instances of whatever the username is masked in console output.


This would then correlate correctly with the view on the {{jenkinsUrl/credentials}} page, which shows {{user-name/****** (description)}} in the {{Name}} column for credentials of this type.

[~jglick] we already found the {{UsernamePasswordMultiBinding}} class; but it looks to us (perhaps naively?) that the return value of the `bind()` method is used in {{BindingStep.Execution.start()}} *both* for actually providing the environment variables (through the use of {{EnvironmentExpander}}) *and* for obfuscating the secrets into {{****}} (through the use of {{Filter}}).  So it's not clear to me how the patch you're suggesting would allow us to still provide the username from a Credential without it being obfuscated.  Have I misunderstood your comment?  Many thanks.

oliver.lockwood@cantab.net (JIRA)

unread,
Apr 23, 2018, 5:44:03 AM4/23/18
to jenkinsc...@googlegroups.com
Oliver Lockwood edited a comment on Improvement JENKINS-44860
We came across this issue last week as well and, having discovered this issue, are contemplating contributing a fix.

Just to be clear, we'd like to:
* use the username/password credentials type
* use the following pipeline script to provide username and password as environment variables to the pipeline script closure and e.g. any shell commands within it:
** { { noformat}
withCredentials([usernamePassword(credentialsId: 'MY_CRED_ID', usernameVariable: 'USER_ENV_VAR', passwordVariable: 'PASSWORD_ENV_VAR')]) \ { ... } {noformat } }
* have any instances of whatever the password is be masked in console output
* NOT have any instances of whatever the username is masked in console output.

This would then correlate correctly with the view on the {{jenkinsUrl/credentials}} page, which shows {{user-name/****** (description)}} in the {{Name}} column for credentials of this type.

[~jglick] we already found the {{UsernamePasswordMultiBinding}} class; but it looks to us (perhaps naively?) that the return value of the `bind()` method is used in {{BindingStep.Execution.start()}} *both* for actually providing the environment variables (through the use of {{EnvironmentExpander}}) *and* for obfuscating the secrets into {{****}} (through the use of {{Filter}}).  So it's not clear to me how the patch you're suggesting would allow us to still provide the username from a Credential without it being obfuscated.  Have I misunderstood your comment?  Many thanks.

oliver.lockwood@cantab.net (JIRA)

unread,
Apr 23, 2018, 5:44:04 AM4/23/18
to jenkinsc...@googlegroups.com

oliver.lockwood@cantab.net (JIRA)

unread,
Apr 23, 2018, 5:45:03 AM4/23/18
to jenkinsc...@googlegroups.com

oliver.lockwood@cantab.net (JIRA)

unread,
Apr 23, 2018, 5:45:03 AM4/23/18
to jenkinsc...@googlegroups.com

henrist@henrist.net (JIRA)

unread,
Aug 8, 2018, 11:04:03 AM8/8/18
to jenkinsc...@googlegroups.com

I made a new PR for this in July, but seems I didn't get it linked up here correctly. https://github.com/jenkinsci/credentials-binding-plugin/pull/50

This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

nicolaw@tfb.net (JIRA)

unread,
Aug 16, 2018, 5:21:02 AM8/16/18
to jenkinsc...@googlegroups.com

Fixing this would be wonderful. Console logs with every occurrence of `jenkins`, `release`, `artifactory`, `git` and `user` etc being masked out can make debugging really quite tedious!

jglick@cloudbees.com (JIRA)

unread,
Nov 6, 2018, 12:12:04 PM11/6/18
to jenkinsc...@googlegroups.com

Trivially worked around FWIW:

sh 'echo $USER_ENV_VAR | od -a'
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jglick@cloudbees.com (JIRA)

unread,
Jan 7, 2019, 11:51:05 AM1/7/19
to jenkinsc...@googlegroups.com

PR 54 skips username binding entirely, so suitable for the common case that the username portion of the credentials is something generic enough to be hard-coded.

oeuftete+jenkins@gmail.com (JIRA)

unread,
Jan 29, 2019, 12:09:02 PM1/29/19
to jenkinsc...@googlegroups.com
oeuftete commented on Improvement JENKINS-44860

I am not sure PR 54 addresses the spirit of the request.  Or really solves anything... why wouldn't a user just update their secret to just secret text if they need to hardcode the username?

There is value in storing the credential as a username and a password. Usernames are going to be things like "`jenkins`, `release`, `artifactory`, `git` and `user`" as the opener and commenters have noted.  The workaround noted above does not address the types of problems the user name masking causes... I believe for most users, and certainly for me, these are issues with console log processing, e.g.

00:16:31.073 [Scala Compiler] [ERROR] Can't create blame requests for some affected files:
00:16:31.073 [Scala Compiler] [ERROR] - Skipping non-workspace file /home/****/workspace/somebuild/someFile.scala
00:16:31.073 [Scala Compiler] [ERROR] - Skipping non-workspace file /home/****/workspace/somebuild/someOtherFile.scala

... where `jenkins` was filtered out in the console log.

jglick@cloudbees.com (JIRA)

unread,
Jan 29, 2019, 12:36:02 PM1/29/19
to jenkinsc...@googlegroups.com

why wouldn't a user just update their secret to just secret text if they need to hardcode the username?

In some cases, you cannot, because the credentials are also being used by other plugins which expect username/password.

I have a mind to develop a full fix for this at some point, but it is on my back burner. Will likely also need dedicated support in pipeline-model-definition-plugin.

benoit@rudder.io (JIRA)

unread,
May 14, 2019, 8:08:05 AM5/14/19
to jenkinsc...@googlegroups.com

We have the same problem and I must say this is a PITA.

The username is not a secret and should not be hidden, especially since the method used is to grep any string that 'may' contain the username which is clunky at best.

Moreover, the username is often a common name, which result in logs that are totally mangled and unreadable, all our url are non clickable because they contain the 3 letters 'git'.

This renders the credential feature an anti-feature for us.

 

Please remove the login from being masked! And if you insist on keeping it, please add an option to disable this feature.

Thank you

 

c.naslain@lectra.com (JIRA)

unread,
May 17, 2019, 5:33:04 PM5/17/19
to jenkinsc...@googlegroups.com
Chris N. commented on Improvement JENKINS-44860

+1 to fix this. very painful with configuration where the credential user is also the jenkins user (username is in home dir!!!).

tim.jaacks@garz-fricke.de (JIRA)

unread,
May 21, 2019, 9:29:04 AM5/21/19
to jenkinsc...@googlegroups.com

+1 from me. This is REALLY annoying. We are using "jenkins" as a username as well, while our Jenkins instance is running under "http://our-company-intranet/jenkins/". This bug changes all URLs in the job log to "http://our-company-intranet/****", making them unusable.

dmel50@hotmail.com (JIRA)

unread,
Jun 4, 2019, 9:30:02 AM6/4/19
to jenkinsc...@googlegroups.com

+1 to fix, I need to print urls but they are partially masked as they happen to contain a username somewhere in the FQDN

stefan.thurnherr@gmail.com (JIRA)

unread,
Aug 20, 2019, 10:26:03 AM8/20/19
to jenkinsc...@googlegroups.com

+1 to fix, parsing the console log with the warnings-ng jenkins plugin doesn't work otherwise:

10:19:08  [Java] [-ERROR-] Can't resolve absolute paths for some files:
10:19:08  [Java] [-ERROR-] - /export/jenkins/workspace/_jenkins-warnings-to-warnings-ng/****-core/src/main/java/com/company/****/mypackage/SomeClass.java
[...]
10:19:08  [Java] [-ERROR-] Can't create fingerprints for some files:
10:19:08  [Java] [-ERROR-] - '/export/jenkins/workspace/_jenkins-warnings-to-warnings-ng/****-core/src/main/java/com/company/****/mypackage/SomeClass.java', IO exception has been thrown: java.nio.file.NoSuchFileException: /export/jenkins/workspace/_jenkins-warnings-to-warnings-ng/****-core/src/main/java/com/company/****/mypackage/SomeClass.java
[...]
10:19:08  [Java] [-ERROR-] Git blame errors:
10:19:08  [Java] [-ERROR-] - no blame results for request <****-core/src/main/java/com/company/****/mypackage/SomeClass.java - [82]>.

ppietraszkiewicz@psi.de (JIRA)

unread,
Nov 6, 2019, 2:58:03 AM11/6/19
to jenkinsc...@googlegroups.com

+1 to fix, scrambles commands in the console output where it needs not to, scrambles URLs

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages