update resteasy to v3.6.2.Final in order to fix CVE-2017-7561 and CVE-2016-6347

This commit is contained in:
Sebastian Sdorra
2019-01-30 13:21:11 +01:00
parent dfd187a247
commit 69dda6403d
13 changed files with 70 additions and 47 deletions

View File

@@ -825,8 +825,8 @@
<logback.version>1.2.3</logback.version>
<servlet.version>3.0.1</servlet.version>
<jaxrs.version>2.0.1</jaxrs.version>
<resteasy.version>3.1.3.Final</resteasy.version>
<jaxrs.version>2.1.1</jaxrs.version>
<resteasy.version>3.6.2.Final</resteasy.version>
<jersey-client.version>1.19.4</jersey-client.version>
<enunciate.version>2.11.1</enunciate.version>
<jackson.version>2.8.6</jackson.version>

View File

@@ -93,6 +93,7 @@
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
@@ -235,7 +236,6 @@
<links>
<link>http://download.oracle.com/javase/6/docs/api/</link>
<link>http://download.oracle.com/docs/cd/E17802_01/products/products/servlet/2.5/docs/servlet-2_5-mr2/</link>
<link>http://jersey.java.net/nonav/apidocs/${jersey.version}/jersey/</link>
<link>https://google.github.io/guice/api-docs/${guice.version}/javadoc</link>
<link>http://www.slf4j.org/api/</link>
<link>http://shiro.apache.org/static/${shiro.version}/apidocs/</link>

View File

