Masking of one character secrets mangle output

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      The masking of secrets of one char length mangles the output.

      With this credential (Secret = 'a'):

      the following job produces magled output

      #!/usr/bin/env groovy
      pipeline {
          agent any
          stages {
              stage('Check run') {
                  steps {
                      withCredentials([string(credentialsId: 'test-credentials-binding-plugin-masking-secret-text',
                              variable: 'VAR')]) {
                          sh '''
                              echo "VAR.length = ${#VAR}" 
                              echo "This should be masked: VAR = $VAR"
                          '''
                      }
                  }
              }
          }
      } 

      we obtain the following output in the console:

      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Check run)
      [Pipeline] withCredentials
      Masking supported pattern matches of $VAR
      [Pipeline] {
      [Pipeline] sh
      ****+**** ****e****c****h****o**** ****'****V****A****R****.****l****e****n****g****t****h**** ****=**** ****1****'****
      ********V****A****R****.****l****e****n****g****t****h**** ****=**** ****1****
      ********+**** ****e****c****h****o**** ****'****T****h****i****s**** ****s****h****o****u****l****d**** ****b****e**** ****m********s****k****e****d****:**** ****V****A****R**** ****=**** ********'****
      ********T****h****i****s**** ****s****h****o****u****l****d**** ****b****e**** ****m********s****k****e****d****:**** ****V****A****R**** ****=**** ********
      ****[Pipeline] }
      [Pipeline] // withCredentials 

            Assignee:
            Jesse Glick
            Reporter:
            Alberto Gallardo
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: