safe_yaml 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +24 -4
- data/Gemfile +1 -0
- data/lib/safe_yaml/syck_resolver.rb +5 -3
- data/lib/safe_yaml/transform/to_float.rb +1 -1
- data/lib/safe_yaml/version.rb +1 -1
- data/spec/safe_yaml_spec.rb +21 -0
- data/spec/spec_helper.rb +3 -3
- metadata +22 -40
data/.travis.yml
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
language:
|
1
|
+
language:
|
2
|
+
ruby
|
3
|
+
|
2
4
|
before_install:
|
3
|
-
|
4
|
-
|
5
|
+
gem install bundler
|
6
|
+
|
7
|
+
script:
|
8
|
+
bundle exec rake spec
|
9
|
+
|
5
10
|
rvm:
|
6
11
|
- ruby-head
|
7
12
|
- 2.0.0
|
@@ -14,6 +19,11 @@ rvm:
|
|
14
19
|
- jruby-19mode
|
15
20
|
- jruby-18mode
|
16
21
|
- ree
|
22
|
+
|
23
|
+
env:
|
24
|
+
- YAMLER=syck
|
25
|
+
- YAMLER=psych
|
26
|
+
|
17
27
|
matrix:
|
18
28
|
allow_failures:
|
19
29
|
- rvm: ruby-head
|
@@ -22,4 +32,14 @@ matrix:
|
|
22
32
|
- rvm: jruby-head
|
23
33
|
- rvm: jruby-19mode
|
24
34
|
- rvm: jruby-18mode
|
25
|
-
- rvm: ree
|
35
|
+
- rvm: ree
|
36
|
+
|
37
|
+
exclude:
|
38
|
+
- rvm: 1.8.7
|
39
|
+
env: YAMLER=psych
|
40
|
+
- rvm: jruby-head
|
41
|
+
env: YAMLER=syck
|
42
|
+
- rvm: jruby-19mode
|
43
|
+
env: YAMLER=syck
|
44
|
+
- rvm: jruby-18mode
|
45
|
+
env: YAMLER=syck
|
data/Gemfile
CHANGED
@@ -22,13 +22,15 @@ module SafeYAML
|
|
22
22
|
|
23
23
|
# Take the "<<" key nodes first, as these are meant to approximate a form of inheritance.
|
24
24
|
inheritors = map.keys.select { |node| resolve_node(node) == "<<" }
|
25
|
-
inheritors.each do |
|
26
|
-
value_node = map
|
25
|
+
inheritors.each do |key_node|
|
26
|
+
value_node = map[key_node]
|
27
27
|
hash.merge!(resolve_node(value_node))
|
28
28
|
end
|
29
29
|
|
30
30
|
# All that's left should be normal (non-"<<") nodes.
|
31
|
-
map.
|
31
|
+
normal_keys = map.keys.reject { |node| resolve_node(node) == "<<" }
|
32
|
+
normal_keys.each do |key_node|
|
33
|
+
value_node = map[key_node]
|
32
34
|
hash[resolve_node(key_node)] = resolve_node(value_node)
|
33
35
|
end
|
34
36
|
|
data/lib/safe_yaml/version.rb
CHANGED
data/spec/safe_yaml_spec.rb
CHANGED
@@ -182,6 +182,27 @@ describe YAML do
|
|
182
182
|
}
|
183
183
|
end
|
184
184
|
end
|
185
|
+
|
186
|
+
it "works with multi-level inheritance" do
|
187
|
+
result = YAML.safe_load <<-YAML
|
188
|
+
defaults: &defaults
|
189
|
+
foo: foo
|
190
|
+
bar: bar
|
191
|
+
baz: baz
|
192
|
+
custom: &custom
|
193
|
+
<<: *defaults
|
194
|
+
bar: custom_bar
|
195
|
+
baz: custom_baz
|
196
|
+
grandcustom: &grandcustom
|
197
|
+
<<: *custom
|
198
|
+
YAML
|
199
|
+
|
200
|
+
result.should == {
|
201
|
+
"defaults" => { "foo" => "foo", "bar" => "bar", "baz" => "baz" },
|
202
|
+
"custom" => { "foo" => "foo", "bar" => "custom_bar", "baz" => "custom_baz" },
|
203
|
+
"grandcustom" => { "foo" => "foo", "bar" => "custom_bar", "baz" => "custom_baz" }
|
204
|
+
}
|
205
|
+
end
|
185
206
|
end
|
186
207
|
|
187
208
|
describe "unsafe_load_file" do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
HERE = File.dirname(__FILE__)
|
2
|
-
ROOT = File.join(HERE, "..")
|
1
|
+
HERE = File.dirname(__FILE__) unless defined?(HERE)
|
2
|
+
ROOT = File.join(HERE, "..") unless defined?(ROOT)
|
3
3
|
|
4
4
|
$LOAD_PATH << File.join(ROOT, "lib")
|
5
5
|
$LOAD_PATH << File.join(HERE, "support")
|
6
6
|
|
7
|
-
if ENV["YAMLER"]
|
7
|
+
if ENV["YAMLER"] && defined?(YAML::ENGINE)
|
8
8
|
require "yaml"
|
9
9
|
YAML::ENGINE.yamler = ENV["YAMLER"]
|
10
10
|
puts "Running specs in Ruby #{RUBY_VERSION} with '#{YAML::ENGINE.yamler}' YAML engine."
|
metadata
CHANGED
@@ -1,32 +1,23 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe_yaml
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 0
|
10
|
-
version: 0.7.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Dan Tao
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2013-02-08 00:00:00 Z
|
12
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
|
-
|
14
|
+
description: Parse YAML safely, without that pesky arbitrary object deserialization
|
15
|
+
vulnerability
|
22
16
|
email: daniel.tao@gmail.com
|
23
17
|
executables: []
|
24
|
-
|
25
18
|
extensions: []
|
26
|
-
|
27
19
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
files:
|
20
|
+
files:
|
30
21
|
- .gitignore
|
31
22
|
- .travis.yml
|
32
23
|
- Gemfile
|
@@ -61,41 +52,32 @@ files:
|
|
61
52
|
- spec/transform/to_symbol_spec.rb
|
62
53
|
- spec/transform/to_time_spec.rb
|
63
54
|
homepage: http://dtao.github.com/safe_yaml/
|
64
|
-
licenses:
|
55
|
+
licenses:
|
65
56
|
- MIT
|
66
57
|
post_install_message:
|
67
58
|
rdoc_options: []
|
68
|
-
|
69
|
-
require_paths:
|
59
|
+
require_paths:
|
70
60
|
- lib
|
71
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
62
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
hash: 57
|
77
|
-
segments:
|
78
|
-
- 1
|
79
|
-
- 8
|
80
|
-
- 7
|
63
|
+
requirements:
|
64
|
+
- - '>='
|
65
|
+
- !ruby/object:Gem::Version
|
81
66
|
version: 1.8.7
|
82
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
68
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
91
73
|
requirements: []
|
92
|
-
|
93
74
|
rubyforge_project:
|
94
75
|
rubygems_version: 1.8.25
|
95
76
|
signing_key:
|
96
77
|
specification_version: 3
|
97
|
-
summary: SameYAML provides an alternative implementation of YAML.load suitable for
|
98
|
-
|
78
|
+
summary: SameYAML provides an alternative implementation of YAML.load suitable for
|
79
|
+
accepting user input in Ruby applications.
|
80
|
+
test_files:
|
99
81
|
- spec/exploit.1.9.2.yaml
|
100
82
|
- spec/exploit.1.9.3.yaml
|
101
83
|
- spec/psych_handler_spec.rb
|