SonarOpenCommunity / sonar-cxx

XMLStreamReaders must be secure JAVA-S1009
Security
Critical
5 months ago2 years old
XMLStreamReader created from xmlFactory may be vulnerable to XXE attacks
 43    try {
 44      this.file = file;
 45      this.reader = new InputStreamReader(java.nio.file.Files.newInputStream(file.toPath()), StandardCharsets.UTF_8);
 46      var xmlFactory = XMLInputFactory.newInstance(); 47      xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
 48      this.stream = xmlFactory.createXMLStreamReader(reader);
 49