From fd6d8b77510e8969ea9fef85d70563bfd23ead0c Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Fri, 11 Feb 2022 13:11:20 +0100 Subject: [PATCH] Prevent empty snake yaml constructor, fixes #2153 Signed-off-by: Ondrej Dockal --- .../internal/configuration/reader/JSONConfigurationReader.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/org.eclipse.reddeer.junit/src/org/eclipse/reddeer/junit/internal/configuration/reader/JSONConfigurationReader.java b/plugins/org.eclipse.reddeer.junit/src/org/eclipse/reddeer/junit/internal/configuration/reader/JSONConfigurationReader.java index fe7c91474f..5b851f38ef 100644 --- a/plugins/org.eclipse.reddeer.junit/src/org/eclipse/reddeer/junit/internal/configuration/reader/JSONConfigurationReader.java +++ b/plugins/org.eclipse.reddeer.junit/src/org/eclipse/reddeer/junit/internal/configuration/reader/JSONConfigurationReader.java @@ -30,6 +30,7 @@ import org.eclipse.reddeer.junit.requirement.configuration.RequirementConfiguration; import org.json.JSONObject; import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.SafeConstructor; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; @@ -85,7 +86,7 @@ public List loadConfigurations(File file) { @SuppressWarnings("unchecked") private String convertYamlToJson(File file) throws FileNotFoundException { - Map map= (Map) new Yaml().load(new FileReader(file)); + Map map= (Map) new Yaml(new SafeConstructor()).load(new FileReader(file)); JSONObject jsonObject = new JSONObject(map); return jsonObject.toString(); }