Skip to content

Commit 7179dcb

Browse files
authored
Merge pull request rails#42687 from NatMorcos/psych_4_load_secrets_with_aliases
unsafe_load secrets.yml with psych 4
2 parents ccb6657 + 0ebb708 commit 7179dcb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

railties/lib/rails/secrets.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ def parse(paths, env:)
2525
paths.each_with_object(Hash.new) do |path, all_secrets|
2626
require "erb"
2727

28-
secrets = YAML.load(ERB.new(preprocess(path)).result) || {}
28+
source = ERB.new(preprocess(path)).result
29+
secrets = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(source) : YAML.load(source)
30+
secrets ||= {}
31+
2932
all_secrets.merge!(secrets["shared"].deep_symbolize_keys) if secrets["shared"]
3033
all_secrets.merge!(secrets[env].deep_symbolize_keys) if secrets[env]
3134
end

0 commit comments

Comments
 (0)