From f3e9ec6702795e9f1362e4ec0e6b02d3e5496b64 Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Thu, 16 Nov 2023 16:03:00 -0500 Subject: [PATCH] Use unsafe_load to load a test file with unpermitted classes Part of https://github.com/ManageIQ/manageiq/issues/22696 --- .../manageiq/providers/vmware/infra_manager/refresher_spec.rb | 2 +- spec/workers/event_catcher/event_parser_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/models/manageiq/providers/vmware/infra_manager/refresher_spec.rb b/spec/models/manageiq/providers/vmware/infra_manager/refresher_spec.rb index 012cc7c2f..e77af0fcf 100644 --- a/spec/models/manageiq/providers/vmware/infra_manager/refresher_spec.rb +++ b/spec/models/manageiq/providers/vmware/infra_manager/refresher_spec.rb @@ -606,7 +606,7 @@ def host_config_storage_device_stub(host) storage_device_yml = vcr_cassettes_dir.join(*described_class.name.underscore.split("::"), "host_storageDevice.yml") allow(host).to receive(:collect!) .with("config.storageDevice.hostBusAdapter", "config.storageDevice.scsiLun", "config.storageDevice.scsiTopology.adapter") - .and_return(YAML.load_file(storage_device_yml)) + .and_return(YAML.unsafe_load(File.read(storage_device_yml))) end def vm_power_off_object_update diff --git a/spec/workers/event_catcher/event_parser_spec.rb b/spec/workers/event_catcher/event_parser_spec.rb index 923496ec2..e0923bddb 100644 --- a/spec/workers/event_catcher/event_parser_spec.rb +++ b/spec/workers/event_catcher/event_parser_spec.rb @@ -80,7 +80,7 @@ private def load_event(event_name) - YAML.load_file(event_data_dir.join("#{event_name}.yml")) + YAML.unsafe_load(File.read(event_data_dir.join("#{event_name}.yml"))) end def event_data_dir