Learn something new... every 30 minutes

Re: (newbie) Why doesn't this line work?
Every time I work on my app. I feel like I learn something new about every 30 minutes...
this time it was that the :confirm parameter on :link_to (which pops up a confirmation box when you click a link), is an HTML option and thus needs syntax like
delete, :id => @item.id}, {:confirm => 'Are you sure?'} %>

Dependant Destruction and the problems with Rails books

true anymore" href="http://weblog.rubyonrails.com/2006/04/28/associations-arent-dependent-true-anymore/">Riding Rails: Associations aren't :dependent => true anymore
Some useful info. about how :dependent works in rails 1.1+ . Handy if you've got items that are dependent on one another and want to get rid of the child objects when you delete the parent.
the other part of this post is a continuation of something I touched on before. Ruby on Rails is great but it really moves too fast for print books. This is a good example.
In my copy of Ruby on Rails: Up and running, the bit on cascading relationships says that you specify :dependent => :true , however that doesn't work (as I found out when I tried it), cue 10 minutes of searching around for the answer which led to the post above.
Now this is probably the most recent book published about RoR and I only got my copy about 3 weeks ago, but I've found more than a couple of areas which don't match up with my rails deployment and I'm not even using Edge rails!

XSRF example

Google Cross-site Request Forgery
Cross Site Request Forgery is one of those vulnerability classes that can be a bit tricky to explain, so it's always nice to find a decent live example. This one's pretty harmless, just changes your google languange preferences, but I reckon that we'll see a real growth in this kind of problem over the next couple of years as "the bad guys"(tm) keep looking for innovative new ways to attack web apps.

Fix for XSS problems wih in_place_edit

In_place_edit_for with validation and sanitization
I've started having a look at my little rails app. I'm writing with a security persons hat on and one of the problems I've run into is that you can't by default use the h() function with an in place edit control. So this link has a solution for that...
One quirk seemed to be when I put in the XSS code </span><script>alert("xss")</script><span> using in_place_edit it escapes it ok, but then each time I click into the field and then click ok it re-escapces the contents, giving an ever expanding field...
still main thing is it gets rid of the xss problem (well from a security point of view anyway)

Malware to defeat virtual keyboards

Banking Trojan Captures User's Screen in Video Clip
A good write-up and video of malware designed to capture information from users using virtual keyboards.
It's just another indication that banks and other E-Commerce sites will need to come up with something more robust if they really want to make phishing impractical for attackers...
Personally I'd be interested to try a combination of RSA SecureID and Intrusion detection/prevention.
It works like this. the SecureID forces an attacker to do an in-line attack 'cause they've only got a less than 60 second window to use the credentials successfully, and this should increase the visibility of the traffic patterns. For example if you've got 10 users who've always come from different UK based IP addresses in the past, and suddenly they're all coming from the same non-UK based ip address, then that could be a good time to block the session.
It would be difficult to tune, but I think once you'd baselined users it would be possible to build up a reasonable enough pattern to allow for some form of anomoly detection.