Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: proper untainting and use of ref

by jarich (Curate)
on Apr 18, 2002 at 02:04 UTC ( #160083=note: print w/replies, xml ) Need Help??


in reply to proper untainting and use of ref

#!perl -T use strict; # !!!IN DEVELOPMENT ONLY!!! use warnings; # !!!IN DEVELOPMENT ONLY!!!

Good Lord! If you remove strict and warnings once this is in development then your script maintainer might forget about good programming practices later and do terrible things! I'd recommend leaving them in, even in production code.

As for why you have to untaint $userfile before you're allowed to write to it, I think you might want to look at these two lines:

sub CONFIG() { '../data/conf/site.conf' } my $config = do( CONFIG );
If your ../data/conf/site.conf file contains insecure data or anything that taint ought to object to, this will fail. For example if your conf script returns "$ENV{PATH}/userdirectories" (as it's last line) then $config will be tainted and when combined with the previously clean $param{username} will taint $userfile.

It would be sensible to untaint $config data too, just in case it changes. :) Nice code overall though. :)

Jarich

Update: Just read your Update and realised that you're right, it's not your configuration data. Did a few more tests and have decided that the problem is with taint not liking precompiled regular expressions. It all works as you'd expect if you replace your expressions with ordinary regular expressions. Unfortunately this sort of ruins the point. Any other suggestions monks?

I also missed a question. Yes, that's a good use of ref.

Replies are listed 'Best First'.
Re: Re: proper untainting and use of ref
by jerrygarciuh (Curate) on Apr 18, 2002 at 02:21 UTC
    For further discussion of the use of the -w switch in production code see this node, or this one.
    HTH
    jg
    _____________________________________________________
    Think a race on a horse on a ball with a fish! TG

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://160083]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2020-04-06 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (36 votes). Check out past polls.

    Notices?