| layout | page |
|---|---|
| title | YAML Resources |
| group | listed_pages |
YAML (YAML Ain't Markup Language) has been a structured data format frequently used in of Ruby development for some time. It has many useful features that often go unnoticed. Its ability to store serialized objects has recently made much news in the form of very serious vulnerabilities in the Rails framework.
Let's explore ways of using YAML beyond a simple store of arrays and hashes of data, as well as the risks and benefits of doing so.
We will discuss YAML databases, configuration files, conversion into and from Ruby objects, incompatibilities between parsers (Syck and Psych) and the reasons for them, and some gotchas.
Some reference will be made to YAML libraries in Ruby and other languages. http://www.yaml.org/
In progress notes on the topic follow
YAML: YAML Ain't Markup Language
What It Is: YAML is a human friendly data serialization standard for all programming languages. {% endhighlight %}
- Symbols
- Classes
- JSON superset
Collections
Sequence
Mapping
Mapping-in-Sequence Shortcut
Sequence-in-Mapping Shortcut
Merge key
Basic Types
Strings
Indicators in Strings
Plain scalars
Null
Boolean
Integers
Integers as Map Keys
Floats
Time
Date
Blocks
Single ending newline
The '+' indicator
Three trailing newlines in literals
Extra trailing newlines with spaces
Folded Block in a Sequence
Aliases and Anchors
Documents
Trailing Document Separator
Leading Document Separator
YAML Header
YAML For Ruby
Symbols
Ranges
Regexps
Perl Regexps
Struct class
Nested Structs
Objects
Extending Kernel::Array
Extending Kernel::Hash
Ruby
- 1.8 : uses Syck
- 1.9 YAML == Psych, but can YAML::ENGINE.yamler = 'syck'
- 2.0 YAML == Psych, Syck removed from stlibi
{% highlight yaml %} defaults: &defaults adapter: mysql2 encoding: utf8 reconnect: false pool: 5 username: sqluser password: s3cret host: localhost
development: <<: *defaults database: app_development
test: &test <<: *defaults database: app_test
production: <<: *defaults username: productionsqluser password: productions3cret database: app_production {% endhighlight %}
-
[SEC][ANN] Rails 3.2.12, 3.1.11, and 2.3.17 have been released!
-
Multiple vulnerabilities in parameter parsing in Action Pack (CVE-2013-0156)
-
Metasploit Framework: Ruby on Rails XML Processor YAML Deserialization Scanner
-
Analysis of Rails XML Parameter Parsing Vulnerability and the commit that introduced it
- YAML Support and Hash Representer In representable-1.2.7!
- Putting YAML at the top of a Markdown file with Metadown
- YAML is terrible and should be driven from the face of the Earth.
- Psych 2.0
- Rails 4 uses Josh Peek's sprockets-rails 2 manifest files are now json, not yaml. In communication: JSON has better support in non-Ruby languages.
- How RubyGems.org patched Psych/Syck following the 2013 January attacks
- Rails Allow to_xml and from_xml to work with AR models that have serialized fields
- Psych: Strings that look like dates should be treated as strings and not dates.
- Fun with Syck and Psych on Heroku. This is one of those posts that's inspired by a desire never to have to investigate the same bug again.
- Psych-based yaml in Ruby 1.9.3 too slow
- Psych can't parse YML in RefineryCMS that syck can
- Delayed job 3.0.1 not working, breaks on to_yaml
- Convert Syck to Psych YAML format
- [Bug #3112] require "yaml" doesn't use psych as default
- [ruby-trunk - Feature #6163][Open] Remove syck YAML extension
- Removing Syck from ruby
- VCR: Request/Response data is saved to disk as YAML by default
- Parsing YAML 1.1 with Ruby
- Shaving A YAML Yak
- Force YAML to use syck rather than psych. Eventually delayed_job should be made compatible with both.
- work around the syck/psych confusion yaml brings to ruby 1.9.2 by trying to load psych before yaml
- SafeYAML: Support for custom deserializer?
- JRuby 1.9 problem with Syck
- Q&A