JAVA-032 / Advanced
Processing untrusted XML with JAXB/Unmarshaller
Why is this a problem?
Default settings may resolve external entities or expose object-creation paths.
How to fix it
java
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setFeature("https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html", true);
XMLReader r = spf.newSAXParser().getXMLReader();
Unmarshaller u = JAXBContext.newInstance(Order.class).createUnmarshaller();
u.unmarshal(new SAXSource(r, new InputSource(req.getInputStream())));