Internet noise, route exceptions and unneeded sessions in Rails

| | Comments (0) | TrackBacks (0)

While I make myself at home in this newly installed MTOS backend (I know, the blog layout still looks the same... babysteps ;) ), I wanted to share this little trick that is maybe public domain but personally never realized until tonight...

As you know the Internet is a noisy place. Part of this noise is "visible", and is made by you and me, hyperjumping from one website to the other, leaving comments on site, writing our own blog, buying stuff on Amazon, searching google.
Most of the traffic on the net though goes unnoticed and is made by robots. Now there are good robots and bad robots. Good robots tends to behave so we're not concerned by them now; bad robots tend to either be there to spam, steal or hack into your website.
Usually there are pretty clever exploits to achieve these goals, but I find very enlightening to study even the magnitudo of damage they can bring just by being noisy.


Let me explain: it happens that I had a pretty old application that's been running fairly good for the last few months, out there in the wild, until the time, a few days ago, when it started receiving more and more traffic.
The traffic was of the "let-me-try-and-use-you-as-a-proxy" type, but even if that specific attack was blocked, an interesting side effect emerged: the session table (where temporary information about one interaction between the user and the site is kept) got quickly polluted and started growing at a scaring pace.

Now, if you're used to create web application, one of the basic tricks, together with caching the hell out of the website, is to disable all sort of unneded "user specific" data gathering. Here, for instance, there's a very good post on the topic, and on how to conditially enable sessions in parts of the site. What the post doesn't make clear (or not clear to me, that is) is that exceptions will still trigger the creation of a session. This happens, in other words, when the application can't map your request to an existing resource (action, file, image or other). Guess what, the spammy internet noise we mentioned earlier does exactly that.

If you're on Rails, one solution appears to be disabling session application-wide (even if you need them in all controllers) and then re-enable where needed. The post on Errtheblog has clear examples of how to do that.

Well, enough for this thursday night.
P.S.: MTOS indeed feels pretty sleek.

0 TrackBacks

Listed below are links to blogs that reference this entry: Internet noise, route exceptions and unneeded sessions in Rails.

TrackBack URL for this entry: http://bru.bzaar.net/mt/mt-tb.fcgi/791

Leave a comment

About this Entry

This page contains a single entry by Bru published on February 1, 2008 12:10 AM.

That time of the year, geeky presents and how google (apparently) ruined it all was the previous entry in this blog.

Time for spring cleaning - part I is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Recent Activity

Sunday

  • Bru tweeted, "@tomtaylor that's what non commercial CC is usually for :)"
  • Bru tweeted, "is cooking a chilli-lookalike something that reminds me of spaghetti western classics"
  • Bru posted ~sun
  • Bru tweeted, "looks like BSG s4 is going to be worth the effort, after all :)"
  • Bru tweeted, "@timd well obviously somebody capsized great britain overnight then, it's the simplest explanation :)"
  • Bru tweeted, "hacking #actionstreams, wondering if battlestar galactica s4 is going to be worth the effort, considering options for early lunch."
  • Bru tweeted, "there's some kind of massive display of special fx going on over London today: it looks like it's snowing, heavily. Go figure."

Saturday

  • Bru tweeted, "back from a day with oldoldold friends at Tate + Design Museum. Inspired."
  • Bru is watching London Geekdinner with David Terrar on Creativity at Knights Templar (public house)
  • Bru is watching Social Data Analysis Workshop at Florence, Italy
  • Bru is watching OpenSocial Hackathon at BT Centre - Business Showcase
  • Bru is watching Social Innovation Camp at The Young Foundation
  • Bru is watching H3: hardware hacking enthusiast's pubmeet 8 at Windmill (public house)
  • Bru is watching H3: Arduino + Flash workshop at London Knowledge Lab
  • Bru is watching BarCamp Amsterdam IV at Volkskrantgebouw
  • Bru is watching Twitterati Drinkup at O'Neill's Irish Pub
  • Bru tweeted, "woke up this morning to find out the internet monster ate up all my sites. feels like a new birth."
  • Bru saved the link Static pages for the enterprise

Friday

  • Bru tweeted, "had the best cheese cake in a long time"
  • Bru saved the link Scalr: auto scaling EC2

Pages

Powered by Movable Type 4.1