Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merges don't work in syck on ruby 2.2 with strict safety #81

Open
ccutrer opened this issue Dec 16, 2015 · 1 comment
Open

merges don't work in syck on ruby 2.2 with strict safety #81

ccutrer opened this issue Dec 16, 2015 · 1 comment

Comments

@ccutrer
Copy link

ccutrer commented Dec 16, 2015

ruby 2.2.3, syck 1.0.4

require 'yaml'
require 'syck'
require 'safe_yaml'

yaml = <<-YAML
common: &common
  adapter: postgresql

development:
 <<: *common
YAML

SafeYAML::OPTIONS[:default_mode] = :safe

YAML.load(yaml) # => {"common"=>{"adapter"=>"postgresql"}, "development"=>{"adapter"=>"postgresql"}}, as expected

SafeYAML::OPTIONS[:raise_on_unknown_tag] = true
YAML.load(yaml) # RuntimeError: Unknown YAML tag 'tag:yaml.org,2002:merge'
@ccutrer
Copy link
Author

ccutrer commented Dec 16, 2015

Oh, and to continue:

SafeYAML::OPTIONS[:whitelisted_tags] = ['tag:yaml.org,2002:merge']
YAML.load(yaml) # => {"common"=>{"adapter"=>"postgresql"}, "development"=>{#<Syck::MergeKey:0x007f89aaa379c0>=>{"adapter"=>"postgresql"}}}

ccutrer added a commit to instructure/canvas-lms that referenced this issue Dec 18, 2015
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant