Skip to content
代码片段 群组 项目
未验证 提交 d3f7dab0 编辑于 作者: Stan Hu's avatar Stan Hu
浏览文件

Use YAML.safe_load_file for import/export config

`YAML.load_file` in Psych v4, which is used by Ruby 3.1, defaults to
`YAML.safe_load_file` (https://github.com/ruby/psych/issues/533). This
change in behavior breaks the loading of the `import_export.yml` in
Ruby 3.1+ and up. Fix this by using `YAML.safe_load_file` with aliases
and symbols allowed.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/396231

Changelog: changed
上级 0598ba1f
No related branches found
No related tags found
无相关合并请求
......@@ -52,7 +52,7 @@ def merge_ee?
end
def parse_yaml
YAML.load_file(@config)
YAML.safe_load_file(@config, aliases: true, permitted_classes: [Symbol])
end
end
end
......
......@@ -177,7 +177,8 @@
end
def setup_yaml(hash)
allow(YAML).to receive(:load_file).with(test_config).and_return(hash)
allow(YAML).to receive(:safe_load_file)
.with(test_config, aliases: true, permitted_classes: [Symbol]).and_return(hash)
end
end
end
......
......@@ -9,7 +9,7 @@
include ConfigurationHelper
let(:all_models_yml) { 'spec/lib/gitlab/import_export/all_models.yml' }
let(:all_models_hash) { YAML.load_file(all_models_yml) }
let(:all_models_hash) { YAML.safe_load_file(all_models_yml, aliases: true) }
let(:current_models) { setup_models }
let(:model_names) { relation_names_for(:project) }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册