Skip to content

Commit

Permalink
Merge 8355ec6 into 0f67efa
Browse files Browse the repository at this point in the history
  • Loading branch information
olamy committed Mar 19, 2020
2 parents 0f67efa + 8355ec6 commit a4645b5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
37 changes: 23 additions & 14 deletions pom.xml
Expand Up @@ -24,17 +24,18 @@
<jira-rest-client.version>5.2.1</jira-rest-client.version>
<fugue.version>3.0.0</fugue.version>
<workflow.version>2.0</workflow.version>
<slf4jVersion>1.7.26</slf4jVersion>

<!-- jenkins -->
<jenkins.version>2.60.3</jenkins.version>
<jenkins.version>2.176.4</jenkins.version>

<!-- security -->
<findbugs.failOnError>false</findbugs.failOnError>

<!-- tests -->
<groovy.version>2.4.5</groovy.version>
<surefire.version>2.20</surefire.version>
<configuration-as-code.version>1.8</configuration-as-code.version>
<configuration-as-code.version>1.36</configuration-as-code.version>
</properties>

<profiles>
Expand Down Expand Up @@ -267,7 +268,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
<version>2.8.11.2</version>
<version>2.10.2</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -319,23 +320,16 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>2.1.19</version>
<version>2.2.1</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>io.jenkins</groupId>
<artifactId>configuration-as-code</artifactId>
<groupId>io.jenkins.configuration-as-code</groupId>
<artifactId>test-harness</artifactId>
<version>${configuration-as-code.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jenkins</groupId>
<artifactId>configuration-as-code</artifactId>
<version>${configuration-as-code.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
Expand Down Expand Up @@ -400,10 +394,25 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.3</version>
<version>1.20</version>
<scope>test</scope>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>2.56</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.12</version>
</dependency>
</dependencies>
</dependencyManagement>

<repositories>
<repository>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/jira/JiraSite.java
Expand Up @@ -1126,7 +1126,7 @@ public FormValidation doValidate(@QueryParameter String url,
@AncestorInPath Item item) {

if (item == null) {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
} else {
item.checkPermission(Item.CONFIGURE);
}
Expand Down
10 changes: 9 additions & 1 deletion src/test/java/hudson/plugins/jira/JiraSiteSecurity1029Test.java
Expand Up @@ -11,6 +11,7 @@
import hudson.model.Item;
import hudson.model.User;
import jenkins.model.Jenkins;
import jenkins.security.ApiTokenProperty;
import net.sf.json.JSONObject;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
Expand Down Expand Up @@ -81,13 +82,20 @@ public void cannotLeakCredentials() throws Exception {
systemProvider.save();

User admin = User.getById(ADMIN, true);
admin.addProperty( new ApiTokenProperty() );
admin.getProperty( ApiTokenProperty.class ).changeApiToken();
User user = User.getById(USER, true);
user.addProperty( new ApiTokenProperty() );
user.getProperty( ApiTokenProperty.class ).changeApiToken();

User userFolderConfigure = User.getById(USER_FOLDER_CONFIGURE, true);
userFolderConfigure.addProperty( new ApiTokenProperty() );
userFolderConfigure.getProperty( ApiTokenProperty.class ).changeApiToken();

{ // as an admin I should be able to validate my url / credentials
JenkinsRule.WebClient wc = j.createWebClient();
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);
wc.withBasicApiToken(admin);
wc = wc.withBasicApiToken(admin);

String jiraSiteValidateUrl = j.getURL() + "descriptorByName/" + JiraSite.class.getName() + "/validate";
WebRequest request = new WebRequest(new URL(jiraSiteValidateUrl), HttpMethod.POST);
Expand Down

0 comments on commit a4645b5

Please sign in to comment.