@@ -17,7 +17,7 @@ import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import sonia.scm.repository.GitConfig;
import sonia.scm.repository.GitRepositoryConfig;
import sonia.scm.repository.GitRepositoryHandler;
@@ -29,6 +29,7 @@ import sonia.scm.store.ConfigurationStoreFactory;
import sonia.scm.web.GitVndMediaType;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -100,7 +101,7 @@ public class GitConfigResourceTest {
@Test
@SubjectAware(username = "readWrite")
public void shouldGetGitConfig() throws URISyntaxException {
public void shouldGetGitConfig() throws URISyntaxException, UnsupportedEncodingException {
MockHttpResponse response = get();
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
@@ -115,7 +116,7 @@ public class GitConfigResourceTest {
@Test
@SubjectAware(username = "readWrite")
public void shouldGetGitConfigEvenWhenItsEmpty() throws URISyntaxException {
public void shouldGetGitConfigEvenWhenItsEmpty() throws URISyntaxException, UnsupportedEncodingException {
when(repositoryHandler.getConfig()).thenReturn(null);
MockHttpResponse response = get();
@@ -126,7 +127,7 @@ public class GitConfigResourceTest {
@Test
@SubjectAware(username = "readOnly")
public void shouldGetGitConfigWithoutUpdateLink() throws URISyntaxException {
public void shouldGetGitConfigWithoutUpdateLink() throws URISyntaxException, UnsupportedEncodingException {
MockHttpResponse response = get();
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
@@ -159,7 +160,7 @@ public class GitConfigResourceTest {
@Test
@SubjectAware(username = "writeOnly")
public void shouldReadDefaultRepositoryConfig() throws URISyntaxException {
public void shouldReadDefaultRepositoryConfig() throws URISyntaxException, UnsupportedEncodingException {
when(repositoryManager.get(new NamespaceAndName("space", "X"))).thenReturn(new Repository("id", "git", "space", "X"));
MockHttpRequest request = MockHttpRequest.get("/" + GitConfigResource.GIT_CONFIG_PATH_V2 + "/space/X");
@@ -176,7 +177,7 @@ public class GitConfigResourceTest {
@Test
@SubjectAware(username = "readOnly")
public void shouldNotHaveUpdateLinkForReadOnlyUser() throws URISyntaxException {
public void shouldNotHaveUpdateLinkForReadOnlyUser() throws URISyntaxException, UnsupportedEncodingException {
when(repositoryManager.get(new NamespaceAndName("space", "X"))).thenReturn(new Repository("id", "git", "space", "X"));
MockHttpRequest request = MockHttpRequest.get("/" + GitConfigResource.GIT_CONFIG_PATH_V2 + "/space/X");
@@ -193,7 +194,7 @@ public class GitConfigResourceTest {
@Test
@SubjectAware(username = "writeOnly")
public void shouldReadStoredRepositoryConfig() throws URISyntaxException {
public void shouldReadStoredRepositoryConfig() throws URISyntaxException, UnsupportedEncodingException {
when(repositoryManager.get(new NamespaceAndName("space", "X"))).thenReturn(new Repository("id", "git", "space", "X"));
GitRepositoryConfig gitRepositoryConfig = new GitRepositoryConfig();
gitRepositoryConfig.setDefaultBranch("test");

View File

@@ -25,6 +25,7 @@ import javax.inject.Provider;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -99,7 +100,7 @@ public class HgConfigResourceTest {
@Test
@SubjectAware(username = "readWrite")
public void shouldGetHgConfigEvenWhenItsEmpty() throws URISyntaxException {
public void shouldGetHgConfigEvenWhenItsEmpty() throws URISyntaxException, UnsupportedEncodingException {
when(repositoryHandler.getConfig()).thenReturn(null);
MockHttpResponse response = get();
@@ -110,7 +111,7 @@ public class HgConfigResourceTest {
@Test
@SubjectAware(username = "readOnly")
public void shouldGetHgConfigWithoutUpdateLink() throws URISyntaxException {
public void shouldGetHgConfigWithoutUpdateLink() throws URISyntaxException, UnsupportedEncodingException {
MockHttpResponse response = get();
assertEquals(HttpServletResponse.SC_OK, response.getStatus());

View File

@@ -16,14 +16,14 @@ import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import sonia.scm.repository.SvnConfig;
import sonia.scm.repository.SvnRepositoryHandler;
import sonia.scm.web.SvnVndMediaType;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -98,7 +98,7 @@ public class SvnConfigResourceTest {
@Test
@SubjectAware(username = "readOnly")
public void shouldGetSvnConfigWithoutUpdateLink() throws URISyntaxException {
public void shouldGetSvnConfigWithoutUpdateLink() throws URISyntaxException, UnsupportedEncodingException {
MockHttpResponse response = get();
assertEquals(HttpServletResponse.SC_OK, response.getStatus());

View File

@@ -114,12 +114,6 @@
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<!-- rest api -->
<dependency>
@@ -158,6 +152,13 @@
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.1-b06</version>
<scope>provided</scope>
</dependency>
<!-- injection -->
<dependency>
@@ -561,7 +562,6 @@
<selenium.version>2.53.1</selenium.version>
<wagon.version>1.0</wagon.version>
<mustache.version>0.8.17</mustache.version>
<resteasy.version>3.1.4.Final</resteasy.version>
<jackson.version>2.8.9</jackson.version>
<netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
<sonar.issue.ignore.multicriteria>e1</sonar.issue.ignore.multicriteria>

View File

@@ -18,6 +18,7 @@ import sonia.scm.web.VndMediaType;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -68,7 +69,7 @@ public class ConfigResourceTest {
@Test
@SubjectAware(username = "readOnly")
public void shouldGetGlobalConfig() throws URISyntaxException {
public void shouldGetGlobalConfig() throws URISyntaxException, UnsupportedEncodingException {
MockHttpRequest request = MockHttpRequest.get("/" + ConfigResource.CONFIG_PATH_V2);
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);

View File

@@ -24,6 +24,7 @@ import sonia.scm.web.VndMediaType;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -100,7 +101,7 @@ public class GroupRootResourceTest {
}
@Test
public void shouldGetGroup() throws URISyntaxException {
public void shouldGetGroup() throws URISyntaxException, UnsupportedEncodingException {
Group group = createDummyGroup();
when(groupManager.get("admin")).thenReturn(group);
@@ -305,7 +306,7 @@ public class GroupRootResourceTest {
}
@Test
public void shouldGetAll() throws URISyntaxException {
public void shouldGetAll() throws URISyntaxException, UnsupportedEncodingException {
MockHttpRequest request = MockHttpRequest.get("/" + GroupRootResource.GROUPS_PATH_V2);
MockHttpResponse response = new MockHttpResponse();
@@ -317,7 +318,7 @@ public class GroupRootResourceTest {
}
@Test
public void shouldGetPermissionLink() throws URISyntaxException {
public void shouldGetPermissionLink() throws URISyntaxException, UnsupportedEncodingException {
MockHttpRequest request = MockHttpRequest.get("/" + GroupRootResource.GROUPS_PATH_V2 + "admin");
MockHttpResponse response = new MockHttpResponse();
@@ -329,7 +330,7 @@ public class GroupRootResourceTest {
}
@Test
public void shouldGetPermissions() throws URISyntaxException {
public void shouldGetPermissions() throws URISyntaxException, UnsupportedEncodingException {
when(permissionAssigner.readPermissionsForGroup("admin")).thenReturn(singletonList(new PermissionDescriptor("something:*")));
MockHttpRequest request = MockHttpRequest.get("/" + GroupRootResource.GROUPS_PATH_V2 + "admin/permissions");
MockHttpResponse response = new MockHttpResponse();

View File

@@ -22,6 +22,7 @@ import sonia.scm.user.UserManager;
import sonia.scm.web.VndMediaType;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -78,7 +79,7 @@ public class MeResourceTest {
}
@Test
public void shouldReturnCurrentlyAuthenticatedUser() throws URISyntaxException {
public void shouldReturnCurrentlyAuthenticatedUser() throws URISyntaxException, UnsupportedEncodingException {
applyUserToSubject(originalUser);
MockHttpRequest request = MockHttpRequest.get("/" + MeResource.ME_PATH_V2);

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.sdorra.shiro.ShiroRule;
import com.github.sdorra.shiro.SubjectAware;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.inject.util.Providers;
import de.otto.edison.hal.HalRepresentation;
@@ -36,6 +37,7 @@ import sonia.scm.repository.RepositoryPermission;
import sonia.scm.web.VndMediaType;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -214,7 +216,12 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
.expectedResponseStatus(200)
.path(PATH_OF_ALL_PERMISSIONS + expectedPermission.getName())
.responseValidator((response) -> {
String body = response.getContentAsString();
String body = null;
try {
body = response.getContentAsString();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
ObjectMapper mapper = new ObjectMapper();
try {
RepositoryPermissionDto actualRepositoryPermissionDto = mapper.readValue(body, RepositoryPermissionDto.class);
@@ -268,13 +275,21 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
assertExpectedRequest(requestPOSTPermission
.content("{\"name\" : \"" + newPermission.getName() + "\" , \"verbs\" : [\"read\",\"pull\",\"push\"], \"groupPermission\" : true}")
.expectedResponseStatus(201)
.responseValidator(response -> assertThat(response.getContentAsString())
.responseValidator(response -> assertThat(getContentAsString(response))
.as("POST response has no body")
.isBlank())
);
assertGettingExpectedPermissions(expectedPermissions, PERMISSION_WRITE);
}
private String getContentAsString(MockHttpResponse response) {
try {
return response.getContentAsString();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("could not get content from response", e);
}
}
@Test
public void shouldNotAddExistingPermission() throws URISyntaxException {
createUserWithRepositoryAndPermissions(TEST_PERMISSIONS, PERMISSION_WRITE);
@@ -296,7 +311,7 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
.content("{\"name\" : \"" + modifiedPermission.getName() + "\" , \"verbs\" : [\"*\"], \"groupPermission\" : false}")
.path(PATH_OF_ALL_PERMISSIONS + modifiedPermission.getName())
.expectedResponseStatus(204)
.responseValidator(response -> assertThat(response.getContentAsString())
.responseValidator(response -> assertThat(getContentAsString(response))
.as("PUT response has no body")
.isBlank())
);
@@ -312,7 +327,7 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
assertExpectedRequest(requestDELETEPermission
.path(PATH_OF_ALL_PERMISSIONS + deletedPermission.getName())
.expectedResponseStatus(204)
.responseValidator(response -> assertThat(response.getContentAsString())
.responseValidator(response -> assertThat(getContentAsString(response))
.as("DELETE response has no body")
.isBlank())
);
@@ -327,7 +342,7 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
assertExpectedRequest(requestDELETEPermission
.path(PATH_OF_ALL_PERMISSIONS + deletedPermission.getName())
.expectedResponseStatus(204)
.responseValidator(response -> assertThat(response.getContentAsString())
.responseValidator(response -> assertThat(getContentAsString(response))
.as("DELETE response has no body")
.isBlank())
);
@@ -335,7 +350,7 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
assertExpectedRequest(requestDELETEPermission
.path(PATH_OF_ALL_PERMISSIONS + deletedPermission.getName())
.expectedResponseStatus(204)
.responseValidator(response -> assertThat(response.getContentAsString())
.responseValidator(response -> assertThat(getContentAsString(response))
.as("DELETE response has no body")
.isBlank())
);
@@ -346,7 +361,7 @@ public class RepositoryPermissionRootResourceTest extends RepositoryTestBase {
assertExpectedRequest(requestGETAllPermissions
.expectedResponseStatus(200)
.responseValidator((response) -> {
String body = response.getContentAsString();
String body = getContentAsString(response);
ObjectMapper mapper = new ObjectMapper();
try {
HalRepresentation halRepresentation = mapper.readValue(body, HalRepresentation.class);

View File

@@ -27,6 +27,7 @@ import sonia.scm.web.VndMediaType;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -120,7 +121,7 @@ public class RepositoryRootResourceTest extends RepositoryTestBase {
}
@Test
public void shouldFindExistingRepository() throws URISyntaxException {
public void shouldFindExistingRepository() throws URISyntaxException, UnsupportedEncodingException {
mockRepository("space", "repo");
MockHttpRequest request = MockHttpRequest.get("/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + "space/repo");
@@ -133,7 +134,7 @@ public class RepositoryRootResourceTest extends RepositoryTestBase {
}
@Test
public void shouldMapProperties() throws URISyntaxException {
public void shouldMapProperties() throws URISyntaxException, UnsupportedEncodingException {
Repository repository = mockRepository("space", "repo");
repository.setProperty("testKey", "testValue");
@@ -146,7 +147,7 @@ public class RepositoryRootResourceTest extends RepositoryTestBase {
}
@Test
public void shouldGetAll() throws URISyntaxException {
public void shouldGetAll() throws URISyntaxException, UnsupportedEncodingException {
PageResult<Repository> singletonPageResult = createSingletonPageResult(mockRepository("space", "repo"));
when(repositoryManager.getPage(any(), eq(0), eq(10))).thenReturn(singletonPageResult);

View File

@@ -16,6 +16,7 @@ import sonia.scm.plugin.*;
import sonia.scm.web.VndMediaType;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashSet;
@@ -87,7 +88,7 @@ public class UIRootResourceTest {
}
@Test
public void shouldReturnPlugin() throws URISyntaxException {
public void shouldReturnPlugin() throws URISyntaxException, UnsupportedEncodingException {
mockPlugins(mockPlugin("awesome", "Awesome", createPluginResources("my/awesome.bundle.js")));
MockHttpRequest request = MockHttpRequest.get("/v2/ui/plugins/awesome");
@@ -101,7 +102,7 @@ public class UIRootResourceTest {
}
@Test
public void shouldReturnPlugins() throws URISyntaxException {
public void shouldReturnPlugins() throws URISyntaxException, UnsupportedEncodingException {
mockPlugins(
mockPlugin("awesome", "Awesome", createPluginResources("my/awesome.bundle.js")),
mockPlugin("special", "Special", createPluginResources("my/special.bundle.js"))
@@ -120,7 +121,7 @@ public class UIRootResourceTest {
}
@Test
public void shouldNotReturnPluginsWithoutResources() throws URISyntaxException {
public void shouldNotReturnPluginsWithoutResources() throws URISyntaxException, UnsupportedEncodingException {
mockPlugins(
mockPlugin("awesome", "Awesome", createPluginResources("my/awesome.bundle.js")),
mockPlugin("special")

View File

@@ -26,6 +26,7 @@ import sonia.scm.user.UserManager;
import sonia.scm.web.VndMediaType;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -97,7 +98,7 @@ public class UserRootResourceTest {
}
@Test
public void shouldCreateFullResponseForAdmin() throws URISyntaxException {
public void shouldCreateFullResponseForAdmin() throws URISyntaxException, UnsupportedEncodingException {
MockHttpRequest request = MockHttpRequest.get("/" + UserRootResource.USERS_PATH_V2 + "Neo");
MockHttpResponse response = new MockHttpResponse();
@@ -137,7 +138,7 @@ public class UserRootResourceTest {
@Test
@SubjectAware(username = "unpriv")
public void shouldCreateLimitedResponseForSimpleUser() throws URISyntaxException {
public void shouldCreateLimitedResponseForSimpleUser() throws URISyntaxException, UnsupportedEncodingException {
MockHttpRequest request = MockHttpRequest.get("/" + UserRootResource.USERS_PATH_V2 + "Neo");
MockHttpResponse response = new MockHttpResponse();
@@ -331,7 +332,7 @@ public class UserRootResourceTest {
}
@Test
public void shouldCreatePageForOnePageOnly() throws URISyntaxException {
public void shouldCreatePageForOnePageOnly() throws URISyntaxException, UnsupportedEncodingException {
PageResult<User> singletonPageResult = createSingletonPageResult(1);
when(userManager.getPage(any(), eq(0), eq(10))).thenReturn(singletonPageResult);
MockHttpRequest request = MockHttpRequest.get("/" + UserRootResource.USERS_PATH_V2);
@@ -347,7 +348,7 @@ public class UserRootResourceTest {
}
@Test
public void shouldCreatePageForMultiplePages() throws URISyntaxException {
public void shouldCreatePageForMultiplePages() throws URISyntaxException, UnsupportedEncodingException {
PageResult<User> singletonPageResult = createSingletonPageResult(3);
when(userManager.getPage(any(), eq(1), eq(1))).thenReturn(singletonPageResult);
MockHttpRequest request = MockHttpRequest.get("/" + UserRootResource.USERS_PATH_V2 + "?page=1&pageSize=1");
@@ -365,7 +366,7 @@ public class UserRootResourceTest {
}
@Test
public void shouldGetPermissionLink() throws URISyntaxException {
public void shouldGetPermissionLink() throws URISyntaxException, UnsupportedEncodingException {
MockHttpRequest request = MockHttpRequest.get("/" + UserRootResource.USERS_PATH_V2 + "Neo");
MockHttpResponse response = new MockHttpResponse();
@@ -377,7 +378,7 @@ public class UserRootResourceTest {
}
@Test
public void shouldGetPermissions() throws URISyntaxException {
public void shouldGetPermissions() throws URISyntaxException, UnsupportedEncodingException {
when(permissionAssigner.readPermissionsForUser("Neo")).thenReturn(singletonList(new PermissionDescriptor("something:*")));
MockHttpRequest request = MockHttpRequest.get("/" + UserRootResource.USERS_PATH_V2 + "Neo/permissions");
MockHttpResponse response = new MockHttpResponse();