Skip to content

Commit ff135ba

Browse files
MariamalmesferMariam Almesfer
authored and
Mariam Almesfer
committed
Upgrade Okie to version 3.6.0 (from 1.17.2) and OkHttp jar to version 4.12.0 to address CVE-2023-3635.
1 parent e2bb5c2 commit ff135ba

File tree

9 files changed

+764
-8
lines changed

9 files changed

+764
-8
lines changed

pom.xml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<dep.slice.version>0.38</dep.slice.version>
5050
<dep.testing-mysql-server-5.version>0.6</dep.testing-mysql-server-5.version>
5151
<dep.aws-sdk.version>1.12.560</dep.aws-sdk.version>
52-
<dep.okhttp.version>3.9.0</dep.okhttp.version>
52+
<dep.okhttp.version>4.12.0</dep.okhttp.version>
5353
<dep.jdbi3.version>3.4.0</dep.jdbi3.version>
5454
<dep.oracle.version>19.3.0.0</dep.oracle.version>
5555
<dep.drift.version>1.38</dep.drift.version>
@@ -210,6 +210,23 @@
210210

211211
<dependencyManagement>
212212
<dependencies>
213+
214+
<dependency>
215+
<groupId>com.squareup.okio</groupId>
216+
<artifactId>okio-jvm</artifactId>
217+
<version>3.6.0</version>
218+
<exclusions>
219+
<exclusion>
220+
<groupId>org.jetbrains.kotlin</groupId>
221+
<artifactId>kotlin-stdlib-jdk8</artifactId>
222+
</exclusion>
223+
<exclusion>
224+
<groupId>org.jetbrains.kotlin</groupId>
225+
<artifactId>kotlin-stdlib-common</artifactId>
226+
</exclusion>
227+
</exclusions>
228+
</dependency>
229+
213230
<dependency>
214231
<groupId>org.eclipse.jetty</groupId>
215232
<artifactId>jetty-bom</artifactId>
@@ -2339,6 +2356,7 @@
23392356
<exclude>com.fasterxml.jackson.core:jackson-annotations</exclude>
23402357
<exclude>com.fasterxml.jackson.core:jackson-core</exclude>
23412358
<exclude>com.fasterxml.jackson.core:jackson-databind</exclude>
2359+
<!-- <exclude>org.jetbrains.kotlin:kotlin-stdlib-jdk8</exclude>-->
23422360
</excludes>
23432361
</requireUpperBoundDeps>
23442362
</rules>

presto-client/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
</properties>
1717

1818
<dependencies>
19+
<dependency>
20+
<groupId>com.squareup.okio</groupId>
21+
<artifactId>okio-jvm</artifactId>
22+
</dependency>
1923
<dependency>
2024
<groupId>com.facebook.presto</groupId>
2125
<artifactId>presto-spi</artifactId>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
package com.facebook.presto.client;
15+
import okio.ByteString;
16+
/**
17+
* This Dummy class ensures Okio is included in the build to address dependency conflicts between OkHttp and Okio regarding Kotlin libraries.
18+
* It prevents the Maven enforcer plugin from incorrectly flagging Okio as unused, maintaining necessary dependencies without runtime issues.
19+
*/
20+
public class Dummy
21+
{
22+
static {
23+
okio.ByteString byteString = new ByteString(new byte[] {});
24+
System.out.println(byteString);
25+
}
26+
}

presto-client/src/main/java/com/facebook/presto/client/JsonResponse.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import javax.annotation.Nullable;
2525

2626
import java.io.IOException;
27-
import java.io.InterruptedIOException;
2827
import java.io.UncheckedIOException;
2928

3029
import static com.google.common.base.MoreObjects.toStringHelper;
@@ -146,11 +145,6 @@ public static <T> JsonResponse<T> execute(JsonCodec<T> codec, OkHttpClient clien
146145
return new JsonResponse<>(response.code(), response.message(), response.headers(), body);
147146
}
148147
catch (IOException e) {
149-
// OkHttp throws this after clearing the interrupt status
150-
// TODO: remove after updating to Okio 1.15.0+
151-
if ((e instanceof InterruptedIOException) && "thread interrupted".equals(e.getMessage())) {
152-
Thread.currentThread().interrupt();
153-
}
154148
throw new UncheckedIOException(e);
155149
}
156150
}

presto-client/src/main/java/com/facebook/presto/client/OkHttpUtil.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.facebook.airlift.security.pem.PemReader;
1717
import com.google.common.base.CharMatcher;
1818
import com.google.common.net.HostAndPort;
19+
import okhttp.internal.tls.LegacyHostnameVerifier;
1920
import okhttp3.Call;
2021
import okhttp3.Callback;
2122
import okhttp3.Credentials;
@@ -237,6 +238,7 @@ public static void setupSsl(
237238
sslContext.init(keyManagers, new TrustManager[] {trustManager}, null);
238239

239240
clientBuilder.sslSocketFactory(sslContext.getSocketFactory(), trustManager);
241+
clientBuilder.hostnameVerifier(LegacyHostnameVerifier.INSTANCE);
240242
}
241243
catch (GeneralSecurityException | IOException e) {
242244
throw new ClientException("Error setting up SSL: " + e.getMessage(), e);

0 commit comments

Comments
 (0)