func_name stringlengths 2 38 | code stringlengths 63 7.98k | vul_type stringclasses 6
values | line_changes stringlengths 194 5.09k | char_changes stringlengths 83 6.45k | is_vulnerable bool 2
classes | vul_type_name stringclasses 6
values | vul_type_description stringclasses 6
values |
|---|---|---|---|---|---|---|---|
build_board | def build_board(conn, game,size):
# we'll build the empty board, and then fill in with the move list that
# we get from the DB.
board = []
for i in range(size):
board.append([""]*size)
# search for all moves that have happenend during this game.
cursor = conn.cursor()
cursor.execut... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 303, 'char_end': 380, 'line': ' cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;" % game)\n'}], 'added': [{'line_no': 11, 'char_start': 303, 'char_end': 382, 'line': ' cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;", (game,))\n'}]} | {'deleted': [{'char_start': 371, 'char_end': 373, 'chars': ' %'}], 'added': [{'char_start': 371, 'char_end': 372, 'chars': ','}, {'char_start': 373, 'char_end': 374, 'chars': '('}, {'char_start': 378, 'char_end': 380, 'chars': ',)'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
build_board | def build_board(conn, game,size):
# we'll build the empty board, and then fill in with the move list that
# we get from the DB.
board = []
for i in range(size):
board.append([""]*size)
# search for all moves that have happenend during this game.
cursor = conn.cursor()
cursor.execut... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 303, 'char_end': 380, 'line': ' cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;" % game)\n'}], 'added': [{'line_no': 11, 'char_start': 303, 'char_end': 382, 'line': ' cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;", (game,))\n'}]} | {'deleted': [{'char_start': 371, 'char_end': 373, 'chars': ' %'}], 'added': [{'char_start': 371, 'char_end': 372, 'chars': ','}, {'char_start': 373, 'char_end': 374, 'chars': '('}, {'char_start': 378, 'char_end': 380, 'chars': ',)'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
check_and_update_ranks | def check_and_update_ranks(self, scene):
# There are 2 cases here:
# 1) Ranks have never been calculated for this scene before
# - This means we need to calculate what the ranks were every month of this scenes history
# - We should only do this if ranks don't already ex... | cwe-089 | {'deleted': [{'line_no': 12, 'char_start': 763, 'char_end': 838, 'line': ' sql = \'select count(*) from ranks where scene="{}";\'.format(scene)\n'}, {'line_no': 13, 'char_start': 838, 'char_end': 870, 'line': ' res = self.db.exec(sql)\n'}, {'line_no': 31, 'char_start': 1777, 'char_end': 1879, 'line': ' ... | {'deleted': [{'char_start': 823, 'char_end': 826, 'chars': '.fo'}, {'char_start': 827, 'char_end': 831, 'chars': 'mat('}, {'char_start': 836, 'char_end': 837, 'chars': ')'}, {'char_start': 1864, 'char_end': 1867, 'chars': '.fo'}, {'char_start': 1868, 'char_end': 1872, 'chars': 'mat('}, {'char_start': 1877, 'char_end': ... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
check_and_update_ranks | def check_and_update_ranks(self, scene):
# There are 2 cases here:
# 1) Ranks have never been calculated for this scene before
# - This means we need to calculate what the ranks were every month of this scenes history
# - We should only do this if ranks don't already ex... | cwe-089 | {'deleted': [{'line_no': 12, 'char_start': 763, 'char_end': 838, 'line': ' sql = \'select count(*) from ranks where scene="{}";\'.format(scene)\n'}, {'line_no': 13, 'char_start': 838, 'char_end': 870, 'line': ' res = self.db.exec(sql)\n'}, {'line_no': 31, 'char_start': 1777, 'char_end': 1879, 'line': ' ... | {'deleted': [{'char_start': 823, 'char_end': 826, 'chars': '.fo'}, {'char_start': 827, 'char_end': 831, 'chars': 'mat('}, {'char_start': 836, 'char_end': 837, 'chars': ')'}, {'char_start': 1864, 'char_end': 1867, 'chars': '.fo'}, {'char_start': 1868, 'char_end': 1872, 'chars': 'mat('}, {'char_start': 1877, 'char_end': ... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
tag_num_to_tag | def tag_num_to_tag(self, tag_num):
''' Returns tag given tag_num. '''
q = "SELECT tag FROM tags WHERE rowid = '" + str(tag_num) + "'"
self.query(q)
return self.c.fetchone()[0] | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 83, 'char_end': 155, 'line': ' q = "SELECT tag FROM tags WHERE rowid = \'" + str(tag_num) + "\'"\n'}, {'line_no': 5, 'char_start': 155, 'char_end': 177, 'line': ' self.query(q)\n'}], 'added': [{'line_no': 4, 'char_start': 83, 'char_end': 134, 'line': ' q = ... | {'deleted': [{'char_start': 131, 'char_end': 153, 'chars': '\'" + str(tag_num) + "\''}], 'added': [{'char_start': 131, 'char_end': 132, 'chars': '?'}, {'char_start': 154, 'char_end': 163, 'chars': ', tag_num'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
tag_num_to_tag | def tag_num_to_tag(self, tag_num):
''' Returns tag given tag_num. '''
q = "SELECT tag FROM tags WHERE rowid = ?"
self.query(q, tag_num)
return self.c.fetchone()[0] | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 83, 'char_end': 155, 'line': ' q = "SELECT tag FROM tags WHERE rowid = \'" + str(tag_num) + "\'"\n'}, {'line_no': 5, 'char_start': 155, 'char_end': 177, 'line': ' self.query(q)\n'}], 'added': [{'line_no': 4, 'char_start': 83, 'char_end': 134, 'line': ' q = ... | {'deleted': [{'char_start': 131, 'char_end': 153, 'chars': '\'" + str(tag_num) + "\''}], 'added': [{'char_start': 131, 'char_end': 132, 'chars': '?'}, {'char_start': 154, 'char_end': 163, 'chars': ', tag_num'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_item | @api.route('/items/<int:item_id>', methods=['GET'])
def get_item(item_id):
sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)
cursor = mysql.connection.cursor()
cursor.execute(sql)
data = cursor.fetchone()
if data:
item = {}
for tu... | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 75, 'char_end': 182, 'line': " sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)\n"}, {'line_no': 5, 'char_start': 221, 'char_end': 245, 'line': ' cursor.execute(sql)\n'}], 'added': [{'line_no': 3, 'char_start': 75, 'ch... | {'deleted': [{'char_start': 136, 'char_end': 138, 'chars': '{}'}, {'char_start': 165, 'char_end': 181, 'chars': '.format(item_id)'}], 'added': [{'char_start': 136, 'char_end': 138, 'chars': '%s'}, {'char_start': 227, 'char_end': 238, 'chars': ', [item_id]'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_item | @api.route('/items/<int:item_id>', methods=['GET'])
def get_item(item_id):
sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = %s AND auctionable = true;'''
cursor = mysql.connection.cursor()
cursor.execute(sql, [item_id])
data = cursor.fetchone()
if data:
item = {}
for tup in ... | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 75, 'char_end': 182, 'line': " sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)\n"}, {'line_no': 5, 'char_start': 221, 'char_end': 245, 'line': ' cursor.execute(sql)\n'}], 'added': [{'line_no': 3, 'char_start': 75, 'ch... | {'deleted': [{'char_start': 136, 'char_end': 138, 'chars': '{}'}, {'char_start': 165, 'char_end': 181, 'chars': '.format(item_id)'}], 'added': [{'char_start': 136, 'char_end': 138, 'chars': '%s'}, {'char_start': 227, 'char_end': 238, 'chars': ', [item_id]'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
getPostsByPostid | def getPostsByPostid(self,postid):
sqlText="select users.name,post.comment from users,post where \
users.userid=post.userid and post.postid=%d"%(postid)
result=sql.queryDB(self.conn,sqlText)
return result; | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 111, 'char_end': 181, 'line': ' users.userid=post.userid and post.postid=%d"%(postid)\n'}, {'line_no': 4, 'char_start': 181, 'char_end': 227, 'line': ' result=sql.queryDB(self.conn,sqlText)\n'}], 'added': [{'line_no': 3, 'char_start': 111, 'char_end': 172,... | {'deleted': [{'char_start': 169, 'char_end': 170, 'chars': 'd'}, {'char_start': 171, 'char_end': 173, 'chars': '%('}, {'char_start': 179, 'char_end': 180, 'chars': ')'}], 'added': [{'char_start': 169, 'char_end': 170, 'chars': 's'}, {'char_start': 171, 'char_end': 188, 'chars': '\n params=['}, {'char_start': 194... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
getPostsByPostid | def getPostsByPostid(self,postid):
sqlText="select users.name,post.comment from users,post where \
users.userid=post.userid and post.postid=%s"
params=[postid]
result=sql.queryDB(self.conn,sqlText,params)
return result; | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 111, 'char_end': 181, 'line': ' users.userid=post.userid and post.postid=%d"%(postid)\n'}, {'line_no': 4, 'char_start': 181, 'char_end': 227, 'line': ' result=sql.queryDB(self.conn,sqlText)\n'}], 'added': [{'line_no': 3, 'char_start': 111, 'char_end': 172,... | {'deleted': [{'char_start': 169, 'char_end': 170, 'chars': 'd'}, {'char_start': 171, 'char_end': 173, 'chars': '%('}, {'char_start': 179, 'char_end': 180, 'chars': ')'}], 'added': [{'char_start': 169, 'char_end': 170, 'chars': 's'}, {'char_start': 171, 'char_end': 188, 'chars': '\n params=['}, {'char_start': 194... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
getFileCacheID | def getFileCacheID(self, pth):
"""
Returns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.
:param pth:
:return:
"""
command = "SELECT file_id FROM {0} WHERE path='{1}'".format(TABLE_NAME, pth)
data = self._run_command(command)
try:
data = data[0][0]
except... | cwe-089 | {'deleted': [{'line_no': 7, 'char_start': 168, 'char_end': 247, 'line': '\t\tcommand = "SELECT file_id FROM {0} WHERE path=\'{1}\'".format(TABLE_NAME, pth)\n'}, {'line_no': 8, 'char_start': 247, 'char_end': 283, 'line': '\t\tdata = self._run_command(command)\n'}], 'added': [{'line_no': 7, 'char_start': 168, 'char_end':... | {'deleted': [{'char_start': 216, 'char_end': 221, 'chars': "'{1}'"}, {'char_start': 240, 'char_end': 241, 'chars': ','}], 'added': [{'char_start': 216, 'char_end': 218, 'chars': '?;'}, {'char_start': 237, 'char_end': 247, 'chars': ')\n\t\tparams'}, {'char_start': 248, 'char_end': 251, 'chars': '= ('}, {'char_start': 25... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
getFileCacheID | def getFileCacheID(self, pth):
"""
Returns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.
:param pth:
:return:
"""
command = "SELECT file_id FROM {0} WHERE path=?;".format(TABLE_NAME)
params = (pth,)
data = self._run_command(command, params)
try:
data = d... | cwe-089 | {'deleted': [{'line_no': 7, 'char_start': 168, 'char_end': 247, 'line': '\t\tcommand = "SELECT file_id FROM {0} WHERE path=\'{1}\'".format(TABLE_NAME, pth)\n'}, {'line_no': 8, 'char_start': 247, 'char_end': 283, 'line': '\t\tdata = self._run_command(command)\n'}], 'added': [{'line_no': 7, 'char_start': 168, 'char_end':... | {'deleted': [{'char_start': 216, 'char_end': 221, 'chars': "'{1}'"}, {'char_start': 240, 'char_end': 241, 'chars': ','}], 'added': [{'char_start': 216, 'char_end': 218, 'chars': '?;'}, {'char_start': 237, 'char_end': 247, 'chars': ')\n\t\tparams'}, {'char_start': 248, 'char_end': 251, 'chars': '= ('}, {'char_start': 25... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
add_post | def add_post(content):
"""Add a post to the 'database' with the current timestamp."""
db = psycopg2.connect(database=DBNAME)
c = db.cursor()
c.execute("insert into posts values('%s')" % content)
db.commit()
db.close() | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 147, 'char_end': 203, 'line': ' c.execute("insert into posts values(\'%s\')" % content)\n'}], 'added': [{'line_no': 5, 'char_start': 147, 'char_end': 202, 'line': ' c.execute("insert into posts values(%s)",(content,))\n'}]} | {'deleted': [{'char_start': 185, 'char_end': 186, 'chars': "'"}, {'char_start': 188, 'char_end': 189, 'chars': "'"}, {'char_start': 191, 'char_end': 194, 'chars': ' % '}], 'added': [{'char_start': 189, 'char_end': 191, 'chars': ',('}, {'char_start': 198, 'char_end': 200, 'chars': ',)'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
add_post | def add_post(content):
"""Add a post to the 'database' with the current timestamp."""
db = psycopg2.connect(database=DBNAME)
c = db.cursor()
c.execute("insert into posts values(%s)",(content,))
db.commit()
db.close() | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 147, 'char_end': 203, 'line': ' c.execute("insert into posts values(\'%s\')" % content)\n'}], 'added': [{'line_no': 5, 'char_start': 147, 'char_end': 202, 'line': ' c.execute("insert into posts values(%s)",(content,))\n'}]} | {'deleted': [{'char_start': 185, 'char_end': 186, 'chars': "'"}, {'char_start': 188, 'char_end': 189, 'chars': "'"}, {'char_start': 191, 'char_end': 194, 'chars': ' % '}], 'added': [{'char_start': 189, 'char_end': 191, 'chars': ',('}, {'char_start': 198, 'char_end': 200, 'chars': ',)'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
getSubmissionDateFromDatabase | def getSubmissionDateFromDatabase(submission):
database = sqlite3.connect('database.db')
cursor = database.cursor()
return cursor.execute("SELECT Date FROM ChallengeRankings WHERE SubmissionID = '" + str(submission.id) + "'").fetchone()[0]
database.close() | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 124, 'char_end': 252, 'line': ' return cursor.execute("SELECT Date FROM ChallengeRankings WHERE SubmissionID = \'" + str(submission.id) + "\'").fetchone()[0]\n'}], 'added': [{'line_no': 4, 'char_start': 124, 'char_end': 247, 'line': ' return cursor.execute("SELECT Date FR... | {'deleted': [{'char_start': 207, 'char_end': 208, 'chars': "'"}, {'char_start': 209, 'char_end': 211, 'chars': ' +'}, {'char_start': 230, 'char_end': 236, 'chars': ' + "\'"'}], 'added': [{'char_start': 207, 'char_end': 208, 'chars': '?'}, {'char_start': 209, 'char_end': 210, 'chars': ','}, {'char_start': 211, 'char_end... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
getSubmissionDateFromDatabase | def getSubmissionDateFromDatabase(submission):
database = sqlite3.connect('database.db')
cursor = database.cursor()
return cursor.execute("SELECT Date FROM ChallengeRankings WHERE SubmissionID = ?", [str(submission.id)]).fetchone()[0]
database.close() | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 124, 'char_end': 252, 'line': ' return cursor.execute("SELECT Date FROM ChallengeRankings WHERE SubmissionID = \'" + str(submission.id) + "\'").fetchone()[0]\n'}], 'added': [{'line_no': 4, 'char_start': 124, 'char_end': 247, 'line': ' return cursor.execute("SELECT Date FR... | {'deleted': [{'char_start': 207, 'char_end': 208, 'chars': "'"}, {'char_start': 209, 'char_end': 211, 'chars': ' +'}, {'char_start': 230, 'char_end': 236, 'chars': ' + "\'"'}], 'added': [{'char_start': 207, 'char_end': 208, 'chars': '?'}, {'char_start': 209, 'char_end': 210, 'chars': ','}, {'char_start': 211, 'char_end... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
ranks | @endpoints.route("/ranks")
def ranks():
if db == None:
init()
scene = request.args.get('scene', default='austin')
date = request.args.get('date')
# If no date was provided, pick the date of the latest tournament
if date == None:
sql = "SELECT distinct date FROM ranks WHERE scene='... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 260, 'char_end': 367, 'line': ' sql = "SELECT distinct date FROM ranks WHERE scene=\'{}\' ORDER BY date DESC LIMIT 1;".format(scene)\n'}, {'line_no': 12, 'char_start': 367, 'char_end': 394, 'line': ' res = db.exec(sql)\n'}, {'line_no': 16, 'char_start': 480, 'cha... | {'deleted': [{'char_start': 352, 'char_end': 355, 'chars': '.fo'}, {'char_start': 356, 'char_end': 360, 'chars': 'mat('}, {'char_start': 365, 'char_end': 366, 'chars': ')'}, {'char_start': 544, 'char_end': 547, 'chars': '.fo'}, {'char_start': 548, 'char_end': 552, 'chars': 'mat('}, {'char_start': 563, 'char_end': 564, ... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
ranks | @endpoints.route("/ranks")
def ranks():
if db == None:
init()
scene = request.args.get('scene', default='austin')
date = request.args.get('date')
# If no date was provided, pick the date of the latest tournament
if date == None:
sql = "SELECT distinct date FROM ranks WHERE scene='... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 260, 'char_end': 367, 'line': ' sql = "SELECT distinct date FROM ranks WHERE scene=\'{}\' ORDER BY date DESC LIMIT 1;".format(scene)\n'}, {'line_no': 12, 'char_start': 367, 'char_end': 394, 'line': ' res = db.exec(sql)\n'}, {'line_no': 16, 'char_start': 480, 'cha... | {'deleted': [{'char_start': 352, 'char_end': 355, 'chars': '.fo'}, {'char_start': 356, 'char_end': 360, 'chars': 'mat('}, {'char_start': 365, 'char_end': 366, 'chars': ')'}, {'char_start': 544, 'char_end': 547, 'chars': '.fo'}, {'char_start': 548, 'char_end': 552, 'chars': 'mat('}, {'char_start': 563, 'char_end': 564, ... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
set_language | def set_language(self, lang):
"""
Update language of user in the User object and in the database
:param lang: string with language tag like "en-US"
:return: None
"""
log.debug('Updating info about user %s language '
'in memory & database...', self)
... | cwe-089 | {'deleted': [{'line_no': 13, 'char_start': 383, 'char_end': 435, 'line': ' f"SET language=\'{self.language}\' "\n'}, {'line_no': 14, 'char_start': 435, 'char_end': 487, 'line': ' f"WHERE chat_id=\'{self.chat_id}\'")\n'}, {'line_no': 17, 'char_start': 501, 'char_end': 527, 'line': ' ... | {'deleted': [{'char_start': 415, 'char_end': 417, 'chars': "'{"}, {'char_start': 418, 'char_end': 432, 'chars': "elf.language}'"}, {'char_start': 468, 'char_end': 470, 'chars': "'{"}, {'char_start': 482, 'char_end': 487, 'chars': '}\'")\n'}], 'added': [{'char_start': 415, 'char_end': 416, 'chars': '%'}, {'char_start': ... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
set_language | def set_language(self, lang):
"""
Update language of user in the User object and in the database
:param lang: string with language tag like "en-US"
:return: None
"""
log.debug('Updating info about user %s language '
'in memory & database...', self)
... | cwe-089 | {'deleted': [{'line_no': 13, 'char_start': 383, 'char_end': 435, 'line': ' f"SET language=\'{self.language}\' "\n'}, {'line_no': 14, 'char_start': 435, 'char_end': 487, 'line': ' f"WHERE chat_id=\'{self.chat_id}\'")\n'}, {'line_no': 17, 'char_start': 501, 'char_end': 527, 'line': ' ... | {'deleted': [{'char_start': 415, 'char_end': 417, 'chars': "'{"}, {'char_start': 418, 'char_end': 432, 'chars': "elf.language}'"}, {'char_start': 468, 'char_end': 470, 'chars': "'{"}, {'char_start': 482, 'char_end': 487, 'chars': '}\'")\n'}], 'added': [{'char_start': 415, 'char_end': 416, 'chars': '%'}, {'char_start': ... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
tid_num_to_tag_nums | def tid_num_to_tag_nums(self, tid_num):
''' Returns list of the associated tag_nums to the given tid_num. '''
q = "SELECT tag FROM tid_tag WHERE tid = '" + str(tid_num) + "'"
self.query(q)
return [i[0] for i in self.c.fetchall()] | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 123, 'char_end': 196, 'line': ' q = "SELECT tag FROM tid_tag WHERE tid = \'" + str(tid_num) + "\'"\n'}, {'line_no': 5, 'char_start': 196, 'char_end': 218, 'line': ' self.query(q)\n'}], 'added': [{'line_no': 4, 'char_start': 123, 'char_end': 175, 'line': ' q... | {'deleted': [{'char_start': 172, 'char_end': 194, 'chars': '\'" + str(tid_num) + "\''}], 'added': [{'char_start': 172, 'char_end': 173, 'chars': '?'}, {'char_start': 195, 'char_end': 204, 'chars': ', tid_num'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
tid_num_to_tag_nums | def tid_num_to_tag_nums(self, tid_num):
''' Returns list of the associated tag_nums to the given tid_num. '''
q = "SELECT tag FROM tid_tag WHERE tid = ?"
self.query(q, tid_num)
return [i[0] for i in self.c.fetchall()] | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 123, 'char_end': 196, 'line': ' q = "SELECT tag FROM tid_tag WHERE tid = \'" + str(tid_num) + "\'"\n'}, {'line_no': 5, 'char_start': 196, 'char_end': 218, 'line': ' self.query(q)\n'}], 'added': [{'line_no': 4, 'char_start': 123, 'char_end': 175, 'line': ' q... | {'deleted': [{'char_start': 172, 'char_end': 194, 'chars': '\'" + str(tid_num) + "\''}], 'added': [{'char_start': 172, 'char_end': 173, 'chars': '?'}, {'char_start': 195, 'char_end': 204, 'chars': ', tid_num'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
summary | @app.route('/summary', methods=['GET'])
def summary():
if 'username' in session:
conn = mysql.connect()
cursor = conn.cursor()
#select the maximum score from the results table
cursor.execute("SELECT courseConcentration FROM results WHERE total = (SELECT MAX(total) FROM (SELECT * FROM results WHERE courseId >... | cwe-089 | {'deleted': [{'line_no': 9, 'char_start': 185, 'char_end': 397, 'line': '\t\tcursor.execute("SELECT courseConcentration FROM results WHERE total = (SELECT MAX(total) FROM (SELECT * FROM results WHERE courseId > 4) Temp) and courseId > 4 and emailAccount=\'" + session[\'username\'] + "\'");\n'}], 'added': [{'line_no': 9... | {'deleted': [{'char_start': 364, 'char_end': 365, 'chars': "'"}, {'char_start': 367, 'char_end': 369, 'chars': '+ '}, {'char_start': 388, 'char_end': 394, 'chars': ' + "\'"'}], 'added': [{'char_start': 364, 'char_end': 366, 'chars': '%s'}, {'char_start': 367, 'char_end': 368, 'chars': ','}, {'char_start': 369, 'char_en... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
summary | @app.route('/summary', methods=['GET'])
def summary():
if 'username' in session:
conn = mysql.connect()
cursor = conn.cursor()
#select the maximum score from the results table
cursor.execute("SELECT courseConcentration FROM results WHERE total = (SELECT MAX(total) FROM (SELECT * FROM results WHERE courseId >... | cwe-089 | {'deleted': [{'line_no': 9, 'char_start': 185, 'char_end': 397, 'line': '\t\tcursor.execute("SELECT courseConcentration FROM results WHERE total = (SELECT MAX(total) FROM (SELECT * FROM results WHERE courseId > 4) Temp) and courseId > 4 and emailAccount=\'" + session[\'username\'] + "\'");\n'}], 'added': [{'line_no': 9... | {'deleted': [{'char_start': 364, 'char_end': 365, 'chars': "'"}, {'char_start': 367, 'char_end': 369, 'chars': '+ '}, {'char_start': 388, 'char_end': 394, 'chars': ' + "\'"'}], 'added': [{'char_start': 364, 'char_end': 366, 'chars': '%s'}, {'char_start': 367, 'char_end': 368, 'chars': ','}, {'char_start': 369, 'char_en... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
add_post | def add_post(content):
"""Add a post to the 'database' with the current timestamp."""
conn = psycopg2.connect("dbname=forum")
cursor = conn.cursor()
cursor.execute("insert into posts values ('%s')" % content)
conn.commit()
conn.close() | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 155, 'char_end': 217, 'line': ' cursor.execute("insert into posts values (\'%s\')" % content)\n'}], 'added': [{'line_no': 5, 'char_start': 155, 'char_end': 176, 'line': ' one_post = content\n'}, {'line_no': 6, 'char_start': 176, 'char_end': 239, 'line': ' cursor.execute("ins... | {'deleted': [{'char_start': 199, 'char_end': 200, 'chars': "'"}, {'char_start': 202, 'char_end': 203, 'chars': "'"}, {'char_start': 205, 'char_end': 207, 'chars': ' %'}, {'char_start': 208, 'char_end': 209, 'chars': 'c'}, {'char_start': 211, 'char_end': 212, 'chars': 't'}, {'char_start': 213, 'char_end': 214, 'chars': ... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
add_post | def add_post(content):
"""Add a post to the 'database' with the current timestamp."""
conn = psycopg2.connect("dbname=forum")
cursor = conn.cursor()
one_post = content
cursor.execute("insert into posts values (%s)", (one_post,))
conn.commit()
conn.close() | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 155, 'char_end': 217, 'line': ' cursor.execute("insert into posts values (\'%s\')" % content)\n'}], 'added': [{'line_no': 5, 'char_start': 155, 'char_end': 176, 'line': ' one_post = content\n'}, {'line_no': 6, 'char_start': 176, 'char_end': 239, 'line': ' cursor.execute("ins... | {'deleted': [{'char_start': 199, 'char_end': 200, 'chars': "'"}, {'char_start': 202, 'char_end': 203, 'chars': "'"}, {'char_start': 205, 'char_end': 207, 'chars': ' %'}, {'char_start': 208, 'char_end': 209, 'chars': 'c'}, {'char_start': 211, 'char_end': 212, 'chars': 't'}, {'char_start': 213, 'char_end': 214, 'chars': ... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
delete_playlist | def delete_playlist(id, db):
db.execute("DELETE FROM playlist where id={id};".format(id=id)) | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 29, 'char_end': 96, 'line': ' db.execute("DELETE FROM playlist where id={id};".format(id=id))\n'}], 'added': [{'line_no': 2, 'char_start': 29, 'char_end': 87, 'line': ' db.execute("DELETE FROM playlist where id=%s;", (id,))\n'}]} | {'deleted': [{'char_start': 75, 'char_end': 79, 'chars': '{id}'}, {'char_start': 81, 'char_end': 88, 'chars': '.format'}, {'char_start': 91, 'char_end': 94, 'chars': '=id'}], 'added': [{'char_start': 75, 'char_end': 77, 'chars': '%s'}, {'char_start': 79, 'char_end': 81, 'chars': ', '}, {'char_start': 84, 'char_end': 85... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
delete_playlist | def delete_playlist(id, db):
db.execute("DELETE FROM playlist where id=%s;", (id,)) | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 29, 'char_end': 96, 'line': ' db.execute("DELETE FROM playlist where id={id};".format(id=id))\n'}], 'added': [{'line_no': 2, 'char_start': 29, 'char_end': 87, 'line': ' db.execute("DELETE FROM playlist where id=%s;", (id,))\n'}]} | {'deleted': [{'char_start': 75, 'char_end': 79, 'chars': '{id}'}, {'char_start': 81, 'char_end': 88, 'chars': '.format'}, {'char_start': 91, 'char_end': 94, 'chars': '=id'}], 'added': [{'char_start': 75, 'char_end': 77, 'chars': '%s'}, {'char_start': 79, 'char_end': 81, 'chars': ', '}, {'char_start': 84, 'char_end': 85... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
writeToDb | def writeToDb(self, url):
try:
self.cursor.execute("INSERT INTO queue (url, visited) VALUES ('{}', '0');".format(url))
self.db.commit()
except Exception as e:
print(e) | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 43, 'char_end': 143, 'line': ' self.cursor.execute("INSERT INTO queue (url, visited) VALUES (\'{}\', \'0\');".format(url))\n'}], 'added': [{'line_no': 3, 'char_start': 43, 'char_end': 133, 'line': ' self.cursor.execute("INSERT INTO queue (url, visited) VAL... | {'deleted': [{'char_start': 117, 'char_end': 121, 'chars': "'{}'"}, {'char_start': 129, 'char_end': 137, 'chars': '.format('}, {'char_start': 140, 'char_end': 141, 'chars': ')'}], 'added': [{'char_start': 117, 'char_end': 118, 'chars': '?'}, {'char_start': 126, 'char_end': 128, 'chars': ', '}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
writeToDb | def writeToDb(self, url):
try:
self.cursor.execute("INSERT INTO queue (url, visited) VALUES (?, '0');", url)
self.db.commit()
except Exception as e:
print(e) | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 43, 'char_end': 143, 'line': ' self.cursor.execute("INSERT INTO queue (url, visited) VALUES (\'{}\', \'0\');".format(url))\n'}], 'added': [{'line_no': 3, 'char_start': 43, 'char_end': 133, 'line': ' self.cursor.execute("INSERT INTO queue (url, visited) VAL... | {'deleted': [{'char_start': 117, 'char_end': 121, 'chars': "'{}'"}, {'char_start': 129, 'char_end': 137, 'chars': '.format('}, {'char_start': 140, 'char_end': 141, 'chars': ')'}], 'added': [{'char_start': 117, 'char_end': 118, 'chars': '?'}, {'char_start': 126, 'char_end': 128, 'chars': ', '}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
send_message | @frappe.whitelist(allow_guest=True)
def send_message(subject="Website Query", message="", sender="", status="Open"):
from frappe.www.contact import send_message as website_send_message
lead = customer = None
website_send_message(subject, message, sender)
customer = frappe.db.sql("""select distinct dl.link_name fr... | cwe-089 | {'deleted': [{'line_no': 10, 'char_start': 424, 'char_end': 482, 'line': '\t\tand c.email_id=\'{email_id}\'""".format(email_id=sender))\n'}], 'added': [{'line_no': 10, 'char_start': 424, 'char_end': 458, 'line': '\t\tand c.email_id = %s""", sender)\n'}]} | {'deleted': [{'char_start': 441, 'char_end': 453, 'chars': "'{email_id}'"}, {'char_start': 456, 'char_end': 473, 'chars': '.format(email_id='}, {'char_start': 479, 'char_end': 480, 'chars': ')'}], 'added': [{'char_start': 440, 'char_end': 441, 'chars': ' '}, {'char_start': 442, 'char_end': 445, 'chars': ' %s'}, {'char_... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
send_message | @frappe.whitelist(allow_guest=True)
def send_message(subject="Website Query", message="", sender="", status="Open"):
from frappe.www.contact import send_message as website_send_message
lead = customer = None
website_send_message(subject, message, sender)
customer = frappe.db.sql("""select distinct dl.link_name fr... | cwe-089 | {'deleted': [{'line_no': 10, 'char_start': 424, 'char_end': 482, 'line': '\t\tand c.email_id=\'{email_id}\'""".format(email_id=sender))\n'}], 'added': [{'line_no': 10, 'char_start': 424, 'char_end': 458, 'line': '\t\tand c.email_id = %s""", sender)\n'}]} | {'deleted': [{'char_start': 441, 'char_end': 453, 'chars': "'{email_id}'"}, {'char_start': 456, 'char_end': 473, 'chars': '.format(email_id='}, {'char_start': 479, 'char_end': 480, 'chars': ')'}], 'added': [{'char_start': 440, 'char_end': 441, 'chars': ' '}, {'char_start': 442, 'char_end': 445, 'chars': ' %s'}, {'char_... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
delete | @jwt_required
def delete(self, email):
""" Deletes admin with the corresponding email """
return database_utilities.execute_query(f"""delete from admins where email = '{email}'""") | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 106, 'char_end': 204, 'line': ' return database_utilities.execute_query(f"""delete from admins where email = \'{email}\'""")\n'}], 'added': [{'line_no': 4, 'char_start': 106, 'char_end': 208, 'line': ' return database_utilities.execute_query(f"""delete from admins... | {'deleted': [{'char_start': 191, 'char_end': 193, 'chars': "'{"}, {'char_start': 198, 'char_end': 203, 'chars': '}\'"""'}], 'added': [{'char_start': 191, 'char_end': 199, 'chars': '%s""", ('}, {'char_start': 204, 'char_end': 207, 'chars': ', )'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
delete | @jwt_required
def delete(self, email):
""" Deletes admin with the corresponding email """
return database_utilities.execute_query(f"""delete from admins where email = %s""", (email, )) | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 106, 'char_end': 204, 'line': ' return database_utilities.execute_query(f"""delete from admins where email = \'{email}\'""")\n'}], 'added': [{'line_no': 4, 'char_start': 106, 'char_end': 208, 'line': ' return database_utilities.execute_query(f"""delete from admins... | {'deleted': [{'char_start': 191, 'char_end': 193, 'chars': "'{"}, {'char_start': 198, 'char_end': 203, 'chars': '}\'"""'}], 'added': [{'char_start': 191, 'char_end': 199, 'chars': '%s""", ('}, {'char_start': 204, 'char_end': 207, 'chars': ', )'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
delete_playlists_videos | def delete_playlists_videos(playlist_id, db):
db.execute("DELETE FROM video where playlist_id={playlist_id};".format(
playlist_id=playlist_id)) | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 46, 'char_end': 122, 'line': ' db.execute("DELETE FROM video where playlist_id={playlist_id};".format(\n'}, {'line_no': 3, 'char_start': 122, 'char_end': 155, 'line': ' playlist_id=playlist_id))\n'}], 'added': [{'line_no': 2, 'char_start': 46, 'char_end': 119, 'line':... | {'deleted': [{'char_start': 98, 'char_end': 105, 'chars': '{playli'}, {'char_start': 106, 'char_end': 111, 'chars': 't_id}'}, {'char_start': 113, 'char_end': 127, 'chars': '.format(\n '}, {'char_start': 128, 'char_end': 142, 'chars': ' playlist_id='}], 'added': [{'char_start': 98, 'char_end': 99, 'chars': '%'}, {'... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
delete_playlists_videos | def delete_playlists_videos(playlist_id, db):
db.execute("DELETE FROM video where playlist_id=%s;", (playlist_id,)) | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 46, 'char_end': 122, 'line': ' db.execute("DELETE FROM video where playlist_id={playlist_id};".format(\n'}, {'line_no': 3, 'char_start': 122, 'char_end': 155, 'line': ' playlist_id=playlist_id))\n'}], 'added': [{'line_no': 2, 'char_start': 46, 'char_end': 119, 'line':... | {'deleted': [{'char_start': 98, 'char_end': 105, 'chars': '{playli'}, {'char_start': 106, 'char_end': 111, 'chars': 't_id}'}, {'char_start': 113, 'char_end': 127, 'chars': '.format(\n '}, {'char_start': 128, 'char_end': 142, 'chars': ' playlist_id='}], 'added': [{'char_start': 98, 'char_end': 99, 'chars': '%'}, {'... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
upsert_mapped_projects | @staticmethod
def upsert_mapped_projects(user_id: int, project_id: int):
""" Adds projects to mapped_projects if it doesn't exist """
sql = "select * from users where id = {0} and projects_mapped @> '{{{1}}}'".format(user_id, project_id)
result = db.engine.execute(sql)
if result... | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 150, 'char_end': 262, 'line': ' sql = "select * from users where id = {0} and projects_mapped @> \'{{{1}}}\'".format(user_id, project_id)\n'}, {'line_no': 5, 'char_start': 262, 'char_end': 302, 'line': ' result = db.engine.execute(sql)\n'}, {'line_no': 11, 'char_s... | {'deleted': [{'char_start': 196, 'char_end': 199, 'chars': '{0}'}, {'char_start': 226, 'char_end': 250, 'chars': '{1}}}\'".format(user_id, '}, {'char_start': 260, 'char_end': 261, 'chars': ')'}, {'char_start': 510, 'char_end': 513, 'chars': '{0}'}, {'char_start': 544, 'char_end': 570, 'chars': "{1}'''.format(project_id... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
upsert_mapped_projects | @staticmethod
def upsert_mapped_projects(user_id: int, project_id: int):
""" Adds projects to mapped_projects if it doesn't exist """
sql = "select * from users where id = :user_id and projects_mapped @> '{{:project_id}}'"
result = db.engine.execute(text(sql), user_id=user_id, project_id... | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 150, 'char_end': 262, 'line': ' sql = "select * from users where id = {0} and projects_mapped @> \'{{{1}}}\'".format(user_id, project_id)\n'}, {'line_no': 5, 'char_start': 262, 'char_end': 302, 'line': ' result = db.engine.execute(sql)\n'}, {'line_no': 11, 'char_s... | {'deleted': [{'char_start': 196, 'char_end': 199, 'chars': '{0}'}, {'char_start': 226, 'char_end': 250, 'chars': '{1}}}\'".format(user_id, '}, {'char_start': 260, 'char_end': 261, 'chars': ')'}, {'char_start': 510, 'char_end': 513, 'chars': '{0}'}, {'char_start': 544, 'char_end': 570, 'chars': "{1}'''.format(project_id... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_first_ranked_month | def get_first_ranked_month(db, scene, player):
sql = "select date from ranks where scene='{}' and player='{}' order by date limit 1;".format(scene, player)
res = db.exec(sql)
date = res[0][0]
return date | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 47, 'char_end': 160, 'line': ' sql = "select date from ranks where scene=\'{}\' and player=\'{}\' order by date limit 1;".format(scene, player)\n'}, {'line_no': 3, 'char_start': 160, 'char_end': 183, 'line': ' res = db.exec(sql)\n'}], 'added': [{'line_no': 2, 'char_start'... | {'deleted': [{'char_start': 137, 'char_end': 140, 'chars': '.fo'}, {'char_start': 141, 'char_end': 145, 'chars': 'mat('}, {'char_start': 158, 'char_end': 159, 'chars': ')'}], 'added': [{'char_start': 95, 'char_end': 100, 'chars': 'scene'}, {'char_start': 116, 'char_end': 122, 'chars': 'player'}, {'char_start': 148, 'ch... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_first_ranked_month | def get_first_ranked_month(db, scene, player):
sql = "select date from ranks where scene='{scene}' and player='{player}' order by date limit 1;"
args = {'scene': scene, 'player': player}
res = db.exec(sql, args)
date = res[0][0]
return date | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 47, 'char_end': 160, 'line': ' sql = "select date from ranks where scene=\'{}\' and player=\'{}\' order by date limit 1;".format(scene, player)\n'}, {'line_no': 3, 'char_start': 160, 'char_end': 183, 'line': ' res = db.exec(sql)\n'}], 'added': [{'line_no': 2, 'char_start'... | {'deleted': [{'char_start': 137, 'char_end': 140, 'chars': '.fo'}, {'char_start': 141, 'char_end': 145, 'chars': 'mat('}, {'char_start': 158, 'char_end': 159, 'chars': ')'}], 'added': [{'char_start': 95, 'char_end': 100, 'chars': 'scene'}, {'char_start': 116, 'char_end': 122, 'chars': 'player'}, {'char_start': 148, 'ch... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
openPoll | @hook.command(adminonly=True)
def openPoll(question, reply=None, db=None):
"""Creates a new poll."""
if not db_ready: db_init(db)
try:
active = db.execute("SELECT pollID FROM polls WHERE active = 1").fetchone()[0]
if active:
reply("There already is an open poll.")
re... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 337, 'char_end': 430, 'line': ' db.execute("INSERT INTO polls (question, active) VALUES (\'{}\', 1)".format(question))\n'}], 'added': [{'line_no': 11, 'char_start': 337, 'char_end': 423, 'line': ' db.execute("INSERT INTO polls (question, active) VALUES (?, 1)", (... | {'deleted': [{'char_start': 402, 'char_end': 406, 'chars': "'{}'"}, {'char_start': 411, 'char_end': 418, 'chars': '.format'}], 'added': [{'char_start': 402, 'char_end': 403, 'chars': '?'}, {'char_start': 408, 'char_end': 410, 'chars': ', '}, {'char_start': 419, 'char_end': 420, 'chars': ','}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
openPoll | @hook.command(adminonly=True)
def openPoll(question, reply=None, db=None):
"""Creates a new poll."""
if not db_ready: db_init(db)
try:
active = db.execute("SELECT pollID FROM polls WHERE active = 1").fetchone()[0]
if active:
reply("There already is an open poll.")
re... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 337, 'char_end': 430, 'line': ' db.execute("INSERT INTO polls (question, active) VALUES (\'{}\', 1)".format(question))\n'}], 'added': [{'line_no': 11, 'char_start': 337, 'char_end': 423, 'line': ' db.execute("INSERT INTO polls (question, active) VALUES (?, 1)", (... | {'deleted': [{'char_start': 402, 'char_end': 406, 'chars': "'{}'"}, {'char_start': 411, 'char_end': 418, 'chars': '.format'}], 'added': [{'char_start': 402, 'char_end': 403, 'chars': '?'}, {'char_start': 408, 'char_end': 410, 'chars': ', '}, {'char_start': 419, 'char_end': 420, 'chars': ','}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
__init__.view_grocery_list | def view_grocery_list():
print("grocery== list")
groceryListFrame = Frame(self)
groceryListFrame.rowconfigure(0, weight=1)
groceryListFrame.columnconfigure(0, weight=1)
groceryListFrame.rowconfigure(1, weight=3)
groceryListFrame.columnconfi... | cwe-089 | {'deleted': [{'line_no': 20, 'char_start': 745, 'char_end': 822, 'line': ' selection = cursor.execute("""SELECT * FROM """ + tableName)\n'}], 'added': [{'line_no': 20, 'char_start': 745, 'char_end': 827, 'line': ' selection = cursor.execute("""SELECT * FROM ?;""", (tableName, ))\n'}]} | {'deleted': [{'char_start': 809, 'char_end': 811, 'chars': '+ '}], 'added': [{'char_start': 805, 'char_end': 807, 'chars': '?;'}, {'char_start': 810, 'char_end': 811, 'chars': ','}, {'char_start': 812, 'char_end': 813, 'chars': '('}, {'char_start': 822, 'char_end': 825, 'chars': ', )'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
__init__.view_grocery_list | def view_grocery_list():
print("grocery== list")
groceryListFrame = Frame(self)
groceryListFrame.rowconfigure(0, weight=1)
groceryListFrame.columnconfigure(0, weight=1)
groceryListFrame.rowconfigure(1, weight=3)
groceryListFrame.columnconfi... | cwe-089 | {'deleted': [{'line_no': 20, 'char_start': 745, 'char_end': 822, 'line': ' selection = cursor.execute("""SELECT * FROM """ + tableName)\n'}], 'added': [{'line_no': 20, 'char_start': 745, 'char_end': 827, 'line': ' selection = cursor.execute("""SELECT * FROM ?;""", (tableName, ))\n'}]} | {'deleted': [{'char_start': 809, 'char_end': 811, 'chars': '+ '}], 'added': [{'char_start': 805, 'char_end': 807, 'chars': '?;'}, {'char_start': 810, 'char_end': 811, 'chars': ','}, {'char_start': 812, 'char_end': 813, 'chars': '('}, {'char_start': 822, 'char_end': 825, 'chars': ', )'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
view_page_record | @app.route('/<page_name>/history/record')
def view_page_record(page_name):
content_id = request.args.get('id')
query = db.query("select page_content.content, page_content.timestamp from page, page_content where page.id = page_content.page_id and page_content.id = '%s'" % content_id)
page_record = query.name... | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 115, 'char_end': 292, 'line': ' query = db.query("select page_content.content, page_content.timestamp from page, page_content where page.id = page_content.page_id and page_content.id = \'%s\'" % content_id)\n'}], 'added': [{'line_no': 4, 'char_start': 115, 'char_end': 289, '... | {'deleted': [{'char_start': 272, 'char_end': 276, 'chars': "'%s'"}, {'char_start': 277, 'char_end': 279, 'chars': ' %'}], 'added': [{'char_start': 272, 'char_end': 274, 'chars': '$1'}, {'char_start': 275, 'char_end': 276, 'chars': ','}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
view_page_record | @app.route('/<page_name>/history/record')
def view_page_record(page_name):
content_id = request.args.get('id')
query = db.query("select page_content.content, page_content.timestamp from page, page_content where page.id = page_content.page_id and page_content.id = $1", content_id)
page_record = query.namedre... | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 115, 'char_end': 292, 'line': ' query = db.query("select page_content.content, page_content.timestamp from page, page_content where page.id = page_content.page_id and page_content.id = \'%s\'" % content_id)\n'}], 'added': [{'line_no': 4, 'char_start': 115, 'char_end': 289, '... | {'deleted': [{'char_start': 272, 'char_end': 276, 'chars': "'%s'"}, {'char_start': 277, 'char_end': 279, 'chars': ' %'}], 'added': [{'char_start': 272, 'char_end': 274, 'chars': '$1'}, {'char_start': 275, 'char_end': 276, 'chars': ','}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
update_inverter | def update_inverter(self, inverter_serial, ts, status, etoday, etotal):
query = '''
UPDATE Inverters
SET
TimeStamp='%s',
Status='%s',
eToday='%s',
eTotal='%s'
WHERE Serial='%s';
''' % (ts, stat... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 146, 'char_end': 179, 'line': " TimeStamp='%s', \n"}, {'line_no': 6, 'char_start': 179, 'char_end': 209, 'line': " Status='%s', \n"}, {'line_no': 7, 'char_start': 209, 'char_end': 238, 'line': " eToday='%s',\n"}, {'line_no': 8, 'char... | {'deleted': [{'char_start': 172, 'char_end': 176, 'chars': "'%s'"}, {'char_start': 202, 'char_end': 206, 'chars': "'%s'"}, {'char_start': 232, 'char_end': 236, 'chars': "'%s'"}, {'char_start': 261, 'char_end': 265, 'chars': "'%s'"}, {'char_start': 291, 'char_end': 295, 'chars': "'%s'"}, {'char_start': 309, 'char_end': ... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
update_inverter | def update_inverter(self, inverter_serial, ts, status, etoday, etotal):
query = '''
UPDATE Inverters
SET
TimeStamp=?,
Status=?,
eToday=?,
eTotal=?
WHERE Serial=?;
'''
self.c.execute(que... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 146, 'char_end': 179, 'line': " TimeStamp='%s', \n"}, {'line_no': 6, 'char_start': 179, 'char_end': 209, 'line': " Status='%s', \n"}, {'line_no': 7, 'char_start': 209, 'char_end': 238, 'line': " eToday='%s',\n"}, {'line_no': 8, 'char... | {'deleted': [{'char_start': 172, 'char_end': 176, 'chars': "'%s'"}, {'char_start': 202, 'char_end': 206, 'chars': "'%s'"}, {'char_start': 232, 'char_end': 236, 'chars': "'%s'"}, {'char_start': 261, 'char_end': 265, 'chars': "'%s'"}, {'char_start': 291, 'char_end': 295, 'chars': "'%s'"}, {'char_start': 309, 'char_end': ... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
insert | def insert(key, value):
connection = psycopg2.connect(host=config['HOST'], port=config['PORT'], database=config['NAME'], user=config['USER'], password=config['PASSWORD'])
cur = connection.cursor()
try:
cur.execute("insert into reply_map values('{}', '{}')".format(key, value))
connection.comm... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 214, 'char_end': 297, 'line': ' cur.execute("insert into reply_map values(\'{}\', \'{}\')".format(key, value))\n'}], 'added': [{'line_no': 5, 'char_start': 214, 'char_end': 286, 'line': ' cur.execute("insert into reply_map values(?, ?)", (key, value))\n'}]} | {'deleted': [{'char_start': 264, 'char_end': 268, 'chars': "'{}'"}, {'char_start': 270, 'char_end': 274, 'chars': "'{}'"}, {'char_start': 276, 'char_end': 283, 'chars': '.format'}], 'added': [{'char_start': 264, 'char_end': 265, 'chars': '?'}, {'char_start': 267, 'char_end': 268, 'chars': '?'}, {'char_start': 270, 'cha... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
insert | def insert(key, value):
connection = psycopg2.connect(host=config['HOST'], port=config['PORT'], database=config['NAME'], user=config['USER'], password=config['PASSWORD'])
cur = connection.cursor()
try:
cur.execute("insert into reply_map values(?, ?)", (key, value))
connection.commit()
ex... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 214, 'char_end': 297, 'line': ' cur.execute("insert into reply_map values(\'{}\', \'{}\')".format(key, value))\n'}], 'added': [{'line_no': 5, 'char_start': 214, 'char_end': 286, 'line': ' cur.execute("insert into reply_map values(?, ?)", (key, value))\n'}]} | {'deleted': [{'char_start': 264, 'char_end': 268, 'chars': "'{}'"}, {'char_start': 270, 'char_end': 274, 'chars': "'{}'"}, {'char_start': 276, 'char_end': 283, 'chars': '.format'}], 'added': [{'char_start': 264, 'char_end': 265, 'chars': '?'}, {'char_start': 267, 'char_end': 268, 'chars': '?'}, {'char_start': 270, 'cha... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
save_failure_transaction | def save_failure_transaction(self, user_id, project_id, money):
self.cursor.execute("insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, %s, now(), 'failed' )" % (project_id, user_id, money))
self.db.commit() | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 68, 'char_end': 239, 'line': ' self.cursor.execute("insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, %s, now(), \'failed\' )" % (project_id, user_id, money))\n'}], 'added': [{'line_no': 2, 'char_start': 68, 'char_end': 186, 'line': '... | {'deleted': [{'char_start': 206, 'char_end': 208, 'chars': ' %'}], 'added': [{'char_start': 184, 'char_end': 215, 'chars': '"\n "'}, {'char_start': 237, 'char_end': 238, 'chars': ','}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
save_failure_transaction | def save_failure_transaction(self, user_id, project_id, money):
self.cursor.execute("insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, "
"%s, now(), 'failed' )", (project_id, user_id, money))
self.db.commit() | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 68, 'char_end': 239, 'line': ' self.cursor.execute("insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, %s, now(), \'failed\' )" % (project_id, user_id, money))\n'}], 'added': [{'line_no': 2, 'char_start': 68, 'char_end': 186, 'line': '... | {'deleted': [{'char_start': 206, 'char_end': 208, 'chars': ' %'}], 'added': [{'char_start': 184, 'char_end': 215, 'chars': '"\n "'}, {'char_start': 237, 'char_end': 238, 'chars': ','}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
test_process_as_form | @unpack
def test_process_as_form(self, job_number, dcn_key, was_prev_matched,
was_prev_closed, was_prev_tracked):
email_obj = {
'sender' : "Alex Roy <Alex.Roy@dilfo.com>",
'subject' : "DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`",
'date' : "Tue, 7 May 20... | cwe-089 | {'deleted': [{'line_no': 18, 'char_start': 823, 'char_end': 876, 'line': " VALUES ({}, 'alex.roy616@gmail.com', {})\n"}, {'line_no': 22, 'char_start': 992, 'char_end': 1045, 'line': " VALUES ({}, 'alex.roy616@gmail.com', {})\n"}, {'line_no': 26, 'char_start': 1151, 'char_end': 1244, 'line': ' ... | {'deleted': [{'char_start': 843, 'char_end': 845, 'chars': '{}'}, {'char_start': 872, 'char_end': 874, 'chars': '{}'}, {'char_start': 1012, 'char_end': 1014, 'chars': '{}'}, {'char_start': 1041, 'char_end': 1043, 'chars': '{}'}, {'char_start': 1206, 'char_end': 1214, 'chars': '.format('}, {'char_start': 1241, 'char_end... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
test_process_as_form | @unpack
def test_process_as_form(self, job_number, dcn_key, was_prev_matched,
was_prev_closed, was_prev_tracked):
email_obj = {
'sender' : "Alex Roy <Alex.Roy@dilfo.com>",
'subject' : "DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`",
'date' : "Tue, 7 May 20... | cwe-089 | {'deleted': [{'line_no': 18, 'char_start': 823, 'char_end': 876, 'line': " VALUES ({}, 'alex.roy616@gmail.com', {})\n"}, {'line_no': 22, 'char_start': 992, 'char_end': 1045, 'line': " VALUES ({}, 'alex.roy616@gmail.com', {})\n"}, {'line_no': 26, 'char_start': 1151, 'char_end': 1244, 'line': ' ... | {'deleted': [{'char_start': 843, 'char_end': 845, 'chars': '{}'}, {'char_start': 872, 'char_end': 874, 'chars': '{}'}, {'char_start': 1012, 'char_end': 1014, 'chars': '{}'}, {'char_start': 1041, 'char_end': 1043, 'chars': '{}'}, {'char_start': 1206, 'char_end': 1214, 'chars': '.format('}, {'char_start': 1241, 'char_end... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
render_page_name | @app.route('/<page_name>')
def render_page_name(page_name):
query = db.query("select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = '%s' order by page_content.id desc limit 1" % page_name)
wiki_page = quer... | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 60, 'char_end': 300, 'line': ' query = db.query("select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = \'%s\' order by page_content.id desc limit 1" % page_name)\n'}], ... | {'deleted': [{'char_start': 243, 'char_end': 247, 'chars': "'%s'"}, {'char_start': 286, 'char_end': 288, 'chars': ' %'}], 'added': [{'char_start': 243, 'char_end': 245, 'chars': '$1'}, {'char_start': 284, 'char_end': 285, 'chars': ','}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
render_page_name | @app.route('/<page_name>')
def render_page_name(page_name):
query = db.query("select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = $1 order by page_content.id desc limit 1", page_name)
wiki_page = query.n... | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 60, 'char_end': 300, 'line': ' query = db.query("select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = \'%s\' order by page_content.id desc limit 1" % page_name)\n'}], ... | {'deleted': [{'char_start': 243, 'char_end': 247, 'chars': "'%s'"}, {'char_start': 286, 'char_end': 288, 'chars': ' %'}], 'added': [{'char_start': 243, 'char_end': 245, 'chars': '$1'}, {'char_start': 284, 'char_end': 285, 'chars': ','}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
tid_to_tid_num | def tid_to_tid_num(self, tid):
''' Returns tid_num, given tid. '''
q = "SELECT rowid FROM tids WHERE tid = '" + tid + "'"
self.query(q)
return self.c.fetchone()[0] | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 80, 'char_end': 143, 'line': ' q = "SELECT rowid FROM tids WHERE tid = \'" + tid + "\'"\n'}, {'line_no': 5, 'char_start': 143, 'char_end': 165, 'line': ' self.query(q)\n'}], 'added': [{'line_no': 4, 'char_start': 80, 'char_end': 131, 'line': ' q = "SELECT r... | {'deleted': [{'char_start': 128, 'char_end': 141, 'chars': '\'" + tid + "\''}], 'added': [{'char_start': 128, 'char_end': 129, 'chars': '?'}, {'char_start': 151, 'char_end': 156, 'chars': ', tid'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
tid_to_tid_num | def tid_to_tid_num(self, tid):
''' Returns tid_num, given tid. '''
q = "SELECT rowid FROM tids WHERE tid = ?"
self.query(q, tid)
return self.c.fetchone()[0] | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 80, 'char_end': 143, 'line': ' q = "SELECT rowid FROM tids WHERE tid = \'" + tid + "\'"\n'}, {'line_no': 5, 'char_start': 143, 'char_end': 165, 'line': ' self.query(q)\n'}], 'added': [{'line_no': 4, 'char_start': 80, 'char_end': 131, 'line': ' q = "SELECT r... | {'deleted': [{'char_start': 128, 'char_end': 141, 'chars': '\'" + tid + "\''}], 'added': [{'char_start': 128, 'char_end': 129, 'chars': '?'}, {'char_start': 151, 'char_end': 156, 'chars': ', tid'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_old_sourcebyinstitution_number | def get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution):
"""
Get all the old sourcebyinstitution number from the SQLite database.
"""
query = """
SELECT
titles
FROM
history
WHERE
sourcebyinstitution = "%s"
ORDER BY
... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 261, 'char_end': 300, 'line': ' sourcebyinstitution = "%s"\n'}, {'line_no': 15, 'char_start': 357, 'char_end': 387, 'line': ' """ % sourcebyinstitution\n'}, {'line_no': 17, 'char_start': 388, 'char_end': 414, 'line': ' sqlite.execute(query)\n'}], 'added': [{'l... | {'deleted': [{'char_start': 295, 'char_end': 299, 'chars': '"%s"'}, {'char_start': 364, 'char_end': 386, 'chars': ' % sourcebyinstitution'}], 'added': [{'char_start': 295, 'char_end': 296, 'chars': '?'}, {'char_start': 387, 'char_end': 411, 'chars': ', (sourcebyinstitution,)'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_old_sourcebyinstitution_number | def get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution):
"""
Get all the old sourcebyinstitution number from the SQLite database.
"""
query = """
SELECT
titles
FROM
history
WHERE
sourcebyinstitution = ?
ORDER BY
... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 261, 'char_end': 300, 'line': ' sourcebyinstitution = "%s"\n'}, {'line_no': 15, 'char_start': 357, 'char_end': 387, 'line': ' """ % sourcebyinstitution\n'}, {'line_no': 17, 'char_start': 388, 'char_end': 414, 'line': ' sqlite.execute(query)\n'}], 'added': [{'l... | {'deleted': [{'char_start': 295, 'char_end': 299, 'chars': '"%s"'}, {'char_start': 364, 'char_end': 386, 'chars': ' % sourcebyinstitution'}], 'added': [{'char_start': 295, 'char_end': 296, 'chars': '?'}, {'char_start': 387, 'char_end': 411, 'chars': ', (sourcebyinstitution,)'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
top_karma | def top_karma(bot, trigger):
"""
Show karma status for the top n number of IRC users.
"""
try:
top_limit = int(trigger.group(2).strip())
except ValueError:
top_limit = 5
query = "SELECT slug, value FROM nick_values NATURAL JOIN nicknames \
WHERE key = 'karma' ORDER BY va... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 281, 'char_end': 339, 'line': ' WHERE key = \'karma\' ORDER BY value DESC LIMIT %d"\n'}, {'line_no': 12, 'char_start': 339, 'char_end': 400, 'line': ' karmalist = bot.db.execute(query % top_limit).fetchall()\n'}], 'added': [{'line_no': 11, 'char_start': 281, 'char_en... | {'deleted': [{'char_start': 335, 'char_end': 337, 'chars': '%d'}, {'char_start': 376, 'char_end': 378, 'chars': '% '}], 'added': [{'char_start': 335, 'char_end': 336, 'chars': '?'}, {'char_start': 374, 'char_end': 375, 'chars': ','}, {'char_start': 376, 'char_end': 380, 'chars': 'str('}, {'char_start': 389, 'char_end':... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
top_karma | def top_karma(bot, trigger):
"""
Show karma status for the top n number of IRC users.
"""
try:
top_limit = int(trigger.group(2).strip())
except ValueError:
top_limit = 5
query = "SELECT slug, value FROM nick_values NATURAL JOIN nicknames \
WHERE key = 'karma' ORDER BY va... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 281, 'char_end': 339, 'line': ' WHERE key = \'karma\' ORDER BY value DESC LIMIT %d"\n'}, {'line_no': 12, 'char_start': 339, 'char_end': 400, 'line': ' karmalist = bot.db.execute(query % top_limit).fetchall()\n'}], 'added': [{'line_no': 11, 'char_start': 281, 'char_en... | {'deleted': [{'char_start': 335, 'char_end': 337, 'chars': '%d'}, {'char_start': 376, 'char_end': 378, 'chars': '% '}], 'added': [{'char_start': 335, 'char_end': 336, 'chars': '?'}, {'char_start': 374, 'char_end': 375, 'chars': ','}, {'char_start': 376, 'char_end': 380, 'chars': 'str('}, {'char_start': 389, 'char_end':... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
retrieve_playlist_by_id | def retrieve_playlist_by_id(id, db):
db.execute(
"SELECT id, name, video_position from playlist WHERE id={id};".format(id=id))
row = db.fetchone()
return row | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 53, 'char_end': 139, 'line': ' "SELECT id, name, video_position from playlist WHERE id={id};".format(id=id))\n'}], 'added': [{'line_no': 3, 'char_start': 53, 'char_end': 130, 'line': ' "SELECT id, name, video_position from playlist WHERE id=%s;", (id,))\n'}]} | {'deleted': [{'char_start': 117, 'char_end': 121, 'chars': '{id}'}, {'char_start': 123, 'char_end': 130, 'chars': '.format'}, {'char_start': 133, 'char_end': 136, 'chars': '=id'}], 'added': [{'char_start': 117, 'char_end': 119, 'chars': '%s'}, {'char_start': 121, 'char_end': 123, 'chars': ', '}, {'char_start': 126, 'ch... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
retrieve_playlist_by_id | def retrieve_playlist_by_id(id, db):
db.execute(
"SELECT id, name, video_position from playlist WHERE id=%s;", (id,))
row = db.fetchone()
return row | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 53, 'char_end': 139, 'line': ' "SELECT id, name, video_position from playlist WHERE id={id};".format(id=id))\n'}], 'added': [{'line_no': 3, 'char_start': 53, 'char_end': 130, 'line': ' "SELECT id, name, video_position from playlist WHERE id=%s;", (id,))\n'}]} | {'deleted': [{'char_start': 117, 'char_end': 121, 'chars': '{id}'}, {'char_start': 123, 'char_end': 130, 'chars': '.format'}, {'char_start': 133, 'char_end': 136, 'chars': '=id'}], 'added': [{'char_start': 117, 'char_end': 119, 'chars': '%s'}, {'char_start': 121, 'char_end': 123, 'chars': ', '}, {'char_start': 126, 'ch... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_task | @bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_GET_TASK.value)
def get_task(message):
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db")
conn = settings.cursor()
conn.execute("select * from users where chat_id = ... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 266, 'char_end': 353, 'line': ' conn.execute("select * from users where chat_id = \'" + str(message.chat.id) + "\'")\n'}], 'added': [{'line_no': 5, 'char_start': 266, 'char_end': 349, 'line': ' conn.execute("select * from users where chat_id = ?", (str(message.chat.id),))... | {'deleted': [{'char_start': 320, 'char_end': 321, 'chars': "'"}, {'char_start': 322, 'char_end': 324, 'chars': ' +'}, {'char_start': 345, 'char_end': 351, 'chars': ' + "\'"'}], 'added': [{'char_start': 320, 'char_end': 321, 'chars': '?'}, {'char_start': 322, 'char_end': 323, 'chars': ','}, {'char_start': 324, 'char_end... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_task | @bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_GET_TASK.value)
def get_task(message):
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db")
conn = settings.cursor()
conn.execute("select * from users where chat_id = ... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 266, 'char_end': 353, 'line': ' conn.execute("select * from users where chat_id = \'" + str(message.chat.id) + "\'")\n'}], 'added': [{'line_no': 5, 'char_start': 266, 'char_end': 349, 'line': ' conn.execute("select * from users where chat_id = ?", (str(message.chat.id),))... | {'deleted': [{'char_start': 320, 'char_end': 321, 'chars': "'"}, {'char_start': 322, 'char_end': 324, 'chars': ' +'}, {'char_start': 345, 'char_end': 351, 'chars': ' + "\'"'}], 'added': [{'char_start': 320, 'char_end': 321, 'chars': '?'}, {'char_start': 322, 'char_end': 323, 'chars': ','}, {'char_start': 324, 'char_end... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
stats | @bot.message_handler(commands=['stats'])
def stats(message):
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db")
conn = settings.cursor()
conn.execute("select * from users where chat_id = '" + str(message.chat.id) + "'")
name = conn.fetchone()
settings.clo... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 190, 'char_end': 277, 'line': ' conn.execute("select * from users where chat_id = \'" + str(message.chat.id) + "\'")\n'}], 'added': [{'line_no': 5, 'char_start': 190, 'char_end': 273, 'line': ' conn.execute("select * from users where chat_id = ?", (str(message.chat.id),))... | {'deleted': [{'char_start': 244, 'char_end': 245, 'chars': "'"}, {'char_start': 246, 'char_end': 248, 'chars': ' +'}, {'char_start': 269, 'char_end': 275, 'chars': ' + "\'"'}], 'added': [{'char_start': 244, 'char_end': 245, 'chars': '?'}, {'char_start': 246, 'char_end': 247, 'chars': ','}, {'char_start': 248, 'char_end... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
stats | @bot.message_handler(commands=['stats'])
def stats(message):
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db")
conn = settings.cursor()
conn.execute("select * from users where chat_id = ?", (str(message.chat.id),))
name = conn.fetchone()
settings.close()... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 190, 'char_end': 277, 'line': ' conn.execute("select * from users where chat_id = \'" + str(message.chat.id) + "\'")\n'}], 'added': [{'line_no': 5, 'char_start': 190, 'char_end': 273, 'line': ' conn.execute("select * from users where chat_id = ?", (str(message.chat.id),))... | {'deleted': [{'char_start': 244, 'char_end': 245, 'chars': "'"}, {'char_start': 246, 'char_end': 248, 'chars': ' +'}, {'char_start': 269, 'char_end': 275, 'chars': ' + "\'"'}], 'added': [{'char_start': 244, 'char_end': 245, 'chars': '?'}, {'char_start': 246, 'char_end': 247, 'chars': ','}, {'char_start': 248, 'char_end... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
delete | @jwt_required
def delete(self, user_id):
""" Deletes user with the corresponding user_id """
return database_utilities.execute_query(f"""delete from users where user_id = '{user_id}'""") | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 109, 'char_end': 210, 'line': ' return database_utilities.execute_query(f"""delete from users where user_id = \'{user_id}\'""")\n'}], 'added': [{'line_no': 4, 'char_start': 109, 'char_end': 214, 'line': ' return database_utilities.execute_query(f"""delete from use... | {'deleted': [{'char_start': 195, 'char_end': 197, 'chars': "'{"}, {'char_start': 204, 'char_end': 209, 'chars': '}\'"""'}], 'added': [{'char_start': 195, 'char_end': 203, 'chars': '%s""", ('}, {'char_start': 210, 'char_end': 213, 'chars': ', )'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
delete | @jwt_required
def delete(self, user_id):
""" Deletes user with the corresponding user_id """
return database_utilities.execute_query(f"""delete from users where user_id = %s""", (user_id, )) | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 109, 'char_end': 210, 'line': ' return database_utilities.execute_query(f"""delete from users where user_id = \'{user_id}\'""")\n'}], 'added': [{'line_no': 4, 'char_start': 109, 'char_end': 214, 'line': ' return database_utilities.execute_query(f"""delete from use... | {'deleted': [{'char_start': 195, 'char_end': 197, 'chars': "'{"}, {'char_start': 204, 'char_end': 209, 'chars': '}\'"""'}], 'added': [{'char_start': 195, 'char_end': 203, 'chars': '%s""", ('}, {'char_start': 210, 'char_end': 213, 'chars': ', )'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
verify_rno | def verify_rno(self, rno):
query = "SELECT COUNT(rno) FROM rides WHERE rno = {rno}".format(rno = rno)
self.cursor.execute(query)
result = self.cursor.fetchone()
if (int(result[0]) > 0):
return True
else:
return False | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 31, 'char_end': 114, 'line': ' query = "SELECT COUNT(rno) FROM rides WHERE rno = {rno}".format(rno = rno)\n'}, {'line_no': 3, 'char_start': 114, 'char_end': 149, 'line': ' self.cursor.execute(query)\n'}], 'added': [{'line_no': 2, 'char_start': 31, 'char_end': 122,... | {'deleted': [{'char_start': 39, 'char_end': 41, 'chars': 'qu'}, {'char_start': 43, 'char_end': 47, 'chars': 'y = '}, {'char_start': 89, 'char_end': 90, 'chars': '{'}, {'char_start': 93, 'char_end': 94, 'chars': '}'}, {'char_start': 95, 'char_end': 103, 'chars': '.format('}, {'char_start': 106, 'char_end': 108, 'chars':... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
verify_rno | def verify_rno(self, rno):
self.cursor.execute("SELECT COUNT(rno) FROM rides WHERE rno = :rno", {'rno': rno})
result = self.cursor.fetchone()
if (int(result[0]) > 0):
return True
else:
return False | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 31, 'char_end': 114, 'line': ' query = "SELECT COUNT(rno) FROM rides WHERE rno = {rno}".format(rno = rno)\n'}, {'line_no': 3, 'char_start': 114, 'char_end': 149, 'line': ' self.cursor.execute(query)\n'}], 'added': [{'line_no': 2, 'char_start': 31, 'char_end': 122,... | {'deleted': [{'char_start': 39, 'char_end': 41, 'chars': 'qu'}, {'char_start': 43, 'char_end': 47, 'chars': 'y = '}, {'char_start': 89, 'char_end': 90, 'chars': '{'}, {'char_start': 93, 'char_end': 94, 'chars': '}'}, {'char_start': 95, 'char_end': 103, 'chars': '.format('}, {'char_start': 106, 'char_end': 108, 'chars':... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_requested_day | def get_requested_day(self, date):
data = dict()
day_start, day_end = self.get_epoch_day(date)
data['interval'] = {'from': self.convert_local_ts_to_utc(day_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(day_end, self.local_timezone)}
query = '''
SELECT... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 379, 'char_end': 426, 'line': ' WHERE TimeStamp BETWEEN %s AND %s \n'}, {'line_no': 16, 'char_start': 501, 'char_end': 566, 'line': ' for row in self.c.execute(query % (day_start, day_end)):\n'}, {'line_no': 29, 'char_start': 945, 'char_end': 995, 'line': ' ... | {'deleted': [{'char_start': 415, 'char_end': 417, 'chars': '%s'}, {'char_start': 422, 'char_end': 425, 'chars': '%s '}, {'char_start': 540, 'char_end': 542, 'chars': ' %'}, {'char_start': 985, 'char_end': 987, 'chars': '%s'}, {'char_start': 992, 'char_end': 994, 'chars': '%s'}, {'char_start': 1050, 'char_end': 1051, 'c... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_requested_day | def get_requested_day(self, date):
data = dict()
day_start, day_end = self.get_epoch_day(date)
data['interval'] = {'from': self.convert_local_ts_to_utc(day_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(day_end, self.local_timezone)}
query = '''
SELECT... | cwe-089 | {'deleted': [{'line_no': 11, 'char_start': 379, 'char_end': 426, 'line': ' WHERE TimeStamp BETWEEN %s AND %s \n'}, {'line_no': 16, 'char_start': 501, 'char_end': 566, 'line': ' for row in self.c.execute(query % (day_start, day_end)):\n'}, {'line_no': 29, 'char_start': 945, 'char_end': 995, 'line': ' ... | {'deleted': [{'char_start': 415, 'char_end': 417, 'chars': '%s'}, {'char_start': 422, 'char_end': 425, 'chars': '%s '}, {'char_start': 540, 'char_end': 542, 'chars': ' %'}, {'char_start': 985, 'char_end': 987, 'chars': '%s'}, {'char_start': 992, 'char_end': 994, 'chars': '%s'}, {'char_start': 1050, 'char_end': 1051, 'c... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
add_language | def add_language(lang):
try:
cur.execute(f"INSERT INTO language (name) VALUES ('{lang}')")
except Exception as e:
pass
cur.execute(f"SELECT language_id FROM language where name='{lang}'")
lang_id = cur.fetchone()[0]
if conn.commit():
return lang_id
return lang_id | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 33, 'char_end': 103, 'line': ' cur.execute(f"INSERT INTO language (name) VALUES (\'{lang}\')")\n'}, {'line_no': 6, 'char_start': 143, 'char_end': 216, 'line': ' cur.execute(f"SELECT language_id FROM language where name=\'{lang}\'")\n'}], 'added': [{'line_no': 3, 'char... | {'deleted': [{'char_start': 53, 'char_end': 54, 'chars': 'f'}, {'char_start': 91, 'char_end': 93, 'chars': "'{"}, {'char_start': 97, 'char_end': 99, 'chars': "}'"}, {'char_start': 100, 'char_end': 101, 'chars': '"'}, {'char_start': 159, 'char_end': 160, 'chars': 'f'}, {'char_start': 205, 'char_end': 207, 'chars': "'{"}... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
add_language | def add_language(lang):
try:
cur.execute("INSERT INTO language (name) VALUES (%s)", (lang, ))
except Exception as e:
pass
cur.execute("SELECT language_id FROM language where name=%s", (lang, ))
lang_id = cur.fetchone()[0]
if conn.commit():
return lang_id
return lang_id | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 33, 'char_end': 103, 'line': ' cur.execute(f"INSERT INTO language (name) VALUES (\'{lang}\')")\n'}, {'line_no': 6, 'char_start': 143, 'char_end': 216, 'line': ' cur.execute(f"SELECT language_id FROM language where name=\'{lang}\'")\n'}], 'added': [{'line_no': 3, 'char... | {'deleted': [{'char_start': 53, 'char_end': 54, 'chars': 'f'}, {'char_start': 91, 'char_end': 93, 'chars': "'{"}, {'char_start': 97, 'char_end': 99, 'chars': "}'"}, {'char_start': 100, 'char_end': 101, 'chars': '"'}, {'char_start': 159, 'char_end': 160, 'chars': 'f'}, {'char_start': 205, 'char_end': 207, 'chars': "'{"}... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
makeJudge | def makeJudge(judge):
db.execute("UPDATE players SET Judge = 1 WHERE Name = '%s' COLLATE NOCASE" % (judge))
database.commit() | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 22, 'char_end': 110, 'line': '\tdb.execute("UPDATE players SET Judge = 1 WHERE Name = \'%s\' COLLATE NOCASE" % (judge)) \n'}], 'added': [{'line_no': 2, 'char_start': 22, 'char_end': 104, 'line': '\tdb.execute("UPDATE players SET Judge = 1 WHERE Name = ? COLLATE NOCASE", judge) ... | {'deleted': [{'char_start': 77, 'char_end': 81, 'chars': "'%s'"}, {'char_start': 97, 'char_end': 99, 'chars': ' %'}, {'char_start': 100, 'char_end': 101, 'chars': '('}, {'char_start': 106, 'char_end': 107, 'chars': ')'}], 'added': [{'char_start': 77, 'char_end': 78, 'chars': '?'}, {'char_start': 94, 'char_end': 95, 'ch... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
makeJudge | def makeJudge(judge):
db.execute("UPDATE players SET Judge = 1 WHERE Name = ? COLLATE NOCASE", judge)
database.commit() | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 22, 'char_end': 110, 'line': '\tdb.execute("UPDATE players SET Judge = 1 WHERE Name = \'%s\' COLLATE NOCASE" % (judge)) \n'}], 'added': [{'line_no': 2, 'char_start': 22, 'char_end': 104, 'line': '\tdb.execute("UPDATE players SET Judge = 1 WHERE Name = ? COLLATE NOCASE", judge) ... | {'deleted': [{'char_start': 77, 'char_end': 81, 'chars': "'%s'"}, {'char_start': 97, 'char_end': 99, 'chars': ' %'}, {'char_start': 100, 'char_end': 101, 'chars': '('}, {'char_start': 106, 'char_end': 107, 'chars': ')'}], 'added': [{'char_start': 77, 'char_end': 78, 'chars': '?'}, {'char_start': 94, 'char_end': 95, 'ch... | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
isValidAdmToken | def isValidAdmToken(adm_token):
conn, c = connectDB()
req = "SELECT * from {} where adm_token='{}'".format(CFG("admintoken_table_name"), adm_token)
answer = bool(queryOne(c, req))
closeDB(conn)
return answer | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 58, 'char_end': 157, 'line': ' req = "SELECT * from {} where adm_token=\'{}\'".format(CFG("admintoken_table_name"), adm_token)\n'}, {'line_no': 4, 'char_start': 157, 'char_end': 193, 'line': ' answer = bool(queryOne(c, req))\n'}], 'added': [{'line_no': 3, 'char_start': 5... | {'deleted': [{'char_start': 103, 'char_end': 107, 'chars': "'{}'"}, {'char_start': 144, 'char_end': 155, 'chars': ', adm_token'}], 'added': [{'char_start': 103, 'char_end': 104, 'chars': '?'}, {'char_start': 176, 'char_end': 190, 'chars': ', (adm_token,)'}]} | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
isValidAdmToken | def isValidAdmToken(adm_token):
conn, c = connectDB()
req = "SELECT * from {} where adm_token=?".format(CFG("admintoken_table_name"))
answer = bool(queryOne(c, req, (adm_token,)))
closeDB(conn)
return answer | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 58, 'char_end': 157, 'line': ' req = "SELECT * from {} where adm_token=\'{}\'".format(CFG("admintoken_table_name"), adm_token)\n'}, {'line_no': 4, 'char_start': 157, 'char_end': 193, 'line': ' answer = bool(queryOne(c, req))\n'}], 'added': [{'line_no': 3, 'char_start': 5... | {'deleted': [{'char_start': 103, 'char_end': 107, 'chars': "'{}'"}, {'char_start': 144, 'char_end': 155, 'chars': ', adm_token'}], 'added': [{'char_start': 103, 'char_end': 104, 'chars': '?'}, {'char_start': 176, 'char_end': 190, 'chars': ', (adm_token,)'}]} | false | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
get_mapped_projects | @staticmethod
def get_mapped_projects(user_id: int, preferred_locale: str) -> UserMappedProjectsDTO:
""" Get all projects a user has mapped on """
# This query looks scary, but we're really just creating an outer join between the query that gets the
# counts of all mapped tasks and the ... | cwe-089 | {'deleted': [{'line_no': 21, 'char_start': 1137, 'char_end': 1251, 'line': ' WHERE t.project_id IN (SELECT unnest(projects_mapped) FROM users WHERE id = {0})\n'}, {'line_no': 22, 'char_start': 1251, 'char_end': 1311, 'line': ' AND t.validated_by = {0}\n'... | {'deleted': [{'char_start': 1246, 'char_end': 1249, 'chars': '{0}'}, {'char_start': 1307, 'char_end': 1310, 'chars': '{0}'}, {'char_start': 1672, 'char_end': 1675, 'chars': '{0}'}, {'char_start': 1723, 'char_end': 1726, 'chars': '{0}'}, {'char_start': 1916, 'char_end': 1932, 'chars': '.format(user_id)'}], 'added': [{'c... | true | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. |
End of preview. Expand in Data Studio
- Downloads last month
- 3