Skip to content

Commit

Permalink
KREST-1030 Upgrade Jetty to fix a number of CVEs.
Browse files Browse the repository at this point in the history
This brings the #249
and the #151 changes
to the older branches.

In addition to that, it also makes the smallest possible changes in
order to fix failures in SslTest.java after the upgrade. This doesn't
cleanly map to an existing change in the higher version branches,
because the problem was addressed before a Jetty upgrade started
causing SslTest.java to fail, but the closest equivalent is probably
the combination of #147
and #155.
  • Loading branch information
dimitarndimitrov committed May 18, 2021
1 parent 317025d commit 8ab657a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/io/confluent/rest/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ protected void configureSecurityHandler(ServletContextHandler context) {
}

private SslContextFactory createSslContextFactory() {
SslContextFactory sslContextFactory = new SslContextFactory();
SslContextFactory sslContextFactory = new SslContextFactory.Server();
if (!config.getString(RestConfig.SSL_KEYSTORE_LOCATION_CONFIG).isEmpty()) {
sslContextFactory.setKeyStorePath(
config.getString(RestConfig.SSL_KEYSTORE_LOCATION_CONFIG)
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/java/io/confluent/rest/CustomInitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void onError(Throwable t) {

WebSocket ws = Dsl.asyncHttpClient()
.prepareGet(WS_URI + "/test")
.setRequestTimeout(5000)
.setRequestTimeout(10000)
.execute(wsHandler)
.get();

Expand Down
6 changes: 3 additions & 3 deletions core/src/test/java/io/confluent/rest/SaslTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ public void testNoAuthAttemptOnWs() throws Exception {
@Test
public void testBadLoginAttempt() throws Exception {
try (CloseableHttpResponse response =
makeGetRequest("/test", "this shouldnt work")) {
makeGetRequest("/test", "dGVzdA==")) {
assertEquals(UNAUTHORIZED.getStatusCode(), response.getStatusLine().getStatusCode());
}
}

@Test
public void testBadLoginAttemptOnWs() throws Exception {
int statusCode = makeWsGetRequest("this shouldnt work");
int statusCode = makeWsGetRequest("dGVzdA==");
assertEquals(UNAUTHORIZED.getStatusCode(), statusCode);
}

Expand Down Expand Up @@ -272,7 +272,7 @@ public void onError(Throwable t) {
}

WebSocket ws = requestBuilder
.setRequestTimeout(5000)
.setRequestTimeout(10000)
.execute(wsHandler)
.get();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.confluent.rest.metrics;

import javax.servlet.ServletException;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.servlet.ServletContextHandler;
Expand Down Expand Up @@ -107,7 +108,7 @@ public void handle(
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response
) throws IOException {
) throws IOException, ServletException {
handledException = (Throwable) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
super.handle(target, baseRequest, request, response);
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<apache.httpclient.version>4.5.13</apache.httpclient.version>
<confluent.maven.repo>http://packages.confluent.io/maven/</confluent.maven.repo>
<jersey.version>2.27</jersey.version>
<jetty.version>9.4.14.v20181114</jetty.version>
<jetty.version>9.4.40.v20210413</jetty.version>
<asynchttpclient.version>2.2.0</asynchttpclient.version>
<guava.version>30.1.1-jre</guava.version>
</properties>
Expand Down

0 comments on commit 8ab657a

Please sign in to comment.