Skip to content

Commit

Permalink
IMPROVEMENT: use defusedxml because it is safer
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Jun 16, 2024
1 parent 69740b8 commit 601ad32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions MethodicConfigurator/annotate_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
from sys import exc_info as sys_exc_info
from sys import exit as sys_exit
from typing import Any, Dict, List, Optional, Tuple
import xml.etree.ElementTree as ET

from xml.etree import ElementTree as ET
from defusedxml import ElementTree as DET

import argparse
import logging

Expand Down Expand Up @@ -341,7 +344,7 @@ def get_xml_data(base_url: str, directory: str, filename: str) -> ET.Element:
raise SystemExit("permission denied to write online XML documentation to file") from e

# Parse the XML data
root = ET.fromstring(xml_data)
root = DET.fromstring(xml_data)

# Load parameter default values if the 00_default.param file exists
try:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
author_email='[email protected]',
packages=find_packages(),
install_requires=[
'defusedxml',
'matplotlib',
'numpy',
'platformdirs',
Expand Down

0 comments on commit 601ad32

Please sign in to comment.