in reply to Insecure dependecy in parameter while running with -T switch

The error is in how you are constructing $sql (which you don't show). Most likely you are taking parameters from the CGI request and interpolate them into your SQL like this:

my $q = CGI->new(); my $username = $q->param('user'); my $sql = "select * from users where username='$username'"; # BAD BAD +BAD

You should never interpolate data from outside of your program into SQL or other things passed to other libraries. In this case, you should learn about and use DBI placeholders:

my $sql = "select * from users where username=?"; # GOOD my $sth_user = $dbh->prepare_cached($sql) or die "can't prepare SQL:" . $dbh->errstr(); $sth_user->execute( $username );

You should also make sure that your $username corresponds to what you expect. See perltaint for how to check and how to untaint.

Replies are listed 'Best First'.
Re^2: Insecure dependecy in parameter while running with -T switch
by Anonymous Monk on Apr 13, 2010 at 13:32 UTC
A reply falls below the community's threshold of quality. You may see it by logging in.