Skip to content

Commit d6c5af6

Browse files
denodo-research-labsjaystarshot
authored andcommitted
Upgrade libthrift to 0.14.1 due CVE-2020-13949
1 parent 4a0bbc9 commit d6c5af6

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

pom.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@
14681468
<dependency>
14691469
<groupId>org.apache.thrift</groupId>
14701470
<artifactId>libthrift</artifactId>
1471-
<version>0.9.3-1</version>
1471+
<version>0.14.1</version>
14721472
<exclusions>
14731473
<exclusion>
14741474
<groupId>org.apache.httpcomponents</groupId>
@@ -1478,6 +1478,10 @@
14781478
<groupId>org.apache.httpcomponents</groupId>
14791479
<artifactId>httpclient</artifactId>
14801480
</exclusion>
1481+
<exclusion>
1482+
<groupId>org.apache.tomcat.embed</groupId>
1483+
<artifactId>tomcat-embed-core</artifactId>
1484+
</exclusion>
14811485
</exclusions>
14821486
</dependency>
14831487

presto-accumulo/pom.xml

+11
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
<dep.reload4j.version>1.2.18.3</dep.reload4j.version>
2020
</properties>
2121

22+
<dependencyManagement>
23+
<dependencies>
24+
<dependency>
25+
<groupId>org.apache.thrift</groupId>
26+
<artifactId>libthrift</artifactId>
27+
<!-- libthrift >= 0.14.1 not compatible with accumulo-minicluster 1.x -->
28+
<version>0.9.3-1</version>
29+
</dependency>
30+
</dependencies>
31+
</dependencyManagement>
32+
2233
<dependencies>
2334
<dependency>
2435
<groupId>org.apache.accumulo</groupId>

presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/thrift/Transport.java

+22
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import com.facebook.presto.hive.authentication.HiveMetastoreAuthentication;
1717
import com.google.common.net.HostAndPort;
18+
import org.apache.thrift.TConfiguration;
1819
import org.apache.thrift.transport.TSocket;
1920
import org.apache.thrift.transport.TTransport;
2021
import org.apache.thrift.transport.TTransportException;
@@ -217,5 +218,26 @@ public void flush()
217218
throw rewriteException(e, address);
218219
}
219220
}
221+
222+
// Methods added in libthrift 0.14.0 and not present in Hive Metastore <= 3.1.2
223+
@Override
224+
public TConfiguration getConfiguration()
225+
{
226+
return TConfiguration.DEFAULT;
227+
}
228+
229+
@Override
230+
public void updateKnownMessageSize(long size)
231+
throws TTransportException
232+
{
233+
// noop: method added in libthrift 0.14.0 and not present in Hive Metastore <= 3.1.2
234+
}
235+
236+
@Override
237+
public void checkReadBytesAvailable(long numBytes)
238+
throws TTransportException
239+
{
240+
// noop: method added in libthrift 0.14.0 and not present in Hive Metastore <= 3.1.2
241+
}
220242
}
221243
}

presto-hive/src/main/java/com/facebook/presto/hive/authentication/KerberosHiveMetastoreAuthentication.java

+9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import com.facebook.presto.hive.ForHiveMetastore;
1717
import com.facebook.presto.hive.HiveClientConfig;
18+
import com.facebook.presto.spi.PrestoException;
1819
import com.google.common.collect.ImmutableMap;
1920
import org.apache.hadoop.hive.metastore.security.DelegationTokenIdentifier;
2021
import org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport;
@@ -24,6 +25,7 @@
2425
import org.apache.hadoop.security.token.TokenIdentifier;
2526
import org.apache.thrift.transport.TSaslClientTransport;
2627
import org.apache.thrift.transport.TTransport;
28+
import org.apache.thrift.transport.TTransportException;
2729

2830
import javax.inject.Inject;
2931
import javax.security.auth.callback.Callback;
@@ -40,6 +42,7 @@
4042
import java.util.Map;
4143
import java.util.Optional;
4244

45+
import static com.facebook.presto.hive.HiveErrorCode.HIVE_METASTORE_ERROR;
4346
import static com.google.common.base.Preconditions.checkState;
4447
import static java.util.Objects.requireNonNull;
4548
import static javax.security.sasl.Sasl.QOP;
@@ -98,6 +101,9 @@ private TTransport authenticateWithToken(TTransport rawTransport, String tokenSt
98101
catch (IOException ex) {
99102
throw new UncheckedIOException(ex);
100103
}
104+
catch (TTransportException e) {
105+
throw new PrestoException(HIVE_METASTORE_ERROR, e);
106+
}
101107
}
102108

103109
private static class SaslClientCallbackHandler
@@ -175,5 +181,8 @@ private TTransport authenticateWithHost(TTransport rawTransport, String hiveMeta
175181
catch (IOException e) {
176182
throw new UncheckedIOException(e);
177183
}
184+
catch (TTransportException e) {
185+
throw new PrestoException(HIVE_METASTORE_ERROR, e);
186+
}
178187
}
179188
}

0 commit comments

Comments
 (0)