Skip to content

Commit

Permalink
PyYAML safe_load
Browse files Browse the repository at this point in the history
  • Loading branch information
naoyak committed May 27, 2020
1 parent 48db4db commit 6e65e22
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion knowledge_repo/post.py
Expand Up @@ -327,7 +327,7 @@ def _get_headers_from_yaml(self, yaml_str):
try:
if not yaml_str.strip().startswith('---'):
raise StopIteration()
return next(yaml.load_all(yaml_str))
return next(yaml.safe_load_all(yaml_str))
except yaml.YAMLError as e:
logger.info(
"YAML header is incorrectly formatted or missing. The following "
Expand Down
2 changes: 1 addition & 1 deletion knowledge_repo/repositories/gitrepository.py
Expand Up @@ -76,7 +76,7 @@ def init(self, config='git:///.knowledge_repo_config.yml', auto_create=False):
if config.startswith('git:///'):
assert config.endswith('.yml'), "In-repository configuration must be a YAML file."
try:
self.config.update(yaml.load(self.git_read(config.replace('git:///', ''))))
self.config.update(yaml.safe_load(self.git_read(config.replace('git:///', ''))))
except KeyError:
logger.warning("Repository missing configuration file: {}".format(config))
else:
Expand Down

0 comments on commit 6e65e22

Please sign in to comment.