Skip to content

Commit

Permalink
[SECURITY-2146]
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmoritz01 authored and daniel-beck committed Dec 2, 2020
1 parent 8077bb8 commit ff12144
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/main/java/hudson/scm/CVSChangeLogSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
import hudson.scm.CVSChangeLogSet.CVSChangeLog;
import hudson.util.Digester2;
import hudson.util.IOException2;
import org.xml.sax.SAXException;

import javax.xml.parsers.ParserConfigurationException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
Expand Down Expand Up @@ -116,9 +118,25 @@ public static CVSChangeLogSet parse(final Run<?, ?> build, RepositoryBrowser<?>
}

private static ArrayList<CVSChangeLog> parseFile(final java.io.File f)
throws IOException2 {
Digester digester = new Digester2();
throws IOException2, SAXException {

Digester digester = new Digester2();

digester.setXIncludeAware(false);

if (!Boolean.getBoolean(CVSChangeLogParser.class.getName() + ".UNSAFE")) {
try {
digester.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
digester.setFeature("http://xml.org/sax/features/external-general-entities", false);
digester.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
digester.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
}
catch (ParserConfigurationException ex) {
throw new SAXException("Failed to securely configure CVS changelog parser", ex);
}
}
ArrayList<CVSChangeLog> r = new ArrayList<CVSChangeLog>();

digester.push(r);

digester.addObjectCreate("*/entry", CVSChangeLog.class);
Expand Down

0 comments on commit ff12144

Please sign in to comment.