Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Is the force_untaint option in HTML::Template overkill?

by SilasTheMonk (Chaplain)
on Sep 14, 2008 at 00:39 UTC ( [id://711204]=perlquestion: print w/replies, xml ) Need Help??

SilasTheMonk has asked for the wisdom of the Perl Monks concerning the following question:

It's off by default and I turned it on by overriding load_tmpl in CGI::Application, on the principle that one better be safe than sorry. I am finding however that I am spending a lot of time untainting stuff that ought to be secure, just so I can out it into HTML::Template.
Update I have tried to reformulate this question here.
  • Comment on Is the force_untaint option in HTML::Template overkill?

Replies are listed 'Best First'.
Re: Is the force_untaint option in HTML::Template overkill?
by ww (Archbishop) on Sep 14, 2008 at 01:55 UTC
    If you're thinking of allowing unchecked user input in the belief that it will always be stuff that ought to be secure, I have a very nice bridge for sale...

    All too often, "stuff" (AKA, "user input") is NOT "secure" for values of "secure" which eq "safe to allow."

    And, by "spending a lot of time untainting" I'm guessing that you mean "writing code" as opposed to "spending" a lot of CPU time.

    If so, it's a one time cost that will be repaid the first time untainting saves your bacon (AKA, "site, reputation, or fortune").

      I am very happy with the answers, but I will offer a clarification just in case this produces a different answer - or at least a deeper answer. I am not casting doubt on the -T argument in perl. I absolutely see the point of that. I'll explain the example that is bugging me at the moment. In the form element I need to post back a $my_cgi->start_form() into the HTML::Template variable <TMPL_VAR NAME="form">. In HTML::Template I am using that module's force_untaint option and it is complaining about taint. Given that when the submit button is pressed, the arguments passed to the CGI script will be checked for taint, why do I need to check the HTML shown to the user for taint?
        why do I need to check the HTML shown to the user for taint?
        Same reason, security. From the docs:
        force_untaint - if set to 1 the module will not allow you to set unescaped parameters with tainted values. If set to 2 you will have to untaint all parameters, including ones with the escape attribute. This option makes sure you untaint everything so you don't accidentally introduce e.g. cross-site-scripting (CSS) vulnerabilities. Requires taint mode. Defaults to 0.
Re: Is the force_untaint option in HTML::Template overkill?
by sgifford (Prior) on Sep 14, 2008 at 01:47 UTC
    Taint mode is pretty smart. What is coming out tainted that ought to be secure?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://711204]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-26 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found