Skip to content

Commit 4816dc0

Browse files
berengdjatnieks
authored andcommitted
HCD-62 Upgrade of several libraries (#1563)
The customer requested an upgrade for some libraries (CVEs) 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 1de82da commit 4816dc0

File tree

6 files changed

+26
-15
lines changed

6 files changed

+26
-15
lines changed

.build/parent-pom-template.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
<dependency>
292292
<groupId>org.xerial.snappy</groupId>
293293
<artifactId>snappy-java</artifactId>
294-
<version>1.1.10.4</version>
294+
<version>1.1.10.7</version>
295295
</dependency>
296296
<dependency>
297297
<groupId>org.lz4</groupId>
@@ -306,7 +306,7 @@
306306
<dependency>
307307
<groupId>com.google.guava</groupId>
308308
<artifactId>guava</artifactId>
309-
<version>32.0.1-jre</version>
309+
<version>33.4.0-jre</version>
310310
<exclusions>
311311
<exclusion>
312312
<artifactId>jsr305</artifactId>
@@ -422,17 +422,17 @@
422422
<dependency>
423423
<groupId>com.fasterxml.jackson.core</groupId>
424424
<artifactId>jackson-core</artifactId>
425-
<version>2.13.2</version>
425+
<version>2.18.3</version>
426426
</dependency>
427427
<dependency>
428428
<groupId>com.fasterxml.jackson.core</groupId>
429429
<artifactId>jackson-databind</artifactId>
430-
<version>2.13.2.2</version>
430+
<version>2.18.3</version>
431431
</dependency>
432432
<dependency>
433433
<groupId>com.fasterxml.jackson.core</groupId>
434434
<artifactId>jackson-annotations</artifactId>
435-
<version>2.13.2</version>
435+
<version>2.18.3</version>
436436
</dependency>
437437
<dependency>
438438
<groupId>com.googlecode.json-simple</groupId>
@@ -442,12 +442,12 @@
442442
<dependency>
443443
<groupId>com.fasterxml.jackson.datatype</groupId>
444444
<artifactId>jackson-datatype-jsr310</artifactId>
445-
<version>2.13.2</version>
445+
<version>2.18.3</version>
446446
</dependency>
447447
<dependency>
448448
<groupId>com.fasterxml.jackson.dataformat</groupId>
449449
<artifactId>jackson-dataformat-yaml</artifactId>
450-
<version>2.13.2</version>
450+
<version>2.18.3</version>
451451
<scope>test</scope>
452452
<exclusions>
453453
<exclusion>
@@ -469,7 +469,7 @@
469469
<dependency>
470470
<groupId>org.yaml</groupId>
471471
<artifactId>snakeyaml</artifactId>
472-
<version>1.33</version>
472+
<version>2.4</version>
473473
</dependency>
474474
<dependency>
475475
<groupId>junit</groupId>

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
import org.yaml.snakeyaml.introspector.Property;
5353
import org.yaml.snakeyaml.introspector.PropertyUtils;
5454
import org.yaml.snakeyaml.nodes.Node;
55+
import org.yaml.snakeyaml.parser.ParserImpl;
56+
import org.yaml.snakeyaml.resolver.Resolver;
5557

5658
import static org.apache.cassandra.config.CassandraRelevantProperties.ALLOW_DUPLICATE_CONFIG_KEYS;
5759
import static org.apache.cassandra.config.CassandraRelevantProperties.ALLOW_NEW_OLD_CONFIG_KEYS;
@@ -222,7 +224,7 @@ public static <T> T fromMap(Map<String,Object> map, boolean shouldCheck, Class<T
222224
constructor.setPropertyUtils(propertiesChecker);
223225
Yaml yaml = new Yaml(constructor);
224226
Node node = yaml.represent(map);
225-
constructor.setComposer(new Composer(null, null)
227+
constructor.setComposer(new Composer(new ParserImpl(null), new Resolver(), new LoaderOptions())
226228
{
227229
@Override
228230
public Node getSingleNode()
@@ -256,7 +258,7 @@ protected Object newInstance(Node node)
256258
constructor.setPropertyUtils(propertiesChecker);
257259
Yaml yaml = new Yaml(constructor);
258260
Node node = yaml.represent(map);
259-
constructor.setComposer(new Composer(null, null)
261+
constructor.setComposer(new Composer(new ParserImpl(null), new Resolver(), new LoaderOptions())
260262
{
261263
@Override
262264
public Node getSingleNode()
@@ -275,7 +277,7 @@ static class CustomConstructor extends CustomClassLoaderConstructor
275277
{
276278
CustomConstructor(Class<?> theRoot, ClassLoader classLoader)
277279
{
278-
super(theRoot, classLoader);
280+
super(theRoot, classLoader, new LoaderOptions());
279281

280282
TypeDescription seedDesc = new TypeDescription(ParameterizedClass.class);
281283
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
@@ -164,7 +164,7 @@ void dump(OutputStream output, Map<String, Info> map) throws IOException
164164
{
165165
void dump(OutputStream output, Map<String, Info> map) throws IOException
166166
{
167-
Representer representer = new Representer();
167+
Representer representer = new Representer(new DumperOptions());
168168
representer.addClassTag(Info.class, Tag.MAP); // avoid the auto added tag
169169
Yaml yaml = new Yaml(representer);
170170
yaml.dump(map, new OutputStreamWriter(output));
@@ -386,7 +386,8 @@ Map<String, Info> load(InputStream input) throws IOException
386386
{
387387
Map<String, Info> load(InputStream input) throws IOException
388388
{
389-
Yaml yaml = new Yaml(new CustomConstructor(), new Representer(), new DumperOptions(), LOADER_CONFIG);
389+
DumperOptions dOpts = new DumperOptions();
390+
Yaml yaml = new Yaml(new CustomConstructor(), new Representer(dOpts), dOpts, LOADER_CONFIG);
390391
return (Map<String, Info>) yaml.load(input);
391392
}
392393
};

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

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

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ public void testConcurrentIncRepairDuringPreview() throws IOException, Interrupt
210210
config.with(GOSSIP)
211211
.with(NETWORK)).start()))
212212
{
213+
cluster.setUncaughtExceptionsFilter(t -> t.getClass().toString().contains("RepairException") &&
214+
t.getMessage() != null &&
215+
t.getMessage().contains("Validation failed"));
213216
cluster.schemaChange("create table " + KEYSPACE + ".tbl (id int primary key, t int)");
214217
insert(cluster.coordinator(1), 0, 100);
215218
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
@@ -56,6 +56,7 @@
5656
import org.apache.cassandra.stress.settings.*;
5757
import org.apache.cassandra.stress.util.JavaDriverClient;
5858
import org.apache.cassandra.stress.util.ResultLogger;
59+
import org.yaml.snakeyaml.LoaderOptions;
5960
import org.yaml.snakeyaml.Yaml;
6061
import org.yaml.snakeyaml.constructor.Constructor;
6162
import org.yaml.snakeyaml.error.YAMLException;
@@ -809,7 +810,7 @@ public static StressProfile load(URI file) throws IOError
809810
{
810811
try
811812
{
812-
Constructor constructor = new Constructor(StressYaml.class);
813+
Constructor constructor = new Constructor(StressYaml.class, new LoaderOptions());
813814

814815
Yaml yaml = new Yaml(constructor);
815816

0 commit comments

Comments
 (0)