diff --git a/auditbeat/scripts/docs_collector.py b/auditbeat/scripts/docs_collector.py index 5e897bde3ed..7b7bc6a3299 100644 --- a/auditbeat/scripts/docs_collector.py +++ b/auditbeat/scripts/docs_collector.py @@ -56,7 +56,7 @@ def collect(base_paths): # Load title from fields.yml with open(beat_path + "/fields.yml") as f: - fields = yaml.load(f.read()) + fields = yaml.load(f.read(), Loader=yaml.FullLoader) title = fields[0]["title"] modules_list[module] = title diff --git a/filebeat/scripts/docs_collector.py b/filebeat/scripts/docs_collector.py index 3173146f4e0..b9657d4dd08 100644 --- a/filebeat/scripts/docs_collector.py +++ b/filebeat/scripts/docs_collector.py @@ -45,7 +45,7 @@ def collect(beat_name): # Load title from fields.yml with open(beat_path + "/fields.yml", encoding='utf_8') as f: - fields = yaml.load(f.read()) + fields = yaml.load(f.read(), Loader=yaml.FullLoader) title = fields[0]["title"] modules_list[module] = title diff --git a/libbeat/scripts/generate_fields_docs.py b/libbeat/scripts/generate_fields_docs.py index f25ebc00779..89a80d83d27 100644 --- a/libbeat/scripts/generate_fields_docs.py +++ b/libbeat/scripts/generate_fields_docs.py @@ -106,7 +106,7 @@ def fields_to_asciidoc(input, output, beat): """.format(**dict)) - docs = yaml.load(input) + docs = yaml.load(input, Loader=yaml.FullLoader) # fields file is empty if docs is None: diff --git a/libbeat/tests/system/beat/common_tests.py b/libbeat/tests/system/beat/common_tests.py index dd128029977..1f2c890749d 100644 --- a/libbeat/tests/system/beat/common_tests.py +++ b/libbeat/tests/system/beat/common_tests.py @@ -76,5 +76,5 @@ def test_export_config(self): Test that the config can be exported with `export config` """ output = self.run_export_cmd("config") - yml = yaml.load(output) + yml = yaml.load(output, Loader=yaml.FullLoader) assert isinstance(yml, dict) diff --git a/pytest.ini b/pytest.ini index cc816886a6e..8d35108f951 100644 --- a/pytest.ini +++ b/pytest.ini @@ -8,3 +8,6 @@ markers = # Ignore setup and teardown for the timeout timeout_func_only = True + +filterwarnings = + error::yaml.YAMLLoadWarning diff --git a/script/config_collector.py b/script/config_collector.py index 73e18ae7062..6a87e13cb1d 100644 --- a/script/config_collector.py +++ b/script/config_collector.py @@ -45,7 +45,7 @@ def collect(beat_name, beat_path, full=False): # Load title from fields.yml with open(beat_path + "/fields.yml") as f: - fields = yaml.load(f.read()) + fields = yaml.load(f.read(), Loader=yaml.FullLoader) title = fields[0]["title"] # Check if short config was disabled in fields.yml diff --git a/winlogbeat/tests/system/winlogbeat.py b/winlogbeat/tests/system/winlogbeat.py index eb34445bcfe..4e297bb0c18 100644 --- a/winlogbeat/tests/system/winlogbeat.py +++ b/winlogbeat/tests/system/winlogbeat.py @@ -111,7 +111,7 @@ def read_events(self, config=None, expected_events=1): def read_registry(self, requireBookmark=False): f = open(os.path.join(self.working_dir, "data", ".winlogbeat.yml"), "r") - data = yaml.load(f) + data = yaml.load(f, Loader=yaml.FullLoader) self.assertIn("update_time", data) self.assertIn("event_logs", data)