Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Fix pyyaml security issues #57

Merged
merged 2 commits into from
Mar 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.9
current_version = 0.1.10

[bumpversion:file:setup.py]

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_requirements(req_file):

setup(
name='spec-synthase',
version='0.1.9',
version='0.1.10',
license='MPL2',
description='spec-synthase is a tool to help deal with big swagger files, by building the swagger specification files from little spec files. ',
long_description=read('README.rst'),
Expand Down
2 changes: 1 addition & 1 deletion specsynthase/specbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, *args, **kwargs):

def _load_spec(self, file_name):
with open(file_name, 'r') as spec_file:
return yaml.load(spec_file)
return yaml.load(spec_file, Loader=yaml.FullLoader)

def _merge_part(self, key, part_dict):
if part_dict:
Expand Down
10 changes: 7 additions & 3 deletions tests/test_specsynthase.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def _check_dicts(l, r):

def test_build_fluent():
base_dir = _get_base_dir()
full = yaml.load(open(path.join(base_dir, "full.yml")).read())
full = yaml.load(
open(path.join(base_dir, "full.yml")).read(),
Loader=yaml.FullLoader)
spec = SpecBuilder().add_spec(path.join(base_dir, "security.yml"))\
.add_spec(path.join(base_dir, "base.yml"))\
.add_spec(path.join(base_dir, "definitions.yml"))\
Expand All @@ -39,15 +41,17 @@ def test_build_existing_key():
def test_dump():
base_dir = _get_base_dir()
parts = ["base.yml", "definitions.yml", "paths.yml", "security.yml"]
full = yaml.load(open(path.join(base_dir, "full.yml")).read())
full = yaml.load(
open(path.join(base_dir, "full.yml")).read(),
Loader=yaml.FullLoader)

spec = SpecBuilder()
for p in parts:
spec.add_spec(path.join(base_dir, p))

# Dumping and reloading the yaml is slow, but we can't compare dumped
# strings because of potential key ordering differences.
assert full == yaml.load(spec.dump())
assert full == yaml.load(spec.dump(), Loader=yaml.FullLoader)


def test_validation_fail():
Expand Down