Upon realizing that I had _not_ had taint mode on for awhile in a CGI app I was developing, I turned it back on and everything blew up. (as advertised, after all)
But as I resolved issues I would see data items pop up as tainted that I 'knew' were untainted when I created them.
As I processed CGI forms I would validate and untaint data items, and then accumulate them in my session hash. Later in other CGI invocations I'd try to use those bits of information and blow up with taint errors.
After putting in some debug displays I realized I was simply hitting the taint mode restriction on input data - anything read from a data file is tainted. (My CGI::Session options were 'driver:File;serializer:Storable' and so session data is stored in files)
I'm really puzzled as I can't find previous mentions of this issue, and can't believe the combination of CGI::Session session files and taint mode hasn't been done. I mean, gosh, doesn't everybody use taint mode?
Has anybody dealt with this problem? That is, somehow untainting the session data string read from a file (or database record for that matter), before CGI::Session then uses thaw() to recreate the session hash?
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.