File tree 1 file changed +6
-0
lines changed
src/main/java/com/cloudbees/jenkins/plugins/awscredentials
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 56
56
import org .kohsuke .stapler .DataBoundConstructor ;
57
57
import org .kohsuke .stapler .DataBoundSetter ;
58
58
import org .kohsuke .stapler .QueryParameter ;
59
+ import org .kohsuke .stapler .verb .POST ;
59
60
60
61
import java .net .HttpURLConnection ;
61
62
import java .util .logging .Level ;
@@ -280,13 +281,18 @@ public String getDisplayName() {
280
281
281
282
public static final Integer DEFAULT_STS_TOKEN_DURATION = STS_CREDENTIALS_DURATION_SECONDS ;
282
283
284
+ @ POST
283
285
public FormValidation doCheckSecretKey (@ QueryParameter ("accessKey" ) final String accessKey ,
284
286
@ QueryParameter ("iamRoleArn" ) final String iamRoleArn ,
285
287
@ QueryParameter ("iamExternalId" ) final String iamExternalId ,
286
288
@ QueryParameter ("iamMfaSerialNumber" ) final String iamMfaSerialNumber ,
287
289
@ QueryParameter ("iamMfaToken" ) final String iamMfaToken ,
288
290
@ QueryParameter ("stsTokenDuration" ) final Integer stsTokenDuration ,
289
291
@ QueryParameter final String secretKey ) {
292
+ if (!Jenkins .get ().hasPermission (Jenkins .ADMINISTER )) {
293
+ // for security reasons, do not perform any check if the user is not an admin
294
+ return FormValidation .ok ();
295
+ }
290
296
if (StringUtils .isBlank (accessKey ) && StringUtils .isBlank (secretKey )) {
291
297
return FormValidation .ok ();
292
298
}
You can’t perform that action at this time.
0 commit comments