Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!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.


In reply to Re: proper untainting and use of ref by jarich
in thread proper untainting and use of ref by particle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (9)
    As of 2020-04-07 17:55 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      The most amusing oxymoron is:
















      Results (43 votes). Check out past polls.

      Notices?