-
Notifications
You must be signed in to change notification settings - Fork 2
Disable XML Entity Expansions for unmarshalling #300
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
Conversation
Deprecates the constructor taking a set of schema resources.
Enables converting from already parsed DOM Document (e.g. from using DocumentBuilder), which is applicable for ad-hoc access to the parsed XML which is not captured into a JAXB type.
| throw new IllegalArgumentException("No sources given for creating Schema. (schemaResourceNames was " + schemaResourceNames + ")"); | ||
| } | ||
| try { | ||
| SAXParserFactory parserFactory = SAXParserFactory.newInstance(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hvorfor brukes ikke SaxParserProvider.createSecuredParserFactory(); her?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Den kan den nok! Dette ble nok tatt ut i en egen util før SaxParserProvider var tilgjengelig. Will fix!
simenstoa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Accepting an existing InputStream for consuming, should not assume that the InputStream can be closed.
acd6be0 to
a077a9b
Compare
Ensuring JAXB marshalling (in particular
Unmarshaller) uses a securely configured underlying XML parser, according to recommendations by OWASP.In addition, more generic support for customizing the
MarshallerandUnmarshaller, and setting schema used for validation is retrofitted into this facility. This is used by theBillionLaughsTestto inject the infamous Billion Laughs XXE attack header in order to test for the proper handling, i.e. not allowing a DOCTYPE header at all.One additional unmarshal method is added:
unmarshal(Node, Class). This allows for separating the XML-parsing to a general DOM-representation, and then afterwards unmarshal to a JAXB class from the already parsed DOM, instead of parsing the XML a second time.