diff options
| author | jvoisin | 2018-07-08 17:07:26 +0200 |
|---|---|---|
| committer | jvoisin | 2018-07-08 17:07:26 +0200 |
| commit | f9bc022c96dd73f5d5551777c19536db2464f06a (patch) | |
| tree | 1bb23b0d599564863a2d4fdddb63146a2324861c /libmat2 | |
| parent | 72e1fda18d2788fb45c04e35a6447a56599c86ed (diff) | |
Add defusedxml as an (optional) way to prevent XML-based attacks
Those attacks are DoS-only.
Diffstat (limited to 'libmat2')
| -rw-r--r-- | libmat2/office.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libmat2/office.py b/libmat2/office.py index 14621d4..0d0c795 100644 --- a/libmat2/office.py +++ b/libmat2/office.py | |||
| @@ -4,8 +4,11 @@ import shutil | |||
| 4 | import tempfile | 4 | import tempfile |
| 5 | import datetime | 5 | import datetime |
| 6 | import zipfile | 6 | import zipfile |
| 7 | import xml.etree.ElementTree as ET | ||
| 8 | from typing import Dict, Set, Pattern | 7 | from typing import Dict, Set, Pattern |
| 8 | try: # protect against DoS | ||
| 9 | from defusedxml import ElementTree as ET | ||
| 10 | except ImportError: | ||
| 11 | import xml.etree.ElementTree as ET | ||
| 9 | 12 | ||
| 10 | 13 | ||
| 11 | from . import abstract, parser_factory | 14 | from . import abstract, parser_factory |
