I had HP Fortify report the 'XML External Entity Injection' on my Java code and I made the below fixes to address this.
- DocumentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
- DocumentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
Note: DocumentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING , true); is already set to prevent 'XML Entity Expansion'.
However, even after these changes the Fortify still reports the 'XML External Entity Injection' error.
Wanted to understand if the Fortify rules around the XEE detection is looking for some specific settings to be set on parser apart from the above.