Skip to content

Commit

Permalink
SECURITY-2619: Added Missing permission checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavjain2 committed May 16, 2022
1 parent 24b4996 commit a79f95c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/compuware/jenkins/build/JclDescriptorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ public FormValidation doCheckMaxConditionCode(@QueryParameter String maxConditio
*/
public ListBoxModel doFillConnectionIdItems(@AncestorInPath Jenkins context, @QueryParameter String connectionId,
@AncestorInPath Item project) {
if (project == null) {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
} else {
project.checkPermission(Item.CONFIGURE);
}

CpwrGlobalConfiguration globalConfig = CpwrGlobalConfiguration.get();
HostConnection[] hostConnections = globalConfig.getHostConnections();

Expand Down Expand Up @@ -184,6 +190,12 @@ public ListBoxModel doFillConnectionIdItems(@AncestorInPath Jenkins context, @Qu
*/
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId,
@AncestorInPath Item project) {
if (project == null) {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
} else {
project.checkPermission(Item.CONFIGURE);
}

List<StandardCredentials> creds = CredentialsProvider.lookupCredentials(StandardCredentials.class,
project, ACL.SYSTEM, Collections.<DomainRequirement>emptyList());

Expand Down

0 comments on commit a79f95c

Please sign in to comment.