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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • git-plugin
    • None
    • Jenkins: 2.46.3
      git-client-plugin: 2.4.6
    • git plugin 5.2.0

      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).

            Unassigned Unassigned
            greg_symons Gregory Symons
            Votes:
            5 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: