• Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • Credentials Binding v1.2, Credentials v1.18, Jenkins v1.580.1

      A username-password combo is bound to CREDENTIALS, where the password contains two or more consecutive dollar signs.

      Those multiple dollar signs are returned as a single dollar sign in the $CREDENTIALS variable.

          [JENKINS-27040] Bound variables strip multiple dollar signs

          mephi42 added a comment -

          The issue is still present in Jenkins 2.46.2 and Credentials Binding Plugin 1.11.

          I was able to create a minimal repro: https://github.com/mephi42/JENKINS-27040

          mephi42 added a comment - The issue is still present in Jenkins 2.46.2 and Credentials Binding Plugin 1.11. I was able to create a minimal repro: https://github.com/mephi42/JENKINS-27040

          mephi42 added a comment - - edited

          I was also able to reproduce this in the unit test environment: jenkins-27040-test.patch

          org.junit.ComparisonFailure:
          Expected :bob/s$$cr$$t
          Actual   :bob/s$cr$t

          mephi42 added a comment - - edited I was also able to reproduce this in the unit test environment: jenkins-27040-test.patch org.junit.ComparisonFailure: E xpected :bob/s$$cr$$t Actual   :bob/s$cr$t

          Jesse Glick added a comment -

          For freestyle projects supposedly this is as designed. (Code in Launcher.) Does not happen in Pipeline.

          Jesse Glick added a comment - For freestyle projects supposedly this is as designed. (Code in Launcher .) Does not happen in Pipeline.

          Jesse Glick added a comment -

          Jesse Glick added a comment - See JENKINS-40734 .

          mephi42 added a comment -

          mephi42 added a comment - The change from $$ to $ seems to be happening here: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/AbstractBuild.java#L935

          mephi42 added a comment -

          Sorry, I posted before I saw your reply. Thanks for the information.

          mephi42 added a comment - Sorry, I posted before I saw your reply. Thanks for the information.

          Jesse Glick added a comment -

          Perhaps. Anyway, not a bug in this plugin.

          Jesse Glick added a comment - Perhaps. Anyway, not a bug in this plugin.

          mephi42 added a comment -

          I was able to work around the problem by putting $$$$$ instead of $$ into the GUI. Maybe this information would be helpful to whomever else bumps into this.

          mephi42 added a comment - I was able to work around the problem by putting $$$$$ instead of $$ into the GUI. Maybe this information would be helpful to whomever else bumps into this.

          Jesse Glick added a comment -

          Or just use Pipeline, which will behave correctly.

          Jesse Glick added a comment - Or just use Pipeline, which will behave correctly.

          I can confirm that the 5-dollar workaround suggested by mephi42 does work in some cases, but as jglick points out there are many places in Jenkins where variables are expanded.  

          For example, the workaround works for a general shell step (some-command.sh -arg "$PASSWORD") but not for a gradle step, where even single-quoted switches like '-Pswitch=$PASSWORD' will again lose the extra $s.  

          Pipeline is probably the best solution, but in the interim I found myself having to change the password.

          Alexander Komarov added a comment - I can confirm that the 5-dollar workaround suggested by  mephi42 does work in some cases, but as jglick points out there are many places in Jenkins where variables are expanded.   For example, the workaround works for a general shell step ( some-command.sh -arg "$PASSWORD" ) but not for a gradle step, where even single-quoted switches like '-Pswitch=$PASSWORD' will again lose the extra $s.   Pipeline is probably the best solution, but in the interim I found myself having to change the password.

            jglick Jesse Glick
            temujin9 Nathaniel Eliot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: