Skip to content

Commit

Permalink
fix merge constructs with safe_yaml
Browse files Browse the repository at this point in the history
see dtao/safe_yaml#81 and
dtao/safe_yaml#82

test plan:
 * have a merge construct in your database.yml
 * canvas should boot

Change-Id: Ie5ca4dfac5d9fe4e62ad89474a2eb7d84feae02c
Reviewed-on: https://gerrit.instructure.com/69083
Tested-by: Jenkins
Reviewed-by: Simon Williams <[email protected]>
Product-Review: August Thornton <[email protected]>
QA-Review: August Thornton <[email protected]>
  • Loading branch information
ccutrer committed Dec 18, 2015
1 parent 8b923c3 commit a582434
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,18 @@ def postgresql_connection(config) # :nodoc:
val.constantize
end

trusted_tags = SafeYAML::TRUSTED_TAGS.dup
trusted_tags << 'tag:yaml.org,2002:merge'
SafeYAML.send(:remove_const, :TRUSTED_TAGS)
SafeYAML.const_set(:TRUSTED_TAGS, trusted_tags.freeze)
module FixSafeYAMLNullMerge
def merge_into_hash(hash, array)
return unless array
super
end
end
SafeYAML::Resolver.prepend(FixSafeYAMLNullMerge)

SafeYAML::OPTIONS.merge!(
default_mode: :safe,
deserialize_symbols: true,
Expand All @@ -198,7 +210,6 @@ def postgresql_connection(config) # :nodoc:
whitelisted_tags: %w[
tag:ruby.yaml.org,2002:symbol
tag:yaml.org,2002:float
tag:yaml.org,2002:merge
tag:yaml.org,2002:str
tag:yaml.org,2002:timestamp
tag:yaml.org,2002:timestamp#iso8601
Expand Down

0 comments on commit a582434

Please sign in to comment.