Protecting against SQL injection in python -


i have code in python sets char(80) value in sqlite db.

the string obtained directly user through text input field , sent server post method in json structure.

on server side pass string method calling sql update operation.

it works, i'm aware not safe @ all.

i expect client side unsafe anyway, protection put on server side. can secure update operation agains sql injection ?

a function "quote" text can't confuse sql parser i'm looking for. expect such function exist couldn't find it.

edit: here current code setting char field name label:

def setlabel( self, userid, refid, label ):     self._db.cursor().execute( """         update items set label = ? userid ? , refid ?""", ( label, userid, refid) )     self._db.commit() 

from documentation:

con.execute("insert person(firstname) values (?)", ("joe",)) 

this escapes "joe", want is

con.execute("insert person(firstname) values (?)", (firstname_from_client,)) 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -