Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
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).
I have a branch of the git client plugin which replaces "echo" with "cat" on Unix, and replaces "echo" with "type" on Windows so that no shell interpretation is applied to the user provided username or password.
The current location is PR207-retry-1. It is a large enough change that it will need extensive testing before I merge it into the main development line. It currently passes automated tests but has not been through more thorough interactive testing.