diff --git a/k8s_handle/filesystem.py b/k8s_handle/filesystem.py index 5d200eb..7993290 100644 --- a/k8s_handle/filesystem.py +++ b/k8s_handle/filesystem.py @@ -17,7 +17,7 @@ class InvalidYamlError(Exception): def load_yaml(path): try: with open(path) as f: - return yaml.load(f.read()) + return yaml.safe_load(f.read()) except Exception as e: raise InvalidYamlError("file '{}' doesn't contain valid yaml: {}".format( path, e)) diff --git a/k8s_handle/templating.py b/k8s_handle/templating.py index 2a5c441..7476f07 100644 --- a/k8s_handle/templating.py +++ b/k8s_handle/templating.py @@ -19,7 +19,7 @@ class TemplateRenderingError(Exception): def get_template_contexts(file_path): with open(file_path) as f: try: - contexts = yaml.load_all(f.read()) + contexts = yaml.safe_load_all(f.read()) except Exception as e: raise RuntimeError('Unable to load yaml file: {}, {}'.format(file_path, e))