If you are using Ruby on Rails 3.0.0 or higher (but not yet Rails 3.1), then you'll need my fork of encrypted_cookie_store that fixes it for Rails 3.
To install it:
gem install scottwb-encrypted_cookie_store
Then add to your bundler Gemfile:
gem 'scottwb-encrypted_cookie_store', :require => 'encrypted_cookie_store'
Then read the rest of the installation/configuration instructions.
Background
For Rails 2.3, the folks at Phusion created encrypted_cookie_store, which you'd install as a plugin, and it worked great. I used it for a long time.
However, they never updated it for Rails 3. That's where Ben Sales came in. He forked this project and made it work for Rails 3...in the pre-release days, that is. Ben did all the work to get it packaged up as a gem and updated it to work with Rails 3 railties and initializers.
Unfortunately, sometime between Rails 3.0.0.beta3 and 3.0.0.beta4, the layout of AbstractStore and CookieStore changed quite a bit, pushing a lot of the functionality out to Rack, and breaking the encrypted_cookie_store gem.
That's where I come in. I basically did the minimal amount of work required to get it to work with Rails 3.0 (tested on 3.0.0, 3.0.7, and 3.0.8.rc4), got all the specs working again, and created a new gem called 'scottwb-encrypted_session_cookie'.
It doesn't work in Rails 3.1, but I'll probably remedy that once Rails 3.1 officially releases. I'm also happy to accept patches if anyone else onces to tackle that.
This is a nice gem. Maybe some day I'll make a push to clean it up and lobby to have it as one of the packaged options that ships with Rails...
3 comments:
This was very helpful in understanding the basic concept of cookies and sessions.
People should get the basic concept out of this video before diving into detailed tutorial.
+x In the video he specifically called out that he protected his database in the code. And he has.... provided there are no 0-day vulnerabilities with the current version of mysql-r-e-s() and that he's using the current version. Which are the reasons he should be using prepared statements.
Good readingg
Post a Comment