Skip to content

Commit

Permalink
unsafe_load secrets.yml with psych 4
Browse files Browse the repository at this point in the history
  • Loading branch information
NatMorcos committed Jul 3, 2021
1 parent 56d8ff8 commit 0ebb708
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion railties/lib/rails/secrets.rb
Expand Up @@ -25,7 +25,10 @@ def parse(paths, env:)
paths.each_with_object(Hash.new) do |path, all_secrets|
require "erb"

secrets = YAML.load(ERB.new(preprocess(path)).result) || {}
source = ERB.new(preprocess(path)).result
secrets = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(source) : YAML.load(source)
secrets ||= {}

all_secrets.merge!(secrets["shared"].deep_symbolize_keys) if secrets["shared"]
all_secrets.merge!(secrets[env].deep_symbolize_keys) if secrets[env]
end
Expand Down

0 comments on commit 0ebb708

Please sign in to comment.