disable external entity resolution when parsing aop.xml - #359
Open
nabhan06 wants to merge 1 commit into
Open
Conversation
Signed-off-by: sayed nabhan <nabhan@bugqore.com>
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.
The three setFeature calls in saxParsing use https://xml.org/sax/features/..., but the SAX feature identifiers are http://xml.org/sax/features/..., so each call throws SAXNotRecognizedException and the surrounding catch swallows it. External general and parameter entities are therefore still enabled, and resolveEntity compounds it by returning null for any public id it doesn't recognise, which is how you tell a SAX parser to go fetch the system id itself. An aop.xml picked up from the load-time weaving classpath can then make the weaver read a local file or issue an outbound request, and since an external DTD can declare a default for the aspect name attribute it can also choose which aspect gets woven.
Corrected the feature URIs and changed resolveEntity to hand back an empty source for unknown ids so nothing is fetched even on a parser that ignores those features; the same edit makes the public id comparison null-safe, which previously threw NPE on a SYSTEM-only doctype. Both new cases in DocumentParserTest fail on master and pass here, and the weaver and loadtime suites stay green.