New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NokogiriSAXEngineTest#test_exception_thrown_on_expansion_attack fails with nokogiri v1.11.0 native gems #41015
Comments
It does not reproduce with nokogiri without native gems. Steps NOT to reproducegit clone https://github.com/rails/rails.git
cd rails
bundle install # to use rubygems described in Gemfile.lock
bundle info nokogiri
cd activesupport
bin/test test/xml_mini/libxmlsax_engine_test.rb test/xml_mini/nokogirisax_engine_test.rb --seed 30319 -n "/^(?:LibXMLSAXEngineTest#(?:test_blank_returns_empty_hash)|NokogiriSAXEngineTest#(?:test_exception_thrown_on_expansion_attack))$/" Result$ bundle info nokogiri
* nokogiri (1.10.10)
Summary: Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser
Homepage: https://nokogiri.org
Documentation: https://nokogiri.org/rdoc/index.html
Source Code: https://github.com/sparklemotion/nokogiri
Changelog: https://nokogiri.org/CHANGELOG.html
Bug Tracker: https://github.com/sparklemotion/nokogiri/issues
Path: /home/yahonda/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/nokogiri-1.10.10
$ cd activesupport
$ bin/test test/xml_mini/libxmlsax_engine_test.rb test/xml_mini/nokogirisax_engine_test.rb --seed 30319 -n "/^(?:LibXMLSAXEngineTest#(?:test_blank_returns_empty_hash)|NokogiriSAXEngineTest#(?:test_exception_thrown_on_expansion_attack))$/"
Run options: --seed 30319 -n "/^(?:LibXMLSAXEngineTest#(?:test_blank_returns_empty_hash)|NokogiriSAXEngineTest#(?:test_exception_thrown_on_expansion_attack))$/"
# Running:
..
Finished in 0.202464s, 9.8783 runs/s, 14.8174 assertions/s.
2 runs, 3 assertions, 0 failures, 0 errors, 0 skips
$ It may be related to the OS environment because it is a native gem.
|
Also it does not reproduce with nokogiri v1.11.0 on macOS native gem. * nokogiri (1.11.0)
Summary: Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
Homepage: https://nokogiri.org
Documentation: https://nokogiri.org/rdoc/index.html
Source Code: https://github.com/sparklemotion/nokogiri
Changelog: https://nokogiri.org/CHANGELOG.html
Bug Tracker: https://github.com/sparklemotion/nokogiri/issues
Path: /Users/yahonda/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/nokogiri-1.11.0-x86_64-darwin
Run options: --seed 30319 -n "/^(?:LibXMLSAXEngineTest#(?:test_blank_returns_empty_hash)|NokogiriSAXEngineTest#(?:test_exception_thrown_on_expansion_attack))$/"
# Running:
..
Finished in 0.016421s, 121.7953 runs/s, 182.6929 assertions/s.
2 runs, 3 assertions, 0 failures, 0 errors, 0 skips
% bin/test test/xml_mini/libxmlsax_engine_test.rb test/xml_mini/nokogirisax_engine_test.rb --seed 30319 -n "/^(?:LibXMLSAXEngineTest#(?:test_blank_returns_empty_hash)|NokogiriSAXEngineTest#(?:test_exception_thrown_on_expansion_attack))$/"
Run options: --seed 30319 -n "/^(?:LibXMLSAXEngineTest#(?:test_blank_returns_empty_hash)|NokogiriSAXEngineTest#(?:test_exception_thrown_on_expansion_attack))$/"
# Running:
..
Finished in 0.016628s, 120.2790 runs/s, 180.4186 assertions/s.
2 runs, 3 assertions, 0 failures, 0 errors, 0 skips
% ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20] |
I think we may need to open an issue at https://github.com/sparklemotion/nokogiri with minimum steps. but have not created it yet. |
#41017 should workaround this failure. |
We can open an issue and point to this at issue / the rails tests. If the gem is going to cause other apps to fail then it'd be best to get that information out earlier rather than later. |
Thanks for the advice. Sure. Let me open an issue at nokogiri. |
Opened sparklemotion/nokogiri#2168 |
Will take a look today, notes will be at sparklemotion/nokogiri#2168. |
Yeah, OK, I understand what's going on. Give me a few hours and I'll have a writeup and some PRs. |
OK, I've got a PR to Nokogiri running through CI now: If it goes green, I'll ship it in v1.11.1 within a few hours. |
Nokogiri v1.11.1 has been shipped with a fix. |
Confirmed nokogiri-1.11.1 address this failure. $ bundle info nokogiri
* nokogiri (1.11.1)
Summary: Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
Homepage: https://nokogiri.org
Documentation: https://nokogiri.org/rdoc/index.html
Source Code: https://github.com/sparklemotion/nokogiri
Changelog: https://nokogiri.org/CHANGELOG.html
Bug Tracker: https://github.com/sparklemotion/nokogiri/issues
Path: /home/yahonda/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/nokogiri-1.11.1-x86_64-linux
yahonda@myryzen:~/src/github.com/rails/rails$ cd activesupport
yahonda@myryzen:~/src/github.com/rails/rails/activesupport$ bin/test test/xml_mini/libxmlsax_engine_test.rb test/xml_mini/nokogirisax_engine_test.rb --seed 30319 -n "/^(?:LibXMLSAXEngineTest#(?:test_blank_returns_empty_hash)|NokogiriSAXEngineTest#(?:test_exception_thrown_on_expansion_attack))$/"
Run options: --seed 30319 -n "/^(?:LibXMLSAXEngineTest#(?:test_blank_returns_empty_hash)|NokogiriSAXEngineTest#(?:test_exception_thrown_on_expansion_attack))$/"
# Running:
..
Finished in 0.203437s, 9.8311 runs/s, 14.7466 assertions/s.
2 runs, 3 assertions, 0 failures, 0 errors, 0 skips
$ |
Thanks for the fix. Closing this issue. |
Thanks for the quick fix and detailed investigation @flavorjones! |
Managed to reproduce
NokogiriSAXEngineTest#test_exception_thrown_on_expansion_attack
failure since https://buildkite.com/rails/rails/builds/73847#8a8b56c0-ebdf-4a34-8072-62b688412970Steps to reproduce
Expected behavior
It should pass.
Actual behavior
It always fails.
System configuration
Rails version:master branch
Ruby version:ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
It also reproduces with Ruby 2.7.2, 2.6.6 and 2.5.8.
The text was updated successfully, but these errors were encountered: