Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.finos.symphony.messageml</groupId>
<artifactId>messageml-utils</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<name>MessageML Utils</name>
<url>https://github.com/finos/messageml-utils</url>
<description>A set of utilities for parsing, processing and rendering of MessageML messages
Expand All @@ -33,7 +33,7 @@
<jackson.databind.version>2.15.2</jackson.databind.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.lang3.version>3.12.0</commons.lang3.version>
<freemarker.version>2.3.31</freemarker.version>
<freemarker.version>2.3.34</freemarker.version>
<commonmark.version>0.15.2</commonmark.version>
<mozilla.rhino.version>1.7.13</mozilla.rhino.version>
<junit.version>5.8.2</junit.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import freemarker.core.TemplateClassResolver;
import freemarker.template.Configuration;
import freemarker.template.SimpleObjectWrapper;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateExceptionHandler;
Expand Down Expand Up @@ -165,6 +166,7 @@ public class MessageMLParser {
FREEMARKER.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
FREEMARKER.setLogTemplateExceptions(false);
FREEMARKER.setNewBuiltinClassResolver(TemplateClassResolver.ALLOWS_NOTHING_RESOLVER);
FREEMARKER.setObjectWrapper(new SimpleObjectWrapper(Configuration.VERSION_2_3_30));
}

MessageMLParser(IDataProvider dataProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.anyLong;
Expand Down Expand Up @@ -133,6 +134,14 @@ public void testParseMessageMLUmlautsCharacters()
assertEquals(expectedResult, presentationML);
}

@Test
public void testSecurityIssue() throws InvalidInputException, IOException, ProcessingException {
final String message = "<messageML>\n"
+ "<#assign lo=.locale_object><#assign k='cl'+'ass'><#assign cls=lo[k]><#attempt><#assign m=cls.getMethods()><#list m as x>${x.name}(${x.parameterCount}); </#list><#recover>ERR:${.error?html}</#attempt>\n"
+ "</messageML>";
assertThrows(InvalidInputException.class, () -> context.parseMessageML(message, "", MessageML.MESSAGEML_VERSION));
}

@Test
public void testParseMessageMLTextFieldWithSplittables()
throws InvalidInputException, IOException, ProcessingException {
Expand Down
Loading