Commit 517fe0e
committed
build: Harden XML parser in extract_get.py
build: Emable XML DTD filtering in extract_get.py
Gramar validation will prevent noise injection
build: Replace the xml parser used in extract_get.py
The prevents known attack,
Also note that defusedxml (0.7.1) by default
(forbid_entities=True, forbid_external=True, see minidom.py reference)
- forbid_entities: disallow XML with <!ENTITY>
- forbid_dtd: disallow XML with a <!DOCTYPE>
- forbid_external: disallow any access to remote or local resources in external entities or DTD
Minor py3 cleanup added.
Origin: #101
Bug-SiliconLabs: UIC-3662
Relate-to: https://en.wikipedia.org/wiki/Billion_laughs_attack
Relate-to: https://docs.python.org/3/library/xml.html#xml-vulnerabilities
Relate-to: SLVDBBP-3112666
Relate-to: https://pypi.org/project/defusedxml/#billion-laughs-exponential-entity-expansion
Relate-to: SiliconLabsSoftware/z-wave-engine-application-layer#42
Relate-to: https://github.com/tiran/defusedxml/blob/v0.7.1/defusedxml/minidom.py#L18
Signed-off-by: Philippe Coval <philippe.coval@silabs.com>1 parent 09ebaa7 commit 517fe0e
File tree
2 files changed
+5
-7
lines changed- applications/zpc/components/zwave_command_handler/scripts
2 files changed
+5
-7
lines changedLines changed: 4 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | 5 | | |
8 | | - | |
| 6 | + | |
| 7 | + | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 16 | + | |
| 17 | + | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
0 commit comments