Fix code scanning alert no. 41: Resolving XML external entity in user-controlled data by lfoppiano · Pull Request #1205 · grobidOrg/grobid (original) (raw)
Fixes https://github.com/kermitt2/grobid/security/code-scanning/41
To fix the problem, we need to ensure that the XML parser is fully secured against XXE attacks. This involves:
- Ensuring that the
SAXParserFactoryis configured to disallow DTDs. - Ensuring that the
XMLReaderis configured to disallow external entities. - Adding an
EntityResolverthat returns an empty string for any external entity.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.