Skip to content

Commit 2651d30

Browse files
authored
fix: address XXE in JaxbIO parsing (#2313)
CWE-611: createUnmarshaller().unmarshal(Reader) lets the JAXB provider build its own SAX parser with default settings — external general entities, parameter entities, and DTD loading are not disabled.
1 parent 505bfcf commit 2651d30

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

core/src/main/java/ai/timefold/solver/core/impl/io/jaxb/GenericJaxbIO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public GenericJaxbIO(Class<T> rootClass, int indentation) {
124124

125125
public T read(Reader reader) {
126126
try {
127-
return (T) createUnmarshaller().unmarshal(reader);
127+
return (T) createUnmarshaller().unmarshal(parseXml(reader));
128128
} catch (JAXBException jaxbException) {
129129
throw new TimefoldXmlSerializationException(ERR_MSG_READ.formatted(rootClass.getName()), jaxbException);
130130
}

0 commit comments

Comments
 (0)