Skip to content

Commit 8e7a7e4

Browse files
committed
remove secure processing for odd stylesheets
1 parent 31505a5 commit 8e7a7e4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/org/tei/utils/SaxonProcFactory.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ public class SaxonProcFactory {
2525
public static Processor getProcessor() {
2626
if (null == processor) {
2727
final TransformerFactoryImpl transFactory = new net.sf.saxon.TransformerFactoryImpl();
28-
try {
28+
// try {
2929
//REDHAT
3030
//https://www.blackhat.com/docs/us-15/materials/us-15-Wang-FileCry-The-New-Age-Of-XXE-java-wp.pdf
31-
transFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
31+
//so the following works, but disallows all xsl:result-document call, which are needed for e.g. ODD to TEI transformations
32+
//transFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
3233
//transFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
3334
//this would make all TEI stylesheets stop working
3435
//transFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
@@ -46,9 +47,9 @@ public static Processor getProcessor() {
4647
"http://saxon.sf.net/feature/parserFeature?uri=http://xml.org/sax/features/external-general-entities", false);
4748
processor.setConfigurationProperty(
4849
"http://saxon.sf.net/feature/parserFeature?uri=http://apache.org/xml/features/disallow-doctype-decl", true);
49-
} catch (TransformerConfigurationException e) {
50+
/* } catch (TransformerConfigurationException e) {
5051
LOGGER.error("There is a Doctype Declaration present in the source document that cannot be processed due to security reasons. Please remove it from your file and try again." + e.getMessage());
51-
}
52+
} */
5253
}
5354
return processor;
5455
}

0 commit comments

Comments
 (0)