Skip to content

Conversation

@glarrain
Copy link
Contributor

@glarrain glarrain commented Apr 5, 2019

Add helper functions (plus some related exception classes).

  • parse_untrusted_xml: handles the numerous issues and concerns related to parsing untrusted XML data.
  • read_xml_schema: instantiate an XML schema object from a file.
  • validate_xml_doc: validate an XML document against an XML schema.

Some tests have not been implemented.

glarrain added 3 commits April 5, 2019 11:18
"lxml is a Pythonic, mature binding for the libxml2 and libxslt
libraries. It provides safe and convenient access to these libraries
using the ElementTree API."

https://lxml.de/
https://github.com/lxml/lxml
"XML bomb protection for Python stdlib modules".

https://github.com/tiran/defusedxml
Add helper functions (plus some related exception classes).

- `parse_untrusted_xml`: handles the numerous issues and concerns
  related to parsing untrusted XML data.
- `read_xml_schema`: instantiate an XML schema object from a file.
- `validate_xml_doc`: validate an XML document against an XML schema.

Sources of files in 'test_data/xml/attacks':
- https://en.wikipedia.org/wiki/Billion_laughs_attack#Code_example
- https://pypi.org/project/defusedxml/#billion-laughs-exponential-entity-expansion
- https://pypi.org/project/defusedxml/#external-entity-expansion-remote
- https://pypi.org/project/defusedxml/#quadratic-blowup-entity-expansion

Some tests have not been implemented.
@glarrain glarrain self-assigned this Apr 5, 2019
@glarrain glarrain merged commit a7cdbdc into develop Apr 5, 2019
@glarrain glarrain deleted the feature/libs/add-xml_utils branch April 5, 2019 14:38
@glarrain glarrain mentioned this pull request Apr 5, 2019
@jtrobles-cdd jtrobles-cdd added enhancement New feature or request and removed feature labels Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: libs enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants