Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-72036

usernameColonPassword does not properly masked credentials

XMLWordPrintable

      Using withCredentials with usernameColonPassword only masks credentials with the USERNAME:PASSWORD format, but when they're used, applications can print them in different format (only the password or only the username).

      Reproduction Steps

      In this example I'm leaking the username, as I'm not aware of applications which could leak password.

      Create a Username with password credentialsId with basic-cred as ID
      Check "Treat username as secret"

      Create a pipeline with the following script:

      pipeline {
          agent any
          
          stages {
              stage('HTTP Request') {
                  steps {
                      withCredentials([usernameColonPassword(credentialsId: 'basic-cred', variable: 'BASIC_AUTH')]) {
                          sh '''
                             curl -v https://$BASIC_AUTH@google.com
                          '''
                      }
                  }
              }
          }
      }
      

      Built it and go to the build log

            Unassigned Unassigned
            kevingrdj Kevin Guerroudj
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: