Live data from Hacker News

SQL Injection Vulnerability in Ruby on Rails; affects all versions

groups.google.com

1–10 of 220 posts

Re: SQL Injection Vulnerability in Ruby on Rails; affects all versions

#2
FWIW, this is the third time in seven months that Rails had to issue a patch related to how ActiveRecord handles method parameters.

3.2.6 (June 2012) https://groups.google.com/forum/?fromgroups=#!topic/rubyonra...

3.2.4 (May 2012) https://groups.google.com/forum/?fromgroups=#!topic/rubyonra...

Re: SQL Injection Vulnerability in Ruby on Rails; affects all versions

#5
I am mostly a Django programmer so excuse my ignorance of rails. How does this keep happening?

In Django you would do:

Post.objects.get(pk=request.GET['id'])

There really is no way to do SQL injection this way.

This line in rails looks almost exactly like how you would do it in Django:

Post.find_by_id(params[:id])

Also this seems really serious. It's not like a edge case where you need to grab a post by id. This is probably a very common use case of that method find_by_id.

Re: SQL Injection Vulnerability in Ruby on Rails; affects all versions

#8
post #5

I am mostly a Django programmer so excuse my ignorance of rails. How does this keep happening? In Django you would do: Post.objects.get(pk=request.GET['id']) There really is no way to do SQL injection this way. This line in rails looks almost exactly like how you would do it in Django: Post.find_by_id(params[:id]) Also this seems really serious. It's not like a edge case where you need to grab a post by id. This is p…

Btw, this applies for my (Python) Flask apps using MongoDB ORMs. They escape the inputs.

What the hell is going on with ActiveRecord?

Re: SQL Injection Vulnerability in Ruby on Rails; affects all versions

#9

For someone just learning RoR and having installed it via http://railsinstaller.org/ , how should I upgrade?

It should be as easy as 'gem update rails' at your command line (Terminal window).

If you're just learning and creating an app for your own edification, this is not really an issue that will affect you. That is, it doesn't affect how you construct the app, so if for some reason the gem update process doesn't work, you won't be hindered from using RoR.

Re: SQL Injection Vulnerability in Ruby on Rails; affects all versions

#10
Im not a RoR developer, so forgive my ignorance. But how does this keep happening? I thought ActiveRecord is a mature product by now. I hear about these types of bugs happening with RoR pretty often, is the "magic" of ActiveRecord and hiding SQL from the developer really worth it? I wonder how many RoR developers even understand what SQL injection actually means.
Post reply on HN