Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,10 @@
<contributor>
<name>Sebastian Peters</name>
</contributor>
<contributor>
<name>MatrixNeoKozak</name>
<email>matrixneo2026@tutamail.com</email>
</contributor>
</contributors>
<dependencies>
<!-- this includes httpclient as dependency -->
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/org/htmlunit/javascript/host/xml/XSLTProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
*
* @author Ahmed Ashour
* @author Ronald Brill
* @author MatrixNeoKozak
*/
@JsxClass
public class XSLTProcessor extends HtmlUnitScriptable {
Expand Down Expand Up @@ -129,6 +130,18 @@ private Object transform(final Node source) {
// which sets a number of processing limits on the processors. Conversely, by default,
// the JDK turns off FSP for transformers and XPath, which enables extension functions for XSLT and XPath.
transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
try {
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
}
catch (final IllegalArgumentException ignored) {
// ignore
}
try {
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
}
catch (final IllegalArgumentException ignored) {
// ignore
}

final SgmlPage page = sourceDomNode.getPage();
if (page != null && page.getWebClient().getBrowserVersion()
Expand Down Expand Up @@ -191,6 +204,12 @@ public Charset getContentCharset() {
}

final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
}
catch (final javax.xml.parsers.ParserConfigurationException ignored) {
// ignore
}
final org.w3c.dom.Document containerDocument = factory.newDocumentBuilder().newDocument();
final org.w3c.dom.Element containerElement = containerDocument.createElement("container");
containerDocument.appendChild(containerElement);
Expand Down
Loading