473,748 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insecure dependency while running with -T switch

8 New Member
Hi friends,

I get a value from the html page using cgi->param function. Then i want to pass this value to access database. But it showing some error...I'll explain the details..

sub my_func {

my $id = cgi->param('id');
print "ID is $id"; //its works fine. value od id is 22

Now i want to pass this value to select the name of that id.

my $dbh = Bugzilla->dbh;
my $query = "select name from users where id != $id";
my $names = $dbh->selectrow_arra yref($query);

Here it's showing error:
undef error - Insecure dependency in parameter 1 of DBI::db=HASH(0x a8a628c)->selectrow_arra yref method call while running with -T switch

But when i give a integer value instead of $id in the query it's working fine.

Why the value of $id is not working with query??

Thanks in advance
Kokul
Jul 6 '07 #1
2 5468
KevinADC
4,059 Recognized Expert Specialist
The -T switch is to save yourself from making a mistake that allows user input to do something that might be insecure. When you get the data from the form, that is user input, it comes from outside the program. When you put the value directly into the function yourself, it is not insecure because it comes from inside your program.

What you need to do is validate the user intput and then "untaint" it to make it secure:

Expand|Select|Wrap|Line Numbers
  1. my $id = cgi->param('id');
  2. if ($id =~ /^(\d+)$/) {
  3.    $id = $1;# <-- now $id comes from inside the program and is untainted
  4. }
  5. else {
  6.    print "Error: id is not a digit";
  7.    exit();
  8. }
see also:

http://gunther.web66.com/FAQS/taintmode.html
Jul 6 '07 #2
miller
1,089 Recognized Expert Top Contributor
Because $id is currently "tainted" and database operations are secured operations.
perldoc perlsec

You can do the following which will verify that $id is an integer:
Expand|Select|Wrap|Line Numbers
  1.     my $id = cgi->param('id') =~ m/(\d+)/ ? $1 : die "Invalid id";
  2.  
Or you could also look into see if using placeholders would allow you to use DBI will tained data. It might work, but I've never tested it.

Expand|Select|Wrap|Line Numbers
  1. my $sth = $dbh->prepare(q{SELECT name FROM users WHERE id!=?});
  2. $sth->execute($id) or die $dbh->errstr;
  3. my $names = $sth->fetchrow_arrayref($query);
  4.  
- Miller
Jul 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1600
by: Noen | last post by:
Im developing a game where the players will program their equipment with python. Are there any ways to run insecure code? I dont want the clients to mess with the server-code through their own code, or even DOS the box by using up too much memory. Here is some examples of how the equipment should be programmed: --- # Proxmity explosive example import cpu
0
1888
by: danpres2k | last post by:
Hi, I have following statements @filename = split("_", $cgi->param ('filename')); //similar multiline code $env_profile = $cgi->param ('env_profile'); $command = "/app/ics/bin/$input_app -U\${USER} -P\${PSWD} -S\${SERVER} -D\${DB} -F\L@fileinfo\E -I\L@fileinfo\E -C@fileinfo -T$type -B$branch -R$code";
12
2454
by: Thomas Matthews | last post by:
Hi, According to Robert Martin's Dependency Inversion Principle, http://www.objectmentor.com/resources/articles/dip.pdf, when there is a need to test the type of an object, the code inside the "switch cases" should be placed into the parent class. However, I am finding that this conflicts with the other principles -- the objects now must know details about
0
2849
by: Michael R. Pierotti | last post by:
Has anyone seen this error before when trying to make the install on a program. ------ Starting pre-build validation for project 'HafaSMPPInstall' ------ WARNING: Unable to find dependency 'mscorlib' (Signature='B77A5C561934E089' Version='1.0.5000.0') of assembly 'Devshock.Protocol.SmppClient.DLL' WARNING: Unable to find dependency 'mscorlib' (Signature='B77A5C561934E089' Version='1.0.5000.0') of assembly 'System.dll' WARNING: Unable to...
8
13046
by: werner | last post by:
Hi! I don't want to use eval() in order to parse a user-supplied formula. What alternatives do I have? PHP has no standard functionality for tokenizing or parsing expressions in this regard. Here is a simple example: The user supplies the following formula in string format, "a = (6+10)/4", and the script needs to find out what the value of 'a' is.
0
1423
by: 123jainmin | last post by:
When I ran a perl script named script.pl which have the the follwing line: system("echo hostname = $HOSTNAME > /tmp/myinfo"); I have another shell script script.ksh which simply call script.pl within the script. the permission on script.ksh is: -rwsr-sr-x WHen I ran script.ksh, I got the error message: Insecure dependency in `` while running setuid at script.pl line 4. If I do not use $HOSTNAME in script.pl, I have no trouble at all. Could...
6
1801
by: asadikhan | last post by:
Hello, I have a bit of a design issue around this application I am developing, and I just want to run it through some of the brains out here. So I have a table called ErrorCheck which contains fields ErrorID (PK) and ErrorName. There is another table called Client which contains fields ClientID (PK) and ClientName. Then there is a relationship table called ClientErrorCheck which contains foreign keys ErrorID and
6
3716
by: kokul | last post by:
Dear Friends, I want to take multi lines from a text box in the webpage and pass to my script which saves this into a database. I wrote code like this my $desc = $cgi->param('comment'); But it gives some error messages when i click commit button in the web page. "Insecure dependency in `` while running with -T switch at"
1
1407
by: dherbstemail-ng | last post by:
I can get the SQL Server 2005 CommandNotification cache dependency to work with inline SQL. It works in a SqlDataSource as well as with the page OutputCache when making ADO.NET calls. Next I copy/paste the exact same inline SQL into a stored procedure wrapper and switch my SqlDataSource or ADO.NET code to call the stored procedure. Now the cache is no longer refreshed after data in the query results has been changed. Has anyone been...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8245
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.