Skip to content

Commit 7c4912d

Browse files
authored
Feat/security improvements (#81)
* 🔒 refactor: replace xml with defused xml fixes #80, to fix the security attacks that can happen using the xml.dom from stdlib. defusedxml is API compatible and easy to replace that fixes these security issues, so why not. Adds an extra dependency but is worth it. * 🔖 feat: version bump * 🎨 feat: pin dependencies * 📦 feat: packages are installed from a new file
1 parent 3fa5b2b commit 7c4912d

File tree

11 files changed

+59
-30
lines changed

11 files changed

+59
-30
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: |
2626
python -m pip install --upgrade pip
2727
pip install pytest
28-
pip install -r requirements_prod.txt
28+
pip install -r requirements.txt
2929
python setup.py install
3030
- name: Lint with flake8
3131
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea
2+
.tox
23
*.pyc
34
json2xml.egg-info
45
build

json2xml/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
__author__ = """Vinit Kumar"""
66
__email__ = "[email protected]"
7-
__version__ = "3.7.0"
7+
__version__ = "3.8.0"
88

99

1010
# from .utils import readfromurl, readfromstring, readfromjson

json2xml/dicttoxml.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import logging
66
import numbers
77
from random import randint
8-
from xml.dom.minidom import parseString
9-
8+
from defusedxml.minidom import parseString
109

1110
from typing import Dict, Any
1211

json2xml/json2xml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from typing import Optional, Any
3-
from xml.dom.minidom import parseString
3+
from defusedxml.minidom import parseString
44
from json2xml import dicttoxml
55

66

requirements.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
requests>=2.20.0
2+
defusedxml==0.7.1
3+
pytest
4+
xmltodict
5+

requirements.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# This file is autogenerated by pip-compile with python 3.7
3+
# To update, run:
4+
#
5+
# pip-compile
6+
#
7+
attrs==21.2.0
8+
# via pytest
9+
certifi==2021.5.30
10+
# via requests
11+
charset-normalizer==2.0.6
12+
# via requests
13+
defusedxml==0.7.1
14+
# via -r requirements.in
15+
idna==3.2
16+
# via requests
17+
importlib-metadata==4.8.1
18+
# via
19+
# pluggy
20+
# pytest
21+
iniconfig==1.1.1
22+
# via pytest
23+
packaging==21.0
24+
# via pytest
25+
pluggy==1.0.0
26+
# via pytest
27+
py==1.10.0
28+
# via pytest
29+
pyparsing==2.4.7
30+
# via packaging
31+
pytest==6.2.5
32+
# via -r requirements.in
33+
requests==2.26.0
34+
# via -r requirements.in
35+
toml==0.10.2
36+
# via pytest
37+
typing-extensions==3.10.0.2
38+
# via importlib-metadata
39+
urllib3==1.26.7
40+
# via requests
41+
xmltodict==0.12.0
42+
# via -r requirements.in
43+
zipp==3.6.0
44+
# via importlib-metadata

requirements_dev.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

requirements_prod.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
with open("HISTORY.rst") as history_file:
1313
history = history_file.read()
1414

15-
requirements = [open("requirements_prod.txt").read()]
15+
requirements = [open("requirements.txt").read()]
1616

1717
setup_requirements = []
1818

0 commit comments

Comments
 (0)