diff --git a/CHANGES.txt b/CHANGES.txt index e159a26677..fd15a7f770 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,7 @@ 3.11.15 * Fix Splitter sometimes creating more splits than requested (CASSANDRA-18013) Merged from 3.0: + * Switch to snakeyaml's SafeConstructor (CASSANDRA-18150) * Expand build.dir property in rat targets (CASSANDRA-18183) * Suppress CVE-2022-41881 (CASSANDRA-18148) * Default role is created with zero timestamp (CASSANDRA-12525) diff --git a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java index e1930803a0..e55ec85109 100644 --- a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java +++ b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java @@ -44,7 +44,7 @@ import org.apache.cassandra.exceptions.ConfigurationException; import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.composer.Composer; -import org.yaml.snakeyaml.constructor.Constructor; +import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor; import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.introspector.MissingProperty; @@ -122,7 +122,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader } - Constructor constructor = new CustomConstructor(Config.class, Yaml.class.getClassLoader()); + SafeConstructor constructor = new CustomConstructor(Config.class, Yaml.class.getClassLoader()); PropertiesChecker propertiesChecker = new PropertiesChecker(); constructor.setPropertyUtils(propertiesChecker); Yaml yaml = new Yaml(constructor); @@ -145,7 +145,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader @SuppressWarnings("unchecked") //getSingleData returns Object, not T public static T fromMap(Map map, boolean shouldCheck, Class klass) { - Constructor constructor = new YamlConfigurationLoader.CustomConstructor(klass, klass.getClassLoader()); + SafeConstructor constructor = new YamlConfigurationLoader.CustomConstructor(klass, klass.getClassLoader()); YamlConfigurationLoader.PropertiesChecker propertiesChecker = new YamlConfigurationLoader.PropertiesChecker(); constructor.setPropertyUtils(propertiesChecker); Yaml yaml = new Yaml(constructor);