Skip to content

Commit 4b10284

Browse files
committed
fix incorrect XML builder defaults to prevent DTD entity loading
1 parent 6d192dd commit 4b10284

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/password/pwm/util/java/XmlFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import password.pwm.error.PwmError;
3232
import password.pwm.error.PwmUnrecoverableException;
3333

34+
import javax.xml.XMLConstants;
3435
import javax.xml.parsers.DocumentBuilder;
3536
import javax.xml.parsers.DocumentBuilderFactory;
3637
import javax.xml.parsers.ParserConfigurationException;
@@ -217,7 +218,8 @@ static DocumentBuilder getBuilder()
217218
try
218219
{
219220
final DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
220-
dbFactory.setFeature( "http://apache.org/xml/features/disallow-doctype-decl", false );
221+
dbFactory.setFeature( XMLConstants.FEATURE_SECURE_PROCESSING, true );
222+
dbFactory.setFeature( "http://apache.org/xml/features/disallow-doctype-decl", true );
221223
dbFactory.setExpandEntityReferences( false );
222224
dbFactory.setValidating( false );
223225
dbFactory.setXIncludeAware( false );

0 commit comments

Comments
 (0)