Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to secure a Rails app against Firesheep?
    primarykey
    data
    text
    <p>I have not been able to find an easy guide for securing a Ruby on Rails app against a <a href="http://codebutler.com/firesheep" rel="nofollow noreferrer">Firesheep</a>.</p> <p>In case you don't know, Firesheep jacks session cookies if your app doesn't force SSL and set the secure flag in the cookie. I had to do some searching to find these two things, so I thought I'd post what I found here and see if there is anything else I'm missing.</p> <p><strong>Step 1</strong> Force SSL</p> <p>There are two ways to do this that I found. One is using the <a href="https://github.com/rails/ssl_requirement" rel="nofollow noreferrer">ssl_requirement</a> plugin, but this is a pain because you have to specifically specify <code>ssl_required :action1, :action2</code> in every controller.</p> <p>The preferable way appears to be by using Rack Middleware, via this post: <a href="https://stackoverflow.com/questions/3861772/force-ssl-using-ssl-requirement-in-rails-app/3862679#3862679">Force SSL using ssl_requirement in Rails 2 app</a>. Works like a charm.</p> <p><strong>Step 2</strong> Make cookies secure</p> <p>For this I followed <a href="http://www.kalzumeus.com/2010/10/25/how-to-use-ssl-to-secure-your-rails-app-against-firesheep-and-other-evils/" rel="nofollow noreferrer">these directions</a>, which tell you to put the following in your <code>config/environment/production.rb</code> file:</p> <pre><code>config.action_controller.session = { :key =&gt; 'name_of_session_goes_here', :secret =&gt; 'you need to fill in a fairly long secret here and obviously do not copy paste this one', :expire_after =&gt; 14 * 24 * 3600, #I keep folks logged in for two weeks :secure =&gt; true #The session will now not be sent or received on HTTP requests. } </code></pre> <p>This was all pretty straight-forward on my Rails 2.x app. Did I miss anything? Is it different for Rails 3?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload