1. Computing

Discuss in my forum

Sanitizing and Untainting

By , About.com Guide

See More About

If you can verify that the string from user input is safe, or can remove the offending parts, you can untaint the object. The following method will remove any characters other than lowercase letters, untaint the string and return it. It can then be safely passed to the safe_resize method without fear of mischief.

 def sanitize_input(string)
   safe_string = string.gsub(/[^a-z]/, '')
   safe_string.untaint
   return safe_string
 end
 
  1. About.com
  2. Computing
  3. Ruby
  4. Advanced Ruby
  5. Sanitizing and Untainting

©2013 About.com. All rights reserved.