mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
swap unsafe yaml.load usage for yaml.safe_load (#2324)
Related to #2323 Recommend additionally adding a step in CI ensuring use of `yaml.load` is prevented from existing in the code base.
This commit is contained in:
parent
7546c50226
commit
985e7b3c6d
@ -504,7 +504,7 @@ class Trivia(commands.Cog):
|
|||||||
|
|
||||||
with path.open(encoding="utf-8") as file:
|
with path.open(encoding="utf-8") as file:
|
||||||
try:
|
try:
|
||||||
dict_ = yaml.load(file)
|
dict_ = yaml.safe_load(file)
|
||||||
except yaml.error.YAMLError as exc:
|
except yaml.error.YAMLError as exc:
|
||||||
raise InvalidListError("YAML parsing failed.") from exc
|
raise InvalidListError("YAML parsing failed.") from exc
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -10,7 +10,7 @@ def test_trivia_lists():
|
|||||||
for l in list_names:
|
for l in list_names:
|
||||||
with l.open() as f:
|
with l.open() as f:
|
||||||
try:
|
try:
|
||||||
dict_ = yaml.load(f)
|
dict_ = yaml.safe_load(f)
|
||||||
except yaml.error.YAMLError as e:
|
except yaml.error.YAMLError as e:
|
||||||
problem_lists.append((l.stem, "YAML error:\n{!s}".format(e)))
|
problem_lists.append((l.stem, "YAML error:\n{!s}".format(e)))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user