Remove misleading no-op lines incorrectly trying to disable external entities #173
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As noted in #51 (comment) these lines don't do anything - they use
/properties
rather than/features
so throw an exception: https://xerces.apache.org/xerces-j/features.htmlI can't find any reference to such (incorrect) feature keys outside DOM4J.
The correctly-named XXE-secure features are only enabled via
SaxReader.createDefault()
atdom4j/src/main/java/org/dom4j/io/SAXReader.java
Lines 152 to 162 in 41b079a
These lines are rather confusing when following the code, and may mislead folks into thinking that XXE is disabled by default by the library - which I don't think they are - if you just use
new SAXReader()
.An alternative to this PR would be to "correct" the defaults, which would be a breaking change, and make the
setFeatures
inSAXReader.createDefault()
irrelevant, since the same thing would have been done when the reader is created. This would risk complaints such as #51 where loading external DTDs was intentionally disabled by default. That would have the readers more "secure by default".