diff --git a/test/apps/rails3.1/app/models/product.rb b/test/apps/rails3.1/app/models/product.rb index c879ee1ed29159b0c77455aec9644e79a474ea9e..e8755435ea7603a1a2cc0e1cfaca6f7d454c229d 100644 --- a/test/apps/rails3.1/app/models/product.rb +++ b/test/apps/rails3.1/app/models/product.rb @@ -169,4 +169,8 @@ class Product < ActiveRecord::Base #Should not warn Product.last("blah = '#{params[:id].to_f}'") end + + def test_interpolation_in_first_arg + Product.where("x = #{params[:x]} AND y = ?", y) + end end diff --git a/test/tests/test_rails31.rb b/test/tests/test_rails31.rb index c3deaea2ff0c20b2a24a360575f03d6eb058cee3..3ea95faffa4ba78529b0bcafb0b7c2478575a9e7 100644 --- a/test/tests/test_rails31.rb +++ b/test/tests/test_rails31.rb @@ -15,7 +15,7 @@ class Rails31Tests < Test::Unit::TestCase :model => 0, :template => 4, :controller => 1, - :warning => 44 } + :warning => 45 } end def test_without_protection @@ -411,6 +411,15 @@ class Rails31Tests < Test::Unit::TestCase :file => /product\.rb/ end + def test_sql_injection_interpolation_in_first_arg + assert_warning :type => :warning, + :warning_type => "SQL Injection", + :line => 174, + :message => /^Possible\ SQL\ injection/, + :confidence => 0, + :file => /product\.rb/ + end + def test_select_vulnerability assert_warning :type => :template, :warning_type => "Cross Site Scripting",