Re: Protecting against SQL injection

2006-11-22 Thread Christoph Zwerschke
Tor Erik Soenvisen wrote: > How safe is the following code against SQL injection: > > # Get user privilege > digest = sha.new(pw).hexdigest() > # Protect against SQL injection by escaping quotes > uname = uname.replace("'", "''") > sql = 'SELECT privilege FR

Re: Protecting against SQL injection

2006-10-24 Thread Aahz
In article <[EMAIL PROTECTED]>, Tor Erik Soenvisen <[EMAIL PROTECTED]> wrote: > >How safe is the following code against SQL injection: > ># Get user privilege >digest = sha.new(pw).hexdigest() ># Protect against SQL injection by escaping quotes >uname = uname.replac

Re: Protecting against SQL injection

2006-10-24 Thread Steve Holden
Tor Erik Soenvisen wrote: > Hi, > > How safe is the following code against SQL injection: > > # Get user privilege > digest = sha.new(pw).hexdigest() > # Protect against SQL injection by escaping quotes > uname = uname.replace("'", "''") > sql = 'SELECT pri

Re: Protecting against SQL injection

2006-10-24 Thread Fredrik Lundh
Ben Finney wrote: > More specifically: They've been debugged for just these kinds of > purposes in a well-designed database, the SQL parser never sees the parameter values, so *injection* attacks are simply not possible. -- http://mail.python.org/mailman/listinfo/python-list

Re: Protecting against SQL injection

2006-10-24 Thread Ben Finney
Paul Rubin <"http://phr.cx"@NOSPAM.invalid> writes: > Tor Erik Soenvisen <[EMAIL PROTECTED]> writes: > > # Protect against SQL injection by escaping quotes > > Don't ever do that, safe or not. Use query parameters instead. > That's what they're for. More specifically: They've been debugg

Re: Protecting against SQL injection

2006-10-24 Thread Paul Rubin
Tor Erik Soenvisen <[EMAIL PROTECTED]> writes: > # Protect against SQL injection by escaping quotes Don't ever do that, safe or not. Use query parameters instead. That's what they're for. -- http://mail.python.org/mailman/listinfo/python-list

Protecting against SQL injection

2006-10-24 Thread Tor Erik Soenvisen
Hi, How safe is the following code against SQL injection: # Get user privilege digest = sha.new(pw).hexdigest() # Protect against SQL injection by escaping quotes uname = uname.replace("'", "''") sql = 'SELECT privilege FROM staff WHERE ' + \