Hi,
How safe is the following code against SQL injection:
# Get user privilege
digest = sha.new(pw).hex digest()
# Protect against SQL injection by escaping quotes
uname = uname.replace(" '", "''")
sql = 'SELECT privilege FROM staff WHERE ' + \
'username=\'%s\ ' AND password=\'%s\' ' % (uname, digest)
res = self.oraDB.quer y(sql)
pw is the supplied password abd uname is the supplied password.
regards
How safe is the following code against SQL injection:
# Get user privilege
digest = sha.new(pw).hex digest()
# Protect against SQL injection by escaping quotes
uname = uname.replace(" '", "''")
sql = 'SELECT privilege FROM staff WHERE ' + \
'username=\'%s\ ' AND password=\'%s\' ' % (uname, digest)
res = self.oraDB.quer y(sql)
pw is the supplied password abd uname is the supplied password.
regards
Comment