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

Dollar ($) sign gets doubled in credentials if exposed as ENV and used in DSL script

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • Jenkins ver. 2.204.5
      Job DSL (job-dsl): 1.77
      Credentials Binding Plugin (credentials-binding): 1.21

      Steps to reproduce

      • Create a Username/Password pair in Credentials both should contain dollar signs (for example u$er and pa$$word)
      • Create a seed job in Jenkins
      • Bind this credentials pair as env variables in the job
      • Add "Process Job DSLs" step with the following in script:

       

      println binding.variables.get('STASH_USERNAME')
      println binding.variables.get('STASH_PASSWORD')
      

       

      • Run the job and see both STASH_PASSWORD and STASH_USERNAME unmasked with two dollars:

       

      Processing provided DSL script
      u$$er
      pa$$$$word

      Workaround

      If EnvInjectBuildWrapper is enabled for the job, the result will be

      Processing provided DSL script
      ****
      pa$word

       As you can see, the second dollar in a pa$$word was escaped, which is also wrong.

       

       

            jamietanna Jamie Tanna
            decayofmin Roman Komkov
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: