-
Bug
-
Resolution: Unresolved
-
Critical
-
None
-
Powered by SuggestiMate
Steps:
- Perform maven release plugin
- Specify SCM Credentials with " in password
- Schedule maven release
Results:
In logs I see:
Executing Maven: -B -f c:\opt\Jenkins\jobs\project-ci\workspace\pom.xml -DdevelopmentVersion=4.4.005-SNAPSHOT -DreleaseVersion=4.4.004 -Dusername=user -Dpassword=********* .... No goals have been specified for this build. You must specify a valid lifecycle phase or a goal
Build fails.
Expected results:
Release goals are passed in maven during release.
- is duplicated by
-
JENKINS-28042 Erro when commit using plugin maven scm
-
- Open
-
-
JENKINS-15871 Maven Release Plugin doesn't properly escape user's passwords during release
-
- Resolved
-
-
JENKINS-17233 Maven release fails when password contains space
-
- Closed
-
[JENKINS-14781] Maven Release Plugin performs build without goals
just to confirm
when you say it works on Linux with Iceweasel - is it still talking to the jenkins master running on windows and are you still using a password with a " symbol in it?
I've recently figured out why it fails. Checked on Linux - failed to.
Sorry, my fault. I'll update issue description.
I have another example under Windows:
USER: USERNAME
PWD: abc&xyz
When I specify the SCM logon credentials the Maven Release Plugin executions fails with the following error:
10:38:41 [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-release-plugin:2.0:prepare' with basic configurator --> 10:38:41 [DEBUG] (f) addSchema = true 10:38:41 [DEBUG] (f) allowReleasePluginSnapshot = false 10:38:41 [DEBUG] (f) allowTimestampedSnapshots = false 10:38:41 [DEBUG] (f) autoVersionSubmodules = false 10:38:41 [DEBUG] (s) basedir = D:\export\build\jenkins-slave-sbs2\workspace\project-trunk 10:38:41 [DEBUG] (f) commitByProject = false 10:38:41 [DEBUG] (f) developmentVersion = 1.2.3.4-SNAPSHOT 10:38:41 [DEBUG] (f) dryRun = true 10:38:41 [DEBUG] (f) generateReleasePoms = false 10:38:41 [DEBUG] (f) javaHome = D:\export\build\jenkins-slave-sbs2\tools\hudson.model.JDK\JDK1.7.0_latest_\jre 10:38:41 [DEBUG] (f) localCheckout = false 10:38:41 [DEBUG] (f) mavenExecutorId = invoker 10:38:41 [DEBUG] (f) mavenHome = D:\export\build\jenkins-slave-sbs2\tools\hudson.tasks.Maven_MavenInstallation\maven-3.0.4 10:38:41 [DEBUG] (f) password = abc&xyz 10:38:41 [DEBUG] (f) preparationGoals = clean verify 10:38:41 [DEBUG] (f) project = MavenProject: com.company.group:artifact:1.2.3.4-SNAPSHOT @ D:\export\build\jenkins-slave-sbs2\workspace\project-trunk\pom.xml 10:38:41 [DEBUG] (f) reactorProjects = [MavenProject: com.company.group:artifact:1.2.3.4-SNAPSHOT @ D:\export\build\jenkins-slave-sbs2\workspace\project-trunk\pom.xml] 10:38:41 [DEBUG] (f) releaseVersion = 1.2.3.4 10:38:41 [DEBUG] (f) remoteTagging = true 10:38:41 [DEBUG] (f) resume = false 10:38:41 [DEBUG] (f) scmCommentPrefix = [maven-release-plugin] 10:38:41 [DEBUG] (f) session = org.apache.maven.execution.MavenSession@2b5fab 10:38:41 [DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@1bc0e73 10:38:41 [DEBUG] (f) updateDependencies = true 10:38:41 [DEBUG] (f) useEditMode = false 10:38:41 [DEBUG] (f) username = USERNAME 10:38:41 [DEBUG] -- end configuration -- 10:38:41 [INFO] Verifying that there are no local modifications... 10:38:41 [INFO] Executing: cmd.exe /X /C "svn --username USERNAME --password ***** --non-interactive status" 10:38:41 [INFO] Working directory: D:\export\build\jenkins-slave-sbs2\workspace\project-trunk 10:38:50 [INFO] ------------------------------------------------------------------------ 10:38:50 [INFO] BUILD FAILURE 10:38:50 [INFO] ------------------------------------------------------------------------ 10:38:50 [INFO] Total time: 10.936s 10:38:50 [INFO] Finished at: Fri Oct 04 10:38:50 CEST 2013 10:38:50 [INFO] Final Memory: 7M/19M 10:38:50 [INFO] ------------------------------------------------------------------------ 10:38:51 [JENKINS] Archiving disabled 10:38:52 Waiting for Jenkins to finish collecting data 10:38:52 mavenExecutionResult exceptions not empty 10:38:52 message : Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project artifact: Unable to check for local modifications 10:38:52 Provider message: 10:38:52 The svn command failed. 10:38:52 Command output: 10:38:52 Subcommand argument required 10:38:52 Type 'svn help' for usage. 10:38:52 'xyz' is not recognized as an internal or external command, 10:38:52 operable program or batch file. 10:38:52 10:38:52 cause : Unable to check for local modifications 10:38:52 Provider message: 10:38:52 The svn command failed. 10:38:52 Command output: 10:38:52 Subcommand argument required 10:38:52 Type 'svn help' for usage. 10:38:52 'xyz' is not recognized as an internal or external command, 10:38:52 operable program or batch file. 10:38:52 10:38:52 Stack trace : 10:38:52 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project artifact: Unable to check for local modifications
The workaround is to ask users to remove shell special characters from their passwords.
There are also issues with "#" as a first character of the password:
https://kthoms.wordpress.com/tag/subversion/
In general the password needs to be escaped (quotes) and there are multiple parties involved:
- Jenkins asks for the password
- Jenkins invokes the Maven release plugin with parameter -Dpassword=******
- The Maven release plugin invokes the Subversion client tool --password=*****
We also have an user with '$' in his password. He is not able to do anything ...
This is also an issue if the password contains quote characters. For example:
- It's happy time
- Knights who say "Ni!"
As a hacky workaround, the password can be surrounded by quotes in the input field, for example:
- 'password with "double quotes"'
- "It's time to fix this critical bug after more than 4 years!!"
To make things worse, this bug allows for injection of arbitrary parameters into the mvn command that executes the release goals.
Setting password in double quote works not properly.
We just use this creepy workaround:
<!-- escape given password -->
<php function="str_replace" returnProperty="escaped_passwd"><param value="\"/><param value="
"/><param value="${env.svnpassword}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="("/><param value="("/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value=")"/><param value=")"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="@"/><param value="@"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="^"/><param value="^"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="$"/><param value="\$"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="["/><param value="["/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="]"/><param value="]"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="{"/><param value="{"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="}"/><param value="}"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="/"/><param value="\/"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="%"/><param value="%"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="|"/><param value="|"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="°"/><param value="\°"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="§"/><param value="\§"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="!"/><param value="!"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="?"/><param value="?"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="`"/><param value="\`"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="´"/><param value="\´"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="*"/><param value="*"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="+"/><param value="+"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="~"/><param value="~"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="#"/><param value="#"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="-"/><param value="-"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="_"/><param value="_"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="<"/><param value="\<"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value=">"/><param value="\>"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="&"/><param value="\&"/><param value="${escaped_passwd}"/></php>
<php function='str_replace' returnProperty='escaped_passwd'><param value='"'/><param value='\"'/><param value='${escaped_passwd}'/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="'"/><param value="\'"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value=","/><param value="\,"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value=";"/><param value="\;"/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value="."/><param value="\."/><param value="${escaped_passwd}"/></php>
<php function="str_replace" returnProperty="escaped_passwd"><param value=":"/><param value="\:"/><param value="${escaped_passwd}"/></php>
@mgrafl
"It's time to fix this critical bug after more than 4 years!!"
So we should expect a pill request with unit tests that has been verified on Linux/unix and windows platforms shortly then?
Oh and quotes probably don't work if the last character is a backslash \
Some characters may only need escaping deepending on the underlying shell. And double quotes don't work if the password contains a single double quote. I and single quotes don't work if the password contains a single single quote...
Right now this needs a better fix in the underlying maven plugin, I even then the way that maven passes the password to sub shells may not work even if it is quoted correctly to begin with. In reality use a password without shell unsafe characters like space backslash single and double quotes and percent.
Escaping quotes for Linux is no rocket science: http://stackoverflow.com/a/1250279
Maybe, it would even be sufficient to surround every argument with single quotes and replace all inner single quote with '"'"', e.g.,
return "'" + orig.replace("'", "'\"'\"'") + "'";
And on windows.. And how do you know you are running on a windows or Linux slave.... The arguments are finalized before you even creat a task for the queue let alone know what type of slave you may have.
And that article only talks about a single quote, I doubt it would work with a backslash..
I still look forward to your fully tested pull request.
Looks like this issue is releated to SCM Password.
When I perform release build, check "Provide SCM User and Password" and enter an password with " symbol plugin fails.
Also, it will be good point to use Jenkins' stored SCM Login/Password, because if I just press release without specifying SCM credentials it fails with "Authentication Failure".