Skip to content

Commit f38360e

Browse files
authored
HCD-62 Upgrade of several libraries (#1563)
### What is the issue The customer requested an upgrade for some libraries (CVEs) ### What does this PR fix and why was it fixed This PR upgrades to latest stable versions - snappy to 1.1.10.7 fixing CVE-2023-43642 - guava to 33.4.0-jre fixing CVE-2023-2976 and CVE-2020-8908 - jackson to 2.18.0 fixing CWE-400 - snakeyaml to 2.4 fixing CVE-2022-1471
1 parent ebc4bc6 commit f38360e

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

build.xml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -574,15 +574,14 @@
574574
<license name="The Apache Software License, Version 2.0" url="https://www.apache.org/licenses/LICENSE-2.0.txt"/>
575575
<scm connection="${scm.connection}" developerConnection="${scm.developerConnection}" url="${scm.url}"/>
576576
<dependencyManagement>
577-
<dependency groupId="org.xerial.snappy" artifactId="snappy-java" version="1.1.10.1"/>
577+
<dependency groupId="org.xerial.snappy" artifactId="snappy-java" version="1.1.10.7"/>
578578
<dependency groupId="org.lz4" artifactId="lz4-java" version="1.8.0"/>
579579
<dependency groupId="com.ning" artifactId="compress-lzf" version="0.8.4" scope="provided"/>
580580
<dependency groupId="com.github.luben" artifactId="zstd-jni" version="1.5.5-1"/>
581-
<dependency groupId="com.google.guava" artifactId="guava" version="27.0-jre">
581+
<dependency groupId="com.google.guava" artifactId="guava" version="33.4.0-jre">
582582
<exclusion groupId="com.google.code.findbugs" artifactId="jsr305" />
583583
<exclusion groupId="org.codehaus.mojo" artifactId="animal-sniffer-annotations" />
584584
<exclusion groupId="com.google.guava" artifactId="listenablefuture" />
585-
<exclusion groupId="com.google.guava" artifactId="failureaccess" />
586585
<exclusion groupId="org.checkerframework" artifactId="checker-qual" />
587586
<exclusion groupId="com.google.errorprone" artifactId="error_prone_annotations" />
588587
</dependency>
@@ -604,15 +603,15 @@
604603
<dependency groupId="org.slf4j" artifactId="jcl-over-slf4j" version="2.0.9" />
605604
<dependency groupId="ch.qos.logback" artifactId="logback-core" version="1.4.14"/>
606605
<dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.4.14"/>
607-
<dependency groupId="com.fasterxml.jackson.core" artifactId="jackson-core" version="2.13.2"/>
608-
<dependency groupId="com.fasterxml.jackson.core" artifactId="jackson-databind" version="2.13.2.2"/>
609-
<dependency groupId="com.fasterxml.jackson.core" artifactId="jackson-annotations" version="2.13.2"/>
606+
<dependency groupId="com.fasterxml.jackson.core" artifactId="jackson-core" version="2.18.3"/>
607+
<dependency groupId="com.fasterxml.jackson.core" artifactId="jackson-databind" version="2.18.3"/>
608+
<dependency groupId="com.fasterxml.jackson.core" artifactId="jackson-annotations" version="2.18.3"/>
610609
<dependency groupId="org.msgpack" artifactId="jackson-dataformat-msgpack" version="0.8.16"/>
611610

612611
<dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>
613612
<dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
614613
<dependency groupId="com.github.jbellis" artifactId="jamm" version="${jamm.version}"/>
615-
<dependency groupId="org.yaml" artifactId="snakeyaml" version="1.33"/>
614+
<dependency groupId="org.yaml" artifactId="snakeyaml" version="2.4"/>
616615
<dependency groupId="junit" artifactId="junit" version="4.13" scope="test">
617616
<exclusion groupId="org.hamcrest" artifactId="hamcrest-core"/>
618617
</dependency>

src/java/org/apache/cassandra/config/YamlConfigurationLoader.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.slf4j.LoggerFactory;
4646

4747
import org.apache.cassandra.exceptions.ConfigurationException;
48+
import org.yaml.snakeyaml.LoaderOptions;
4849
import org.yaml.snakeyaml.TypeDescription;
4950
import org.yaml.snakeyaml.Yaml;
5051
import org.yaml.snakeyaml.composer.Composer;
@@ -55,6 +56,8 @@
5556
import org.yaml.snakeyaml.introspector.Property;
5657
import org.yaml.snakeyaml.introspector.PropertyUtils;
5758
import org.yaml.snakeyaml.nodes.Node;
59+
import org.yaml.snakeyaml.parser.ParserImpl;
60+
import org.yaml.snakeyaml.resolver.Resolver;
5861

5962
public class YamlConfigurationLoader implements ConfigurationLoader
6063
{
@@ -157,7 +160,7 @@ public static <T> T fromMap(Map<String,Object> map, boolean shouldCheck, Class<T
157160
constructor.setPropertyUtils(propertiesChecker);
158161
Yaml yaml = new Yaml(constructor);
159162
Node node = yaml.represent(map);
160-
constructor.setComposer(new Composer(null, null)
163+
constructor.setComposer(new Composer(new ParserImpl(null), new Resolver(), new LoaderOptions())
161164
{
162165
@Override
163166
public Node getSingleNode()
@@ -175,7 +178,7 @@ static class CustomConstructor extends CustomClassLoaderConstructor
175178
{
176179
CustomConstructor(Class<?> theRoot, ClassLoader classLoader)
177180
{
178-
super(theRoot, classLoader);
181+
super(theRoot, classLoader, new LoaderOptions());
179182

180183
TypeDescription seedDesc = new TypeDescription(ParameterizedClass.class);
181184
seedDesc.putMapPropertyType("parameters", String.class, String.class);

src/java/org/apache/cassandra/tools/JMXTool.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void dump(OutputStream output, Map<String, Info> map) throws IOException
166166
{
167167
void dump(OutputStream output, Map<String, Info> map) throws IOException
168168
{
169-
Representer representer = new Representer();
169+
Representer representer = new Representer(new DumperOptions());
170170
representer.addClassTag(Info.class, Tag.MAP); // avoid the auto added tag
171171
Yaml yaml = new Yaml(representer);
172172
yaml.dump(map, new OutputStreamWriter(output));
@@ -388,7 +388,8 @@ Map<String, Info> load(InputStream input) throws IOException
388388
{
389389
Map<String, Info> load(InputStream input) throws IOException
390390
{
391-
Yaml yaml = new Yaml(new CustomConstructor(), new Representer(), new DumperOptions(), LOADER_CONFIG);
391+
DumperOptions dOpts = new DumperOptions();
392+
Yaml yaml = new Yaml(new CustomConstructor(), new Representer(dOpts), dOpts, LOADER_CONFIG);
392393
return (Map<String, Info>) yaml.load(input);
393394
}
394395
};

test/distributed/org/apache/cassandra/distributed/test/FailingRepairTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ public static void setupCluster() throws IOException
151151
.start());
152152
CLUSTER.setUncaughtExceptionsFilter((throwable) -> {
153153
if (throwable.getClass().toString().contains("InstanceShutdown") || // can't check instanceof as it is thrown by a different classloader
154-
throwable.getMessage() != null && throwable.getMessage().contains("Parent repair session with id"))
154+
(throwable.getMessage() != null && throwable.getMessage().contains("Parent repair session with id")) ||
155+
(throwable.getClass().toString().contains("RepairException") &&
156+
throwable.getMessage() != null &&
157+
throwable.getMessage().contains("Validation failed"))
158+
)
155159
return true;
156160
return false;
157161
});

test/distributed/org/apache/cassandra/distributed/test/IncRepairTruncationTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public void testTruncateDuringIncRepair() throws IOException, InterruptedExcepti
5353
.with(NETWORK))
5454
.start()))
5555
{
56+
cluster.setUncaughtExceptionsFilter(t -> t.getMessage() != null &&
57+
t.getMessage().contains("Parent repair session with id") &&
58+
t.getMessage().contains("has failed"));
5659
cluster.schemaChange("create table " + KEYSPACE + ".tbl (id int primary key, t int)");
5760

5861
insert(cluster.coordinator(1), 0, 100);

test/distributed/org/apache/cassandra/distributed/test/PreviewRepairTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ public void testConcurrentIncRepairDuringPreview() throws IOException, Interrupt
199199
config.with(GOSSIP)
200200
.with(NETWORK)).start()))
201201
{
202+
cluster.setUncaughtExceptionsFilter(t -> t.getClass().toString().contains("RepairException") &&
203+
t.getMessage() != null &&
204+
t.getMessage().contains("Validation failed"));
202205
cluster.schemaChange("create table " + KEYSPACE + ".tbl (id int primary key, t int)");
203206
insert(cluster.coordinator(1), 0, 100);
204207
cluster.forEach((node) -> node.flush(KEYSPACE));

tools/stress/src/org/apache/cassandra/stress/StressProfile.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import org.apache.cassandra.stress.settings.*;
5858
import org.apache.cassandra.stress.util.JavaDriverClient;
5959
import org.apache.cassandra.stress.util.ResultLogger;
60+
import org.yaml.snakeyaml.LoaderOptions;
6061
import org.yaml.snakeyaml.Yaml;
6162
import org.yaml.snakeyaml.constructor.Constructor;
6263
import org.yaml.snakeyaml.error.YAMLException;
@@ -810,7 +811,7 @@ public static StressProfile load(URI file) throws IOError
810811
{
811812
try
812813
{
813-
Constructor constructor = new Constructor(StressYaml.class);
814+
Constructor constructor = new Constructor(StressYaml.class, new LoaderOptions());
814815

815816
Yaml yaml = new Yaml(constructor);
816817

0 commit comments

Comments
 (0)