add opt-in to disable external DTD access in JAXPValidator - #331
Conversation
|
this has been a conscious decision and even been documented as such, see the {release notes of 2.6.](https://github.com/xmlunit/xmlunit/blob/main/RELEASE_NOTES.md#xmlunit-for-java-260---released-2018-04-22) I wouldn't be opposed to added a stronger warning to the class' javadocs - nor to adding SchemaFactorConfigurer and ValidatorConfigurer classes similar to The context of the validation package is one where I strongly believe people will only use it on trusted inputs. And if they don't there are warnings already in place. |
3ef3e81 to
2049841
Compare
|
makes sense, the 2.6.0 note is clear and I don't want to change that default either. I've reworked this to leave the default alone and added an opt-in If you'd rather have reusable SchemaFactoryConfigurer/ValidatorConfigurer classes than a one-off setter, I'm happy to go that route instead, just say the word. |
2049841 to
1b209eb
Compare
|
I'm fine with the one-off setter unless you believe there are other places in XMLUnit that would benefit from the configurer. I don't believe SchemaFactory or Validator are used anywhere else (outside of the legacy project), though. |
add release notes for #331 #332 #333 by @jmestwa-coder
|
agreed, the setter's the right scope here. JAXPValidator is the only spot outside the legacy project that touches SchemaFactory/Validator, so a shared configurer wouldn't really buy anything. thanks for merging. |
By default JAXPValidator leaves external DTD access enabled, matching the conscious decision documented in the 2.6.0 release notes. This keeps that default unchanged and adds an opt-in for callers who validate untrusted input.
setDisableExternalDtdAccess(boolean)on JAXPValidator, defaultfalseso existing behavior is unchangedaccessExternalDTDto the empty string on the SchemaFactory and the ValidatoraccessExternalSchemais left untouched soxs:importandxsi:schemaLocationkeep working