Potential fix for code scanning alert no. 30: Resolving XML external entity in user-controlled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Tim Donohue
2025-04-29 14:51:19 -05:00
committed by GitHub
parent 16e4dae357
commit a0ce50b2a4

View File

@@ -235,6 +235,8 @@ public class PubmedImportMetadataSourceServiceImpl extends AbstractImportMetadat
try {
SAXBuilder saxBuilder = new SAXBuilder();
saxBuilder.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
saxBuilder.setFeature("http://xml.org/sax/features/external-general-entities", false);
Document document = saxBuilder.build(new StringReader(src));
Element root = document.getRootElement();