Skip to content

Commit

Permalink
Fix code scanning alert #41: Resolving XML external entity in user-co…
Browse files Browse the repository at this point in the history
…ntrolled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
lfoppiano and github-advanced-security[bot] authored Sep 22, 2024
1 parent f501033 commit 044f158
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ public String descriptionRetrieval(String patentNumber) throws IOException,
spf.setValidating(false);
spf.setFeature("http://xml.org/sax/features/namespaces", false);
spf.setFeature("http://xml.org/sax/features/validation", false);
spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
//get a new instance of parser
XMLReader reader = XMLReaderFactory.createXMLReader();
XMLReader reader = spf.newSAXParser().getXMLReader();
reader.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId) {
return new InputSource(
Expand Down

0 comments on commit 044f158

Please sign in to comment.