hoptoad_notifier 2.4.7 → 2.4.8
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/CHANGELOG +7 -0
- data/lib/hoptoad_notifier/notice.rb +5 -3
- data/lib/hoptoad_notifier/version.rb +1 -1
- data/test/recursion_test.rb +10 -0
- metadata +6 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
Version 2.4.8 - Mon Mar 21 11:11:16 -0400 2011
|
2
|
+
===============================================================================
|
3
|
+
|
4
|
+
Jonathan Yurek(1):
|
5
|
+
Prevent infinite loops from recursive data structures.
|
6
|
+
|
1
7
|
Version 2.4.7 - Thu Mar 10 16:21:31 -0500 2011
|
2
8
|
===============================================================================
|
3
9
|
|
@@ -416,5 +422,6 @@ Nick Quaranto (3):
|
|
416
422
|
|
417
423
|
|
418
424
|
|
425
|
+
|
419
426
|
|
420
427
|
|
@@ -226,14 +226,16 @@ module HoptoadNotifier
|
|
226
226
|
# Removes non-serializable data. Allowed data types are strings, arrays,
|
227
227
|
# and hashes. All other types are converted to strings.
|
228
228
|
# TODO: move this onto Hash
|
229
|
-
def clean_unserializable_data(data)
|
229
|
+
def clean_unserializable_data(data, stack = [])
|
230
|
+
return "[possible infinite recursion halted]" if stack.any?{|item| item == data.object_id }
|
231
|
+
|
230
232
|
if data.respond_to?(:to_hash)
|
231
233
|
data.to_hash.inject({}) do |result, (key, value)|
|
232
|
-
result.merge(key => clean_unserializable_data(value))
|
234
|
+
result.merge(key => clean_unserializable_data(value, stack + [data.object_id]))
|
233
235
|
end
|
234
236
|
elsif data.respond_to?(:to_ary)
|
235
237
|
data.collect do |value|
|
236
|
-
clean_unserializable_data(value)
|
238
|
+
clean_unserializable_data(value, stack + [data.object_id])
|
237
239
|
end
|
238
240
|
else
|
239
241
|
data.to_s
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class RecursionTest < Test::Unit::TestCase
|
4
|
+
should "not allow infinite recursion" do
|
5
|
+
hash = {:a => :a}
|
6
|
+
hash[:hash] = hash
|
7
|
+
notice = HoptoadNotifier::Notice.new(:parameters => hash)
|
8
|
+
assert_equal "[possible infinite recursion halted]", notice.parameters[:hash]
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoptoad_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 2.4.
|
9
|
+
- 8
|
10
|
+
version: 2.4.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- thoughtbot, inc
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-21 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- test/notifier_test.rb
|
171
171
|
- test/rack_test.rb
|
172
172
|
- test/rails_initializer_test.rb
|
173
|
+
- test/recursion_test.rb
|
173
174
|
- test/sender_test.rb
|
174
175
|
- test/user_informer_test.rb
|
175
176
|
- rails/init.rb
|
@@ -221,5 +222,6 @@ test_files:
|
|
221
222
|
- test/notifier_test.rb
|
222
223
|
- test/rack_test.rb
|
223
224
|
- test/rails_initializer_test.rb
|
225
|
+
- test/recursion_test.rb
|
224
226
|
- test/sender_test.rb
|
225
227
|
- test/user_informer_test.rb
|