Skip to content

Commit 7da4482

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 abb3399 commit 7da4482

File tree

8 files changed

+767
-8
lines changed

8 files changed

+767
-8
lines changed

pom.xml

Lines changed: 18 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.40</dep.drift.version>
@@ -218,6 +218,23 @@
218218

219219
<dependencyManagement>
220220
<dependencies>
221+
222+
<dependency>
223+
<groupId>com.squareup.okio</groupId>
224+
<artifactId>okio-jvm</artifactId>
225+
<version>3.6.0</version>
226+
<exclusions>
227+
<exclusion>
228+
<groupId>org.jetbrains.kotlin</groupId>
229+
<artifactId>kotlin-stdlib-jdk8</artifactId>
230+
</exclusion>
231+
<exclusion>
232+
<groupId>org.jetbrains.kotlin</groupId>
233+
<artifactId>kotlin-stdlib-common</artifactId>
234+
</exclusion>
235+
</exclusions>
236+
</dependency>
237+
221238
<dependency>
222239
<groupId>org.eclipse.jetty</groupId>
223240
<artifactId>jetty-bom</artifactId>

presto-client/pom.xml

Lines changed: 19 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>
@@ -117,4 +121,19 @@
117121
<scope>test</scope>
118122
</dependency>
119123
</dependencies>
124+
125+
<build>
126+
<plugins>
127+
<plugin>
128+
<groupId>org.apache.maven.plugins</groupId>
129+
<artifactId>maven-dependency-plugin</artifactId>
130+
<configuration>
131+
<ignoredUnusedDeclaredDependencies>
132+
<!-- This is needed to keep Okio in the build and prevent conflicts with OkHttp and Kotlin dependencies. -->
133+
<ignoredUnusedDeclaredDependency>com.squareup.okio:okio-jvm</ignoredUnusedDeclaredDependency>
134+
</ignoredUnusedDeclaredDependencies>
135+
</configuration>
136+
</plugin>
137+
</plugins>
138+
</build>
120139
</project>

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)