nori 2.0.0 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,19 @@
1
- # 2.0 (2012-12-12)
1
+
2
+ # 2.0.3 (2013-01-10)
3
+
4
+ * Fix for remote code execution bug. For more in-depth information, read about the
5
+ recent [Rails hotfix](https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/61bkgvnSGTQ).
6
+ Please make sure to upgrade now!
7
+
8
+ # 2.0.2 (YANKED)
9
+
10
+ * Yanked because of a problem with XML that starts with an instruction tag.
11
+
12
+ # 2.0.1 (YANKED)
13
+
14
+ * Yanked because of a problem with XML that starts with an instruction tag.
15
+
16
+ # 2.0.0 (2012-12-12)
2
17
 
3
18
  Please make sure to read the updated README for how to use the new version.
4
19
 
@@ -100,7 +115,7 @@ Please make sure to read the updated README for how to use the new version.
100
115
 
101
116
  ## 0.2.1 (2011-05-15)
102
117
 
103
- * Fix: Changed XML attributes converted to Hash keys to be prefixed with an @-sign.
118
+ * Fix: Changed XML attributes converted to Hash keys to be prefixed with an @-sign.
104
119
  This avoids problems with attributes and child nodes having the same name.
105
120
 
106
121
  <multiRef id="id1">
@@ -1,5 +1,5 @@
1
1
  class Nori
2
2
 
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.3"
4
4
 
5
5
  end
@@ -77,9 +77,7 @@ class Nori
77
77
  self.typecasts["decimal"] = lambda { |v| v.nil? ? nil : BigDecimal(v.to_s) }
78
78
  self.typecasts["double"] = lambda { |v| v.nil? ? nil : v.to_f }
79
79
  self.typecasts["float"] = lambda { |v| v.nil? ? nil : v.to_f }
80
- self.typecasts["symbol"] = lambda { |v| v.nil? ? nil : v.to_sym }
81
80
  self.typecasts["string"] = lambda { |v| v.to_s }
82
- self.typecasts["yaml"] = lambda { |v| v.nil? ? nil : YAML.load(v) }
83
81
  self.typecasts["base64Binary"] = lambda { |v| v.unpack('m').first }
84
82
 
85
83
  self.available_typecasts = self.typecasts.keys
@@ -72,7 +72,7 @@ describe Nori do
72
72
  # parsers are loaded lazily by default
73
73
  require "nori/parser/nokogiri"
74
74
 
75
- Nori::Parser::Nokogiri.should_receive(:parse).once
75
+ Nori::Parser::Nokogiri.should_receive(:parse).and_return({})
76
76
  nori.parse("<any>thing</any>")
77
77
  end
78
78
 
@@ -96,7 +96,7 @@ describe Nori do
96
96
  # parsers are loaded lazily by default
97
97
  require "nori/parser/rexml"
98
98
 
99
- Nori::Parser::REXML.should_receive(:parse).once
99
+ Nori::Parser::REXML.should_receive(:parse).and_return({})
100
100
  nori(:parser => :rexml).parse("<any>thing</any>")
101
101
  end
102
102
  end
@@ -348,7 +348,8 @@ describe Nori do
348
348
  'approved' => nil,
349
349
  'written_on' => nil,
350
350
  'viewed_at' => nil,
351
- 'content' => nil,
351
+ # don't execute arbitary YAML code
352
+ 'content' => { "@type" => "yaml" },
352
353
  'parent_id' => nil,
353
354
  'nil_true' => nil,
354
355
  'namespaced' => nil
@@ -367,7 +368,7 @@ describe Nori do
367
368
  <replies-close-in type="integer">2592000000</replies-close-in>
368
369
  <written-on type="date">2003-07-16</written-on>
369
370
  <viewed-at type="datetime">2003-07-16T09:28:00+0000</viewed-at>
370
- <content type="yaml">--- \n1: should be an integer\n:message: Have a nice day\narray: \n- should-have-dashes: true\n should_have_underscores: true\n</content>
371
+ <content type="yaml">--- \n1: should be an integer\n:message: Have a nice day\narray: \n- should-have-dashes: true\n should_have_underscores: true</content>
371
372
  <author-email-address>david@loudthinking.com</author-email-address>
372
373
  <parent-id></parent-id>
373
374
  <ad-revenue type="decimal">1.5</ad-revenue>
@@ -388,12 +389,13 @@ describe Nori do
388
389
  # Changed this line where the key is :message. The yaml specifies this as a symbol, and who am I to change what you specify
389
390
  # The line in ActiveSupport is
390
391
  # 'content' => { 'message' => "Have a nice day", 1 => "should be an integer", "array" => [{ "should-have-dashes" => true, "should_have_underscores" => true }] },
391
- 'content' => { :message => "Have a nice day", 1 => "should be an integer", "array" => [{ "should-have-dashes" => true, "should_have_underscores" => true }] },
392
+ 'content' => "--- \n1: should be an integer\n:message: Have a nice day\narray: \n- should-have-dashes: true\n should_have_underscores: true",
392
393
  'author_email_address' => "david@loudthinking.com",
393
394
  'parent_id' => nil,
394
395
  'ad_revenue' => BigDecimal("1.50"),
395
396
  'optimum_viewing_angle' => 135.0,
396
- 'resident' => :yes
397
+ # don't create symbols from arbitary remote code
398
+ 'resident' => "yes"
397
399
  }
398
400
 
399
401
  parse(topic_xml)["topic"].each do |k,v|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nori
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-12-12 00:00:00.000000000 Z
14
+ date: 2013-01-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: 378604752016210991
112
+ hash: 3728758796378487229
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
@@ -118,10 +118,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: 378604752016210991
121
+ hash: 3728758796378487229
122
122
  requirements: []
123
123
  rubyforge_project: nori
124
- rubygems_version: 1.8.23
124
+ rubygems_version: 1.8.24
125
125
  signing_key:
126
126
  specification_version: 3
127
127
  summary: XML to Hash translator