Taint.pm is a module that helps ensure that a user doesn't
pass your cgi script some input that can do bad things to
your server. For instance, if you accepted some input and
then did a system( $input ) where the input was 'rm -Rf /'
then you could have problems, even if you were running http's
as 'nobody' (OK, so this is a unix-centric answer )
I think it basically does string substitution to remove
potentially hazardous characters:
WWW::Taint.pm
#
# Utility routines for untainting strings. All three will accept
# a single scalar as argument, and return the same scalar back
# or undef if it flunks. It's possible to call untaint() directly
# and supply your own regexp, but probably better to extend the
# package with your own method if you really need it.
#
# the empty string returns an empty string (meaningless but untainted
# hence defined). Undef returns undef.
#
# the three flavors are slut(), easy() and saint().
#
# slut() always returns what you passed it. a string like
# "myfilename; cd /; rm -rf *" is totally cool. Needless to say,
# this should be used with extreme caution. Trusted files (like
# configuration files) and really ugly data (i.e. the comment lines
# in database references).
#
# easy() allows most chars but excludes things known to be hazardous to
# the shell, i.e. non-displayable chars, '&', ';' '`', '|' '>', '<'
#
# saint() allows only alphanumerics and '_', '-', '.', ':' and '/'.
# It's intended mostly for (unix) file paths.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.