From 7ed67fdc4e0587b8075a962000f60a048f31ff52 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Sep 2024 22:55:07 +0000 Subject: [PATCH 1/2] Bump io.jenkins.tools.bom:bom-2.440.x Bumps [io.jenkins.tools.bom:bom-2.440.x](https://github.com/jenkinsci/bom) from 3387.v0f2773fa_3200 to 3413.v0d896b_76a_30d. - [Release notes](https://github.com/jenkinsci/bom/releases) - [Commits](https://github.com/jenkinsci/bom/commits) --- updated-dependencies: - dependency-name: io.jenkins.tools.bom:bom-2.440.x dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1526968891..275146ad85 100644 --- a/pom.xml +++ b/pom.xml @@ -81,7 +81,7 @@ io.jenkins.tools.bom bom-${jenkins.baseline}.x - 3387.v0f2773fa_3200 + 3413.v0d896b_76a_30d pom import From 2cdde278e3313549c128014a92bd57d4a87b5e4c Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Fri, 27 Sep 2024 19:04:30 -0600 Subject: [PATCH 2/2] Adapt to credentials 1378.v81ef4269d764 https://github.com/jenkinsci/credentials-plugin/releases/tag/1378.v81ef4269d764 includes changes that throw a Descriptor.FormException from the UsernamePasswordCredentialsImpl constructor. Added in: * https://github.com/jenkinsci/credentials-plugin/pull/558 --- .../git/CredentialsUserRemoteConfigTest.java | 5 ++-- .../plugins/git/FIPSModeUrlCheckTest.java | 2 +- .../java/hudson/plugins/git/GitSCMTest.java | 28 +++++++++++++++---- .../java/hudson/plugins/git/GitStepTest.java | 2 +- .../plugins/git/UserRemoteConfigTest.java | 2 +- .../plugins/git/AbstractGitSCMSourceTest.java | 2 +- .../plugins/git/GitToolChooserTest.java | 5 ++-- .../git/GitUsernamePasswordBindingTest.java | 11 ++++---- 8 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/test/java/hudson/plugins/git/CredentialsUserRemoteConfigTest.java b/src/test/java/hudson/plugins/git/CredentialsUserRemoteConfigTest.java index 7efa4bb3ae..53ac88f61c 100644 --- a/src/test/java/hudson/plugins/git/CredentialsUserRemoteConfigTest.java +++ b/src/test/java/hudson/plugins/git/CredentialsUserRemoteConfigTest.java @@ -4,6 +4,7 @@ import com.cloudbees.plugins.credentials.common.StandardCredentials; import com.cloudbees.plugins.credentials.domains.Domain; import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl; +import hudson.model.Descriptor.FormException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -347,7 +348,7 @@ public void checkoutWithNoCredentialsSpecified() throws Exception { r.waitForMessage("No credentials specified", b); } - private StandardCredentials createCredential(CredentialsScope scope, String id) { - return new UsernamePasswordCredentialsImpl(scope, id, "desc: " + id, "username", "password"); + private StandardCredentials createCredential(CredentialsScope scope, String id) throws FormException { + return new UsernamePasswordCredentialsImpl(scope, id, "desc: " + id, "username", "password-longer-than-14"); } } diff --git a/src/test/java/hudson/plugins/git/FIPSModeUrlCheckTest.java b/src/test/java/hudson/plugins/git/FIPSModeUrlCheckTest.java index 5d5256c0f2..453cfb4c7b 100644 --- a/src/test/java/hudson/plugins/git/FIPSModeUrlCheckTest.java +++ b/src/test/java/hudson/plugins/git/FIPSModeUrlCheckTest.java @@ -133,7 +133,7 @@ public void testUserRemoteConfigCheck() throws Throwable { SystemCredentialsProvider.getInstance() .getCredentials() .add(new UsernamePasswordCredentialsImpl( - CredentialsScope.GLOBAL, "mycreds", null, "jenkins", "s3cr3t")); + CredentialsScope.GLOBAL, "mycreds", null, "jenkins", "s3cr3t-at-least-14-chars")); SystemCredentialsProvider.getInstance().save(); FreeStyleProject p = r.createProject(FreeStyleProject.class, "mbp"); UserRemoteConfig.DescriptorImpl descriptor = diff --git a/src/test/java/hudson/plugins/git/GitSCMTest.java b/src/test/java/hudson/plugins/git/GitSCMTest.java index 96c6621cd2..10e9881b09 100644 --- a/src/test/java/hudson/plugins/git/GitSCMTest.java +++ b/src/test/java/hudson/plugins/git/GitSCMTest.java @@ -13,7 +13,25 @@ import hudson.FilePath; import hudson.Functions; import hudson.Launcher; -import hudson.model.*; +import hudson.model.AbstractBuild; +import hudson.model.Action; +import hudson.model.Cause; +import hudson.model.Descriptor; +import hudson.model.Descriptor.FormException; +import hudson.model.EnvironmentContributingAction; +import hudson.model.EnvironmentContributor; +import hudson.model.Fingerprint; +import hudson.model.FreeStyleBuild; +import hudson.model.FreeStyleProject; +import hudson.model.ParameterValue; +import hudson.model.ParametersAction; +import hudson.model.ParametersDefinitionProperty; +import hudson.model.Result; +import hudson.model.Run; +import hudson.model.StringParameterDefinition; +import hudson.model.StringParameterValue; +import hudson.model.TaskListener; +import hudson.model.User; import hudson.plugins.git.GitSCM.DescriptorImpl; import hudson.plugins.git.browser.GithubWeb; import hudson.plugins.git.extensions.GitSCMExtension; @@ -158,9 +176,9 @@ public void waitForJenkinsIdle() throws Exception { } } - private StandardCredentials getInvalidCredential() { + private StandardCredentials getInvalidCredential() throws FormException { String username = "bad-user"; - String password = "bad-password"; + String password = "bad-password-but-long-enough"; CredentialsScope scope = CredentialsScope.GLOBAL; String id = "username-" + username + "-password-" + password; return new UsernamePasswordCredentialsImpl(scope, id, "desc: " + id, username, password); @@ -2945,7 +2963,7 @@ private boolean isWindows() { return java.io.File.pathSeparatorChar==';'; } - private StandardCredentials createCredential(CredentialsScope scope, String id) { - return new UsernamePasswordCredentialsImpl(scope, id, "desc: " + id, "username", "password"); + private StandardCredentials createCredential(CredentialsScope scope, String id) throws FormException { + return new UsernamePasswordCredentialsImpl(scope, id, "desc: " + id, "username", "password-needs-to-be-14"); } } diff --git a/src/test/java/hudson/plugins/git/GitStepTest.java b/src/test/java/hudson/plugins/git/GitStepTest.java index 8eef466b23..72f5ee8b1a 100644 --- a/src/test/java/hudson/plugins/git/GitStepTest.java +++ b/src/test/java/hudson/plugins/git/GitStepTest.java @@ -123,7 +123,7 @@ public void roundtrip() throws Exception { @Test public void roundtrip_withcredentials() throws Exception { assumeTrue("Test class max time " + MAX_SECONDS_FOR_THESE_TESTS + " exceeded", isTimeAvailable()); - IdCredentials c = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, null, null, "user", "pass"); + IdCredentials c = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, null, null, "user", "password-needs-to-be-14"); CredentialsProvider.lookupStores(r.jenkins).iterator().next() .addCredentials(Domain.global(), c); GitStep step = new GitStep("git@github.com:jenkinsci/workflow-plugin.git"); diff --git a/src/test/java/hudson/plugins/git/UserRemoteConfigTest.java b/src/test/java/hudson/plugins/git/UserRemoteConfigTest.java index 604478f6fa..a756690dbc 100644 --- a/src/test/java/hudson/plugins/git/UserRemoteConfigTest.java +++ b/src/test/java/hudson/plugins/git/UserRemoteConfigTest.java @@ -29,7 +29,7 @@ public class UserRemoteConfigTest { @Issue("JENKINS-38048") @Test public void credentialsDropdown() throws Exception { - SystemCredentialsProvider.getInstance().getCredentials().add(new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "mycreds", null, "jenkins", "s3cr3t")); + SystemCredentialsProvider.getInstance().getCredentials().add(new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "mycreds", null, "jenkins", "s3cr3t-that-needs-to-be-long")); SystemCredentialsProvider.getInstance().save(); FreeStyleProject p1 = r.createFreeStyleProject("p1"); FreeStyleProject p2 = r.createFreeStyleProject("p2"); diff --git a/src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java b/src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java index 72c0a6f072..b27cf42403 100644 --- a/src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java +++ b/src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java @@ -340,7 +340,7 @@ public void retrieveTags_folderScopedCredentials() throws Exception { assert folderStore != null; String fCredentialsId = "fcreds"; StandardCredentials fCredentials = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, - fCredentialsId, "fcreds", "user", "password"); + fCredentialsId, "fcreds", "user", "password-longer-than-14"); folderStore.addCredentials(Domain.global(), fCredentials); folderStore.save(); WorkflowJob p = f.createProject(WorkflowJob.class, "wjob"); diff --git a/src/test/java/jenkins/plugins/git/GitToolChooserTest.java b/src/test/java/jenkins/plugins/git/GitToolChooserTest.java index abe38698ad..87c4a096ee 100644 --- a/src/test/java/jenkins/plugins/git/GitToolChooserTest.java +++ b/src/test/java/jenkins/plugins/git/GitToolChooserTest.java @@ -6,6 +6,7 @@ import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl; import hudson.FilePath; import hudson.model.*; +import hudson.model.Descriptor.FormException; import hudson.model.labels.LabelAtom; import hudson.plugins.git.GitTool; import hudson.slaves.DumbSlave; @@ -809,8 +810,8 @@ private void failAProject(GitSampleRepoRule sampleRepo) throws Exception { r.waitForMessage("Couldn't find any revision to build", b); } - private StandardCredentials createCredential(CredentialsScope scope, String id) { - return new UsernamePasswordCredentialsImpl(scope, id, "desc: " + id, "username", "password"); + private StandardCredentials createCredential(CredentialsScope scope, String id) throws FormException { + return new UsernamePasswordCredentialsImpl(scope, id, "desc: " + id, "username", "password-longer-than-14"); } /** inline ${@link hudson.Functions#isWindows()} to prevent a transient remote classloader issue */ diff --git a/src/test/java/jenkins/plugins/git/GitUsernamePasswordBindingTest.java b/src/test/java/jenkins/plugins/git/GitUsernamePasswordBindingTest.java index e9bac8b2d9..e2490e0476 100644 --- a/src/test/java/jenkins/plugins/git/GitUsernamePasswordBindingTest.java +++ b/src/test/java/jenkins/plugins/git/GitUsernamePasswordBindingTest.java @@ -8,6 +8,7 @@ import hudson.EnvVars; import hudson.FilePath; +import hudson.model.Descriptor.FormException; import hudson.model.FreeStyleBuild; import hudson.model.FreeStyleProject; import hudson.model.Item; @@ -113,12 +114,12 @@ private boolean isTimeAvailable() { "randomName", }; private static String[] passwords = { - "&Ampersand&", + "&Ampersand-long-enough&", "He said \"Hello\", then left.", - "default=@#(*^!", + "default=@#(*^!-long-enough", "has_a_trailing_quote=@#(*^!'", - "here's-a-quote", - "special%%_342@**", + "here's-a-quote-long-enough", + "special%%_342@**-long-enough", "%interior-single-quote%_786'@**", }; private static GitTool[] gitTools = { @@ -142,7 +143,7 @@ public GitUsernamePasswordBindingTest(String username, String password, GitTool } @Before - public void basicSetup() throws IOException { + public void basicSetup() throws FormException, IOException { //File init rootDir = tempFolder.getRoot(); rootFilePath = new FilePath(rootDir.getAbsoluteFile());