Skip to content

Commit

Permalink
FIX : SECURITY-3122
Browse files Browse the repository at this point in the history
  • Loading branch information
sokratis.sidereas authored and sokratis.sidereas committed Aug 12, 2023
1 parent 605d8b7 commit 7dc2906
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.interceptor.RequirePOST;

import com.google.common.base.Strings;
import com.jenkins.testresultsaggregator.data.Aggregated;
Expand Down Expand Up @@ -49,6 +50,7 @@
import hudson.util.FormValidation;
import hudson.util.Secret;
import hudson.util.VariableResolver;
import jenkins.model.Jenkins;
import jenkins.tasks.SimpleBuildStep;
import net.sf.json.JSONObject;

Expand Down Expand Up @@ -385,7 +387,10 @@ public FormValidation doCheckOutOfDateResults(@QueryParameter final String outOf
}
}

@RequirePOST
public FormValidation doTestApiConnection(@QueryParameter final String jenkinsUrl, @QueryParameter final String username, @QueryParameter final Secret password) {
// https://www.jenkins.io/doc/developer/security/form-validation/
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
try {
new Collector(null, username, password, jenkinsUrl).getAPIConnection();
return FormValidation.ok(LocalMessages.SUCCESS.toString());
Expand Down

0 comments on commit 7dc2906

Please sign in to comment.