#25
Apr 30, 2007

SQL Injection

One of the most common security problems for dynamic sites is SQL Injection. Thankfully Rails does everything it can in solving this issue, but you still need to be aware of it.
Download (16.3 MB, 5:29)
alternative download for iPod & Apple TV (8.7 MB, 5:29)
# tasks_controller.rb
def index
  @tasks = Task.find(:all, :conditions => ["name LIKE ?", "%#{params[:query]}%"])
end

RSS Feed for Episode Comments 28 comments

1. InMan Apr 30, 2007 at 07:48

Thanks for another tip :)


2. Nobody Apr 30, 2007 at 15:44

God, I love this site.


3. Rebort Apr 30, 2007 at 16:21

Great tips.

Although it's not directly relevant to what you're talking about in this video, I'd be a little careful about telling folks they can trust sessions blindly, as those can be hijacked in a variety of ways.

See: http://en.wikipedia.org/wiki/Session_hijacking


4. Ryan Bates Apr 30, 2007 at 20:46

@Robort, good point! Thanks for bringing that up.

To clarify, in the screencast I was referring to the data inside the session, not the authenticity of it. Friday I'll be posting about cross site scripting which kind of goes along with this.


5. Nicolás Sanguinetti May 01, 2007 at 09:48

Nice 'cast, as always :)

There's a blog about securing RoR applications, http://www.rorsecurity.info/ which covers a wide range of topcis (from security within rails to securing √MySQL installation). HTH :)


6. Martin Kjems May 18, 2007 at 01:07

This is the best website on the entire planet.

Question:
Why is it that the percentage signs can not be arround the qustionmark in this statement but need to be in the second argument with the params[:query]?

Task.find(:all, :conditions=>["name LIKE ?", '%' + params[:query] + '%' ])

Thanks


7. Trevor Turk May 21, 2007 at 00:01

Is there any reason Rails shouldn't just escape the "params" and "cookies" hashes, no matter where you put them in your code?

That would mean "escaping" the conditions hash as a whole, which might be harder than escaping each value one by one.

Seems like a good idea to me, just because stuff is easier to understand when written the insecure way - to me at least.


8. 殊麒 Aug 12, 2007 at 20:20

非常感谢,可以有这么好的视频来了解和学习rails


9. Gary Dec 06, 2007 at 18:23

Thanks very much for the episodes and best wishse.

I learned a lot from here.


10. Cicero Jan 03, 2008 at 09:09

I like big tips and I can not lie!!!


11. Snailrails Feb 04, 2008 at 06:20

Here is a short informative post I wrote on SQL injections!
http://www.snailrails.com/2008/1/sql-injection


12. someone Dec 14, 2008 at 21:08

Great site - very useful - I love it. this episode rocks!


13. Tasyuta Feb 15, 2010 at 05:15

Thanks for blog!!!!Its very nice!!!


14. Tanyura Feb 20, 2010 at 06:34

Thank you! It is wonderful!


15. Arsyusha Feb 21, 2010 at 09:43

It is amazing! Thanks!


16. Marimyanka Feb 22, 2010 at 10:46

Very useful information!


17. Vlada Feb 23, 2010 at 07:27

this is just perfect!


18. Galka Feb 24, 2010 at 14:11

It is amazing! Thanks!


19. Irena Feb 26, 2010 at 13:31

Thanks for blog!!!!Its very nice!!!


20. Tonya Feb 27, 2010 at 09:43

I read it with the lot of pleasure! Thanks!


21. Gotya Mar 01, 2010 at 04:06

It is marvellous! I like it!


22. Ama Mar 02, 2010 at 02:44

Thanks! It is beautiful!!


23. Lidusha Mar 09, 2010 at 11:54

The blog is super! Thanks for it!


24. Ritusya Mar 10, 2010 at 11:53

Good matherial.


25. Nikusha Mar 11, 2010 at 07:07

I think i have same problem too


26. Egorka Mar 29, 2010 at 08:29

WOW, this is great!


27. Gennadich Mar 30, 2010 at 06:44

Thanks! :) The blog is super!


28. lan_chi Apr 05, 2010 at 18:15

I am coming.


29. Lekseyka Apr 06, 2010 at 05:47

Nice! This is lovely!


30. Oksanka Apr 07, 2010 at 13:38

I like it very much! :)


31. mobic May 03, 2010 at 12:22

Спасибо, за возможность скачать.


32. life experience degree Jul 14, 2010 at 02:50

Thanks for sharing..


33. p90x dvds Jul 16, 2010 at 06:42

Now beachbody begin! <a href="http://www.p90x-buying.com">P90X Extreme Home Fitness</a> System is the best choice for yourself when you want to have a strong but healthy body, the best place to begin is online shoping. Many Internet sites-such as http://www.p90x-buying.com, have competitive pricing($59.99) and free shipping as well. Even with the shipping cost, you could end up paying less than you would in a local store.


34. Now beachbody begin! <a href="http://www.p90x-buying.com">P90X Extreme Home Fitness</a> System is the best choice for yourself when you want to have a strong but healthy body, the best place to begin is online shoping. Many Internet sites-such as http://w Jul 20, 2010 at 23:02

Now beachbody begin! <a href="http://www.p90x-buying.com">P90X Extreme Home Fitness</a> System is the best choice for yourself when you want to have a strong but healthy body, the best place to begin is online shoping. Many Internet sites-such as http://www.p90x-buying.com, have competitive pricing($59.99) and free shipping as well. Even with the shipping cost, you could end up paying less than you would in a local store.


35. p90x dvds Jul 20, 2010 at 23:03

Now beachbody begin! [url=http://www.p90x-buying.com]P90X Extreme Home Fitness[/url] System is the best choice for yourself when you want to have a strong but healthy body, the best place to begin is online shoping. Many Internet sites-such as http://www.p90x-buying.com, have competitive pricing($59.99) and free shipping as well. Even with the shipping cost, you could end up paying less than you would in a local store.


36. tiffany notes Jul 30, 2010 at 02:27

Great site. This could probably have the refactoring tag added t it.


37. life experience deg Jul 31, 2010 at 00:43

Worth sharing this information. Good Work


38. life experience degree Aug 11, 2010 at 02:48

Thanks for sharing. i really appreciate it that you shared with us such a informative post..


39. free directory list Aug 11, 2010 at 22:06

It is marvellous! I like it!


40. free directory list Aug 11, 2010 at 22:06

It is marvellous! I like it!


41. free directory list Aug 11, 2010 at 22:06

It is marvellous! I like it!


42. cheap air jordans Aug 23, 2010 at 23:02

Useful and nice episode! High quality low price.It's fit for you. Thanks MattR for sharing that. And thanks Ryan for this great screencast.


43. louis vuitton shoes Aug 26, 2010 at 23:21

Thanks for sharing your article. I really enjoyed it. I put a link to my site to here so other people can read it. My readers have about the same interets


44. snow boots Aug 31, 2010 at 01:55

 in the screencast I was referring to the data inside the session, not the authenticity of it. Friday I'll be posting about cross site scripting which kind of goes along with this.


45. levis belts Sep 01, 2010 at 21:07

I agree with your Blog and I will be back to check it more in the future so please keep up your work. I love your content & the way that you write. It looks like you’ve been doing this for a while now, how long have you been blogging for?

Add your comment:

(SKIP THIS ONE)

(required)

(not shown)


(use pastie or gist for code)

sponsored by:
if you want to help:
required:
Get Quicktime Player
Give Back to Open Source