By Chad Perrin, Special to ZDNet Asia Tuesday, December 16, 2008 12:43 PM
Sanitizing user input is a critical part of software development, but code can be made more secure by avoiding having to sanitize input altogether. Recently, I finished some work on a small development project for a new client. Thanks to that, I found myself in a frame of mind that gave me the urge to write more code and turned that to good use by finally getting to work on the long neglected task of writing a new contact page back end for my professional Web site. I had a contact page there, of course, but it was essentially an ugly hack of a contact page back end I had written in PHP for a completely different Web site a few years ago. Worse, it bore no resemblance to the rest of the site, and I had not bothered to give it a navigation element (i.e., what users tend to call a "menu"). The back end for this contact page would be written in Ruby, of course. I wrote out a rather pretty script, if I do say so myself, that made use of the TMail library, a tool that abstracts away a lot of the behind-the-scenes drudgery of specifying e-mail headers and content and preparing it for transmission using SMTP (Simple Mail Transfer Protocol). I wrote it such that it would work equally well from the browser and the command line. Then, I tested it. Read more » |