Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by jarin on Monday January 28, 2013 @05:01PM
(#5130954)
Yep, there is a pretty easy way to do it. In your Gemfile, put:
Then when there's an update, run:
Edit: fixed the gem directive
[ Parent
| on HN ]
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by eggbrain on Monday January 28, 2013 @05:08PM
(#5130995)
That assumes you know about the vulnerability, though. If you aren't subscribed to an email group, you might not find out for some period of time. The majority of Rails programmers, or beginners even, aren't a part of these email groups, so they might leave vulnerable code up on their servers indefinitely -- not good.
It might be better to have a cronjob that nightly runs the bundle update command, then restart the server. But again, this depends on you being smart enough to realize this, which since we are talking about sane defaults, isn't something we might want to assume.
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by jarin on Monday January 28, 2013 @06:34PM
(#5131452)
It's probably a good idea to subscribe to rails-security.
https://groups.google.com/forum/?fromgroups#!forum/rubyonrai...
I probably wouldn't allow a production app to update itself without human intervention.
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by eggbrain on Monday January 28, 2013 @07:43PM
(#5131682)
The whole issue is that Rails has tried to package what's 'probably a good idea' into the framework by default for quite a while. Unless every guide ever tells you to subscribe to the rails-security group, only those 'in the know' will know to do so. What's better, to have access to these updates by default, or having half the Rails apps out there potentially being compromised?
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by jlogsdon on Monday January 28, 2013 @05:12PM
(#5131019)
You would really want to do
gem 'rails', '~>3.2.0`
otherwise you could get upgraded to '3.3' or '3.4' which is more likely to break something.
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by jarin on Monday January 28, 2013 @06:33PM
(#5131444)
Oops, fixed!
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by matthuggins on Monday January 28, 2013 @05:17PM
(#5131051)
This assumes you don't commit your app's Gemfile.lock into your repository, which you generally should.
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by navyrain on Monday January 28, 2013 @05:27PM
(#5131115)
No, bundle update rails will change your Gemfile.lock to the version of rails it upgrades to.
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by matthuggins on Monday January 28, 2013 @05:34PM
(#5131161)
You're right, my mistake. It's just a matter of running `bundle update rails` on your server as well as making the changes in your repository.
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by jarin on Monday January 28, 2013 @06:38PM
(#5131469)
As long as you're using a reasonably good deploy script (capistrano, moonshine, Heroku, etc) you shouldn't have to worry about updating gems on your server.
Most deploy scripts will look at your Gemfile.lock and update if necessary during the deploy (or just run bundle install every time, which won't give you a locked version error if your Gemfile.lock matches your Gemfile).
Re:Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3
by matthuggins on Tuesday January 29, 2013 @09:55AM
(#5134271)
Definitely, and that's the approach I personally would take. I think jarin was looking for a way to quickly update all his servers without having to redeploy for every app.