-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix more potential command injection via quoting (#5164)
* fix: make quoting null safe * fix: apply quoting in artifact set version * fix: add quoting to more shell step * refactor: use import alias * fix: further quoting --------- Co-authored-by: Oliver Feldmann <[email protected]>
- Loading branch information
Showing
12 changed files
with
67 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,8 +130,8 @@ class ArtifactSetVersionTest extends BasePiperTest { | |
assertThat(shellRule.shell.join(), stringContainsInOrder([ | ||
"git add .", | ||
"git commit -m 'update version 1.2.3-20180101010203_testCommitId'", | ||
'git tag build_1.2.3-20180101010203_testCommitId', | ||
'git push myGitSshUrl build_1.2.3-20180101010203_testCommitId', | ||
"git tag 'build_1.2.3-20180101010203_testCommitId'", | ||
"git push 'myGitSshUrl' 'build_1.2.3-20180101010203_testCommitId'", | ||
] | ||
)) | ||
} | ||
|
@@ -173,8 +173,8 @@ class ArtifactSetVersionTest extends BasePiperTest { | |
assertThat(((Iterable)shellRule.shell).join(), stringContainsInOrder([ | ||
"git add .", | ||
"git commit -m 'update version 1.2.3-20180101010203_testCommitId'", | ||
'git tag build_1.2.3-20180101010203_testCommitId', | ||
'git push https://me:[email protected]/myGitRepo build_1.2.3-20180101010203_testCommitId', | ||
"git tag 'build_1.2.3-20180101010203_testCommitId'", | ||
"git push https://me:[email protected]/myGitRepo 'build_1.2.3-20180101010203_testCommitId'", | ||
] | ||
)) | ||
} | ||
|
@@ -246,8 +246,8 @@ class ArtifactSetVersionTest extends BasePiperTest { | |
assertThat(((Iterable)shellRule.shell).join(), stringContainsInOrder([ | ||
"git add .", | ||
"git commit -m 'update version 1.2.3-20180101010203_testCommitId'", | ||
'git tag build_1.2.3-20180101010203_testCommitId', | ||
'#!/bin/bash -e git push --quiet https://me:top%[email protected]/myGitRepo build_1.2.3-20180101010203_testCommitId &>/dev/null', | ||
"git tag 'build_1.2.3-20180101010203_testCommitId'", | ||
"#!/bin/bash -e git push --quiet https://me:top%[email protected]/myGitRepo 'build_1.2.3-20180101010203_testCommitId' &>/dev/null", | ||
] | ||
)) | ||
} | ||
|
@@ -278,8 +278,8 @@ class ArtifactSetVersionTest extends BasePiperTest { | |
assertThat(((Iterable)shellRule.shell).join(), stringContainsInOrder([ | ||
"git add .", | ||
"git commit -m 'update version 1.2.3-20180101010203_testCommitId'", | ||
'git tag build_1.2.3-20180101010203_testCommitId', | ||
'#!/bin/bash -e git push --quiet https://me:top%[email protected]/myGitRepo build_1.2.3-20180101010203_testCommitId &>/dev/null', | ||
"git tag 'build_1.2.3-20180101010203_testCommitId'", | ||
"#!/bin/bash -e git push --quiet https://me:top%[email protected]/myGitRepo 'build_1.2.3-20180101010203_testCommitId' &>/dev/null", | ||
] | ||
)) | ||
} | ||
|
@@ -301,7 +301,7 @@ class ArtifactSetVersionTest extends BasePiperTest { | |
void testVersioningCustomGitUserAndEMail() { | ||
stepRule.step.artifactSetVersion(script: stepRule.step, juStabGitUtils: gitUtils, buildTool: 'maven', gitSshUrl: 'myGitSshUrl', gitUserEMail: '[email protected]', gitUserName: 'test') | ||
|
||
assertThat(shellRule.shell, hasItem(containsString("git -c user.email=\"[email protected]\" -c user.name=\"test\" commit -m 'update version 1.2.3-20180101010203_testCommitId'"))) | ||
assertThat(shellRule.shell, hasItem(containsString("git -c user.email='[email protected]' -c user.name='test' commit -m 'update version 1.2.3-20180101010203_testCommitId'"))) | ||
} | ||
|
||
@Test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.