Bug #30079
closed
Searching for just "composite" in content views page causes ISE
Added by John Mitsch about 4 years ago.
Updated almost 4 years ago.
Description
To reproduce:
- Navigate to /content_views
- search for just "composite"
- Check server logs
This isn't a huge deal now but will be if/when we add automatic searching on keystroke.
Related issues
1 (1 open — 0 closed)
- Triaged changed from No to Yes
- Target version changed from Katello 4.0.0 to Katello 3.17.0
Example production log:
16:25:04 rails.1 | 2020-08-07T16:25:04 [I|app|27d751bf] Started GET "/katello/api/v2/content_views?nondefault=true&organization_id=1&page=1&paged=true&per_page=20&search=+composite+&sort_by=name&sort_order=ASC" for 127.0.0.1 at 2020-08-07 16:25:04 +0000
16:25:05 rails.1 | 2020-08-07T16:25:05 [I|app|27d751bf] Processing by Katello::Api::V2::ContentViewsController#index as HTML
16:25:05 rails.1 | 2020-08-07T16:25:05 [I|app|27d751bf] Parameters: {"nondefault"=>"true", "organization_id"=>"1", "page"=>"1", "paged"=>"true", "per_page"=>"20", "search"=>" composite ", "sort_by"=>"name", "sort_order"=>"ASC", "api_version"=>"v2"}
16:25:05 rails.1 | 2020-08-07T16:25:05 [E|app|27d751bf] ActiveRecord::PreparedStatementInvalid: wrong number of bind variables (0 for 1) in: (["(\"katello_content_views\".\"composite\" <> ?)", false])
16:25:05 rails.1 | 27d751bf | /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/sanitization.rb:209:in `raise_if_bind_arity_mismatch'
16:25:05 rails.1 | 27d751bf | /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/sanitization.rb:166:in `replace_bind_variables'
16:25:05 rails.1 | 27d751bf | /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/sanitization.rb:129:in `sanitize_sql_array'
16:25:05 rails.1 | 27d751bf | /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/sanitization.rb:26:in `sanitize_sql_for_conditions'
16:25:05 rails.1 | 27d751bf | /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/relation/where_clause_factory.rb:14:in `build'
16:25:05 rails.1 | 27d751bf | /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/relation/query_methods.rb:656:in `where!'
16:25:05 rails.1 | 27d751bf | /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activerecord-6.0.3.2/lib/active_record/relation/query_methods.rb:649:in `where'
16:25:05 rails.1 | 27d751bf | /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/scoped_search-4.1.8/lib/scoped_search/definition.rb:329:in `block in register_named_scope!'
16:25:05 rails.1 | 27d751bf | /home/vagrant/projects/katello/app/controllers/katello/api/v2/api_controller.rb:81:in `scoped_search'
16:25:05 rails.1 | 27d751bf | /home/vagrant/projects/katello/app/controllers/katello/api/v2/content_views_controller.rb:46:in `index'
This appears to also affect searches for similar Boolean fields in the foreman project.
For example, /users?search=disabled&page=1 will also trigger an ISE.
This appears to be a defect in the scoped_search gem.
- Status changed from New to Ready For Testing
- Assignee set to James Jeffers
- Pull request https://github.com/Katello/katello/pull/8913 added
- Fixed in Releases Katello 4.0.0 added
- Status changed from Ready For Testing to Closed
Also available in: Atom
PDF