diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-09-02 16:22:20 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-09-02 16:22:20 +0200 |
commit | ebfa43c423ac16bb699424d8d3db11855dd79a91 (patch) | |
tree | 66903b22083cdc07eb583bba2630d3855a6eda6c /activesupport/test | |
parent | 76797b443929005f43512a147e97f02f3145ed81 (diff) | |
download | rails-ebfa43c423ac16bb699424d8d3db11855dd79a91.tar.gz rails-ebfa43c423ac16bb699424d8d3db11855dd79a91.tar.bz2 rails-ebfa43c423ac16bb699424d8d3db11855dd79a91.zip |
Merge rexml-expansion-fix gem into activesupport.
Addresses the security issue documented at:
* http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 52ea5f9013..7a414e946f 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -839,6 +839,27 @@ class QueryTest < Test::Unit::TestCase :person => {:id => [20, 10]} end + def test_expansion_count_is_limited + assert_raises RuntimeError do + attack_xml = <<-EOT + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE member [ + <!ENTITY a "&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;"> + <!ENTITY b "&c;&c;&c;&c;&c;&c;&c;&c;&c;&c;"> + <!ENTITY c "&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;"> + <!ENTITY d "&e;&e;&e;&e;&e;&e;&e;&e;&e;&e;"> + <!ENTITY e "&f;&f;&f;&f;&f;&f;&f;&f;&f;&f;"> + <!ENTITY f "&g;&g;&g;&g;&g;&g;&g;&g;&g;&g;"> + <!ENTITY g "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"> + ]> + <member> + &a; + </member> + EOT + Hash.from_xml(attack_xml) + end + end + private def assert_query_equal(expected, actual, message = nil) assert_equal expected.split('&'), actual.to_query.split('&') |