whitelist Date on yaml load of configuration

fix/whitelist_date_on_config_yaml_load
ulferts 3 years ago
parent d1b3181611
commit d906d0769a
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 8
      lib/open_project/configuration.rb

@ -478,7 +478,7 @@ module OpenProject
# To specify specific values, one can use !!str (-> '') or !!null (-> nil)
return original_value if original_value == ''
parsed = YAML.load(original_value)
parsed = load_yaml(original_value)
if parsed.is_a?(String)
original_value
@ -491,7 +491,7 @@ module OpenProject
def load_config_from_file(filename, env, config)
if File.file?(filename)
file_config = YAML::load(ERB.new(File.read(filename)).result)
file_config = load_yaml(ERB.new(File.read(filename)).result)
if file_config.is_a? Hash
config.deep_merge!(load_env_from_config(file_config, env))
else
@ -580,6 +580,10 @@ module OpenProject
end
end
end
def load_yaml(source)
YAML::safe_load(source, permitted_classes: [Symbol, Date])
end
end
end
end

Loading…
Cancel
Save