Fixes #19189: BaseScript.load_yaml() should use SafeLoader (#19190)

This commit is contained in:
Jeremy Stretch 2025-04-15 09:58:13 -04:00 committed by GitHub
parent 44cb1a9139
commit 8b091fb219
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -528,14 +528,9 @@ class BaseScript:
"""
Return data from a YAML file
"""
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
file_path = os.path.join(settings.SCRIPTS_ROOT, filename)
with open(file_path, 'r') as datafile:
data = yaml.load(datafile, Loader=Loader)
data = yaml.load(datafile, Loader=yaml.SafeLoader)
return data