Browse Source

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

Jeremy Stretch 10 tháng trước cách đây
mục cha
commit
8b091fb219
1 tập tin đã thay đổi với 1 bổ sung6 xóa
  1. 1 6
      netbox/extras/scripts.py

+ 1 - 6
netbox/extras/scripts.py

@@ -528,14 +528,9 @@ class BaseScript:
         """
         """
         Return data from a YAML file
         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)
         file_path = os.path.join(settings.SCRIPTS_ROOT, filename)
         with open(file_path, 'r') as datafile:
         with open(file_path, 'r') as datafile:
-            data = yaml.load(datafile, Loader=Loader)
+            data = yaml.load(datafile, Loader=yaml.SafeLoader)
 
 
         return data
         return data