Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for 6.0.0.Beta2 #1

Open
wants to merge 1 commit into
base: origin-6.0.0.Beta2-1727430113
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,15 @@ public Object read(final InputSource in) throws SAXException,
throw new RuntimeException( "Unable to create new DOM Document",
e );
}

// XXE protection start
try {
f.setFeature("http://xml.org/sax/features/external-general-entities", false);
f.setFeature("http://xml.org/sax/features/external-parameter-entities", false);

} catch (ParserConfigurationException e) {
logger.warn("Unable to set parser features due to {}", e.getMessage());
}
// XXE protection end
try {
this.document = f.newDocumentBuilder().newDocument();
} catch ( Exception e ) {
Expand Down Expand Up @@ -254,6 +262,15 @@ public Object read(final InputSource in) throws SAXException,
}

factory.setNamespaceAware( true );
// XXE protection start
try {
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);

} catch (ParserConfigurationException e) {
logger.warn("Unable to set parser features due to {}", e.getMessage());
}
// XXE protection end

final String isValidatingString = System.getProperty( "drools.schema.validating" );
if ( System.getProperty( "drools.schema.validating" ) != null ) {
Expand Down