-
A Rails Security Flaw – Destroying The Audit Trail
Recently Rails 2.3 was released, with a number of new features.
One of these was the ability to set the created_at/updated_at time-stamped columns manually. Now, why anybody would want to do this currently escapes me – but that aside, those columns are now attr_accessible.
This means that anybody can set them by manually editing the forms on your site, so you can’t trust them to be correct. Your audit trail is no longer valid.
Now, you may argue that it’s a simple matter of setting those columns to attr_protected in the models. However, how many people do you think will remember to do that? Especially when you’re upgrading pre 2.3 apps.
I’ve talked to the Rails core about this issue, but they’re reluctant to make created_at/updated_at attr_protected by default due to api compatibility problems.
In any case, you can fix it yourself by putting the following script in config/initializers:
-
How to disable IE6 in your Rails applications
Well, the uprising against IE 6 has begun, and not a moment too soon – IE 6 will be seven years old on August 27th. In fact, there’s even a service to say goodbye to the old dinosaur.
You can do your bit for the Internet by showing a warning to IE 6 users in your Rails applications, or disabling it completely for those users, encouraging them to upgrade their browsers (or nag the relevant Sys Admin).
Firstly you need to install the UserAgent plugin by Josh Peek:
script/plugin install git://github.com/josh/useragent.gitYou then need to copy this script to your lib directory.
If you want to just show a warning to people using unsupported browsers, you’ve got a valid_browser? helper method:
<%- unless valid_browser? -%> ... <%- end -%>Or you can disable access completely:
before_filter :restrict_browser
def restrict_browser
unless valid_browser?
render :action => '/path_to_template'
return false
end
end
-
Saasy – SaaS for Rails
I’ve been working on an open source SaaS solution for Rails over Christmas called Saasy (pronouced “sarrsy” – using a posh voice).
Saasy provides:
- Subscription management
- Recurring billing
- Credit card management
- User authentication and SSO
- Mailers for invoices etc
-
Saucy – use any font on your website
Fonts can be a developer’s nightmare if they’re not one of the ones installed on the user’s machine. There are alternatives such as sIFR and typeface.js but they’re quite resource intensive – we had to remove sIFR for that reason.
What some people end up doing is using images, cutting them up manually; quite a time intensive way of doing things. Saucy is Rails plugin developed by Jonah Fox to generate the text server side, using RMagick, so you can use any font you want.
<%= saucy_tag "h2 tag", :style => { :font => { :size => 100, :font => "bauhausl.ttf" } }, :tag => :h2, :html => {:id => "myid"} %>
I’ve recently been extending Saucy to support Sprites, so you can do rollover images easily. It’s as simple as this:
<%= saucy_tag("I am a red/blue sprite", :style => {:font => {:color => 'red'}}, :hover => {:font => {:color => 'blue'}} ) %>You can get Saucy here until Jonah merges the changes.
Next up is rounded corners (don’t even mention drop shadows) ;)
-
Ruby Manor
On Saturday I did a presentation at Ruby Manor on using recommendation systems in production featuring our plugin, acts as recommendable (AAR).
This was, without a doubt, the best conference I’ve been too – and the icing on the cake was the leftover £500 behind a students bar afterwards – ginger beers for everyone!
Graham Ashton has done a write up of all the talks and Chris Lowis has converted AAR to use the GNU scientific lib.
I was going to use Slideshare, but they seem to have broken it, so you can download a pdf of the presentation here (video will be up soon). The slides don’t make much sense by themselves though.
-
Metrotwin Recommends
We’ve been using our new Acts As Recommendable plugin on metrotwin.com and it’s been interesting to see how it’s performing in a real-world situation.
Bookmarks (places) are integral to Metrotwin, and a user can associate themselves with a bookmark by ‘Loving it’, saving it to their profile, or by stating they’ve been there.
So there was potentially a lot of information that could be collected about users preferences from their association with bookmarks. And that information could then be used to improve the overall experience, such as recommending bookmarks to people, and showing similar bookmarks – a great example of a practical application to Collective Intelligence.
-
Rails Conf Europe 08
Stuart and I were presenting at Rails Conf Europe last week in Berlin on a Rails plugin called Juggernaut which I’ve been working on for a few years now.
Juggernaut lets you do ‘Server Push‘, i.e. you can push data to the client from the server.During the presentation we showed a live chat application, with a real-time presence list of connected users.
We also demoed a real time map application, where users could show where they had traveled from to visit the conference in Berlin.

You can find the demo code for both applications here and here respectively. You can also find a PDF of the presentation here.
One of the other presentations I really enjoyed was Security on Rails by Jonathan Weiss (presentation here). He approaches security from an attacker’s perspective, which was a really effective way of getting the presentation across.
All things considered, it was an interesting conference – now for the dConstruct writeup…






