Skip to content

Commit

Permalink
[SECURITY-2351]
Browse files Browse the repository at this point in the history
  • Loading branch information
amuniz committed Mar 7, 2022
1 parent d1d7756 commit cbf183c
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.verb.POST;

import java.net.HttpURLConnection;
import java.util.logging.Level;
Expand Down Expand Up @@ -280,13 +281,18 @@ public String getDisplayName() {

public static final Integer DEFAULT_STS_TOKEN_DURATION = STS_CREDENTIALS_DURATION_SECONDS;

@POST
public FormValidation doCheckSecretKey(@QueryParameter("accessKey") final String accessKey,
@QueryParameter("iamRoleArn") final String iamRoleArn,
@QueryParameter("iamExternalId") final String iamExternalId,
@QueryParameter("iamMfaSerialNumber") final String iamMfaSerialNumber,
@QueryParameter("iamMfaToken") final String iamMfaToken,
@QueryParameter("stsTokenDuration") final Integer stsTokenDuration,
@QueryParameter final String secretKey) {
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
// for security reasons, do not perform any check if the user is not an admin
return FormValidation.ok();
}
if (StringUtils.isBlank(accessKey) && StringUtils.isBlank(secretKey)) {
return FormValidation.ok();
}
Expand Down

0 comments on commit cbf183c

Please sign in to comment.