Skip to content

Commit 2e85e45

Browse files
committed
[SECURITY-2201]
1 parent a146c28 commit 2e85e45

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/java/hudson/plugins/s3/S3BucketPublisher.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import hudson.model.AbstractProject;
1616
import hudson.model.Action;
1717
import hudson.model.Fingerprint;
18+
import hudson.model.Item;
1819
import hudson.model.Result;
1920
import hudson.model.Run;
2021
import hudson.model.TaskListener;
@@ -34,10 +35,10 @@
3435
import net.sf.json.JSONObject;
3536
import org.apache.commons.lang.StringUtils;
3637
import org.jenkinsci.Symbol;
38+
import org.kohsuke.stapler.AncestorInPath;
3739
import org.kohsuke.stapler.DataBoundConstructor;
3840
import org.kohsuke.stapler.QueryParameter;
3941
import org.kohsuke.stapler.StaplerRequest;
40-
import org.kohsuke.stapler.StaplerResponse;
4142
import org.kohsuke.stapler.interceptor.RequirePOST;
4243

4344
import javax.annotation.Nonnull;
@@ -466,8 +467,16 @@ public boolean configure(StaplerRequest req, JSONObject json) {
466467
}
467468

468469
@SuppressWarnings("unused")
469-
public ListBoxModel doFillProfileNameItems() {
470+
public ListBoxModel doFillProfileNameItems(@AncestorInPath Item item) {
470471
final ListBoxModel model = new ListBoxModel();
472+
if (item != null && !item.hasPermission(Item.CONFIGURE)) {
473+
return model;
474+
}
475+
if (item == null && !Jenkins.get().hasPermission(Item.CREATE)) {
476+
// accessing from $JENKINS_URL/pipeline-syntax
477+
return model;
478+
}
479+
471480
for (S3Profile profile : profiles) {
472481
model.add(profile.getName(), profile.getName());
473482
}

0 commit comments

Comments
 (0)