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:

See also:

  • No similar posts

About the author

Leave a comment

Our latest tweets

Categories

Recent comments

  • Joseph Kingsbury, Text 100: Isaac, interesting take on this, your honesty is refreshing. clearly nobody wants to listen to peopl...
  • Gary Moneysmith: I was @ the SXSW keynote presentation with Ev Williams and had to leave after 40-minutes. I left a ...
  • Isaac Pinnock: Thanks for the comment Sara - all points very well made. Not wanting to be held accountable is an i...
  • Sara: Thanks for the post. I find this really interesting as a media student. While not at sxsw, I frequen...
  • David: I like this app and agree that it seems to be accurate. Where I differ from Justin is that it actual...