Disable external entity resolution in MSV schema factories - #320
Open
aizu-m wants to merge 5 commits into
Open
Conversation
Member
|
This probably needs to go in 7.3.0 since it may break legitimate use. |
Contributor
Author
|
Agreed, 7.3.0 is the right place. Any schema document that relies on pulling entities from an external file would stop loading with this in, so it shouldn't ride along in a patch release. Saw you moved the notes over already. |
Contributor
Author
|
any update? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reproducer output against
main, schema documents carrying external entities:Noticed while grepping the tree for
SAXParserFactory.newInstance(). Both MSV construction sites apply onlysetNamespaceAware(true), so entities in a schema document get resolved:BaseSchemaFactory.getSaxFactory(), shared by the W3C and RELAX NG factories, and theW3CMultiSchemaFactoryconstructor. The RELAX NG case copies the referenced file into the grammar verbatim. The W3C case pulls declarations out of a fetched DTD and applies them.Neither the Stax2 factory API nor MSV hands the SAX parser back, so a caller has no way to switch this off. That is why the fix sits at the two construction sites.
xs:include/xs:importandexternalRefare resolved by MSV itself rather than through entity resolution, so those keep working. Entities declared in an internal subset, and schemas with no DOCTYPE at all, behave as before. Test covers both directions.