[dwdunwetter] Handle possible XXE injection (#15466)

XMLInputFactory: Disable properties IS_SUPPORTING_EXTERNAL_ENTITIES and
SUPPORT_DTD which allow injecting external entities.

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich 2023-08-29 18:50:13 +02:00 committed by GitHub
parent 5e1f24c54f
commit d3c07344d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,6 +119,8 @@ public class DwdWarningsData {
try {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(rawData));
XMLEventReader eventReader = inputFactory.createXMLEventReader(reader);
DwdWarningData gemeindeData = new DwdWarningData();