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

Special characters in password are not escaped properly in git plugin's withCredentials

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • git-client-plugin
    • None
    • Jenkins: 2.46.3
      git-client-plugin: 2.4.6

    Description

      When using a username/password credential with the git plugin on an agent where /bin/sh is dash, and either the username or the password contains echo special characters sequences (see below), those character sequences are interpreted by the echo command used to pass the credentials to git. For example, given a password of anExampleWithA\newline the password output will actually be:

      anExampleWithA
      ewline

      The character sequences that need to be escaped are:

      \b A backspace character is output.
      \c Subsequent output is suppressed. This is normally used at the end of the last argument to suppress the trailing newline that echo would otherwise output.
      \f Output a form feed.
      \n Output a newline character.
      \r Output a carriage return.
      \t Output a (horizontal) tab character.
      \v Output a vertical tab.
      \0digits
      Output the character whose value is given by zero to three octal digits. If there are zero digits, a nul character is output.
      \\ Output a backslash.

      The issue can be worked around by changing /bin/sh on the executing agents to a shell that does not do character sequence interpretation by default (e.g. bash).

      Attachments

        Activity

          greg_symons Gregory Symons created issue -
          markewaite Mark Waite made changes -
          Field Original Value New Value
          Assignee Mark Waite [ markewaite ]
          markewaite Mark Waite made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
          markewaite Mark Waite made changes -
          Status Fixed but Unreleased [ 10203 ] Closed [ 6 ]
          robross0606 rross made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          markewaite Mark Waite made changes -
          Summary Special characters in password are not escaped properly Special characters in password are not escaped properly in withCredentials
          markewaite Mark Waite made changes -
          Status Reopened [ 4 ] Open [ 1 ]
          markewaite Mark Waite made changes -
          Summary Special characters in password are not escaped properly in withCredentials Special characters in password are not escaped properly in git plugin's withCredentials

          People

            Unassigned Unassigned
            greg_symons Gregory Symons
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated: