Skip to content

Commit f6066f0

Browse files
authored
Use Yaml SafeConstructor (#355)
1 parent 7b8eb67 commit f6066f0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/org/commonwl/view/cwl/CWLService.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import com.fasterxml.jackson.databind.node.ArrayNode;
6565
import com.fasterxml.jackson.databind.node.ObjectNode;
6666
import com.fasterxml.jackson.databind.node.TextNode;
67+
import org.yaml.snakeyaml.constructor.SafeConstructor;
6768

6869
/**
6970
* Provides CWL parsing for workflows to gather an overview
@@ -602,10 +603,8 @@ private String typeURIToString(String uri) {
602603
* @throws IOException
603604
*/
604605
private JsonNode yamlPathToJson(Path path) throws IOException {
605-
Yaml reader = new Yaml();
606+
Yaml reader = new Yaml(new SafeConstructor());
606607
ObjectMapper mapper = new ObjectMapper();
607-
Path p;
608-
609608
try (InputStream in = Files.newInputStream(path)) {
610609
return mapper.valueToTree(reader.load(in));
611610
}
@@ -618,7 +617,7 @@ private JsonNode yamlPathToJson(Path path) throws IOException {
618617
* @return A JsonNode with the content of the document
619618
*/
620619
private JsonNode yamlStreamToJson(InputStream yamlStream) {
621-
Yaml reader = new Yaml();
620+
Yaml reader = new Yaml(new SafeConstructor());
622621
ObjectMapper mapper = new ObjectMapper();
623622
return mapper.valueToTree(reader.load(yamlStream));
624623
}

0 commit comments

Comments
 (0)