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 |
|---|---|---|---|---|---|---|---|
update_user | def update_user(username, chat_id, last_update):
conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\users\\" + username + '.db')
conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\cf.db')
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\sett... | cwe-089 | {'deleted': [{'line_no': 8, 'char_start': 426, 'char_end': 527, 'line': ' cursor_settings.execute("select last_problem from users where chat_id = \'" + str(chat_id) + "\'")\n'}, {'line_no': 17, 'char_start': 862, 'char_end': 980, 'line': ' cursor.execute("select * from result where problem = \'" + str(x[0... | {'deleted': [{'char_start': 502, 'char_end': 503, 'chars': "'"}, {'char_start': 504, 'char_end': 506, 'chars': ' +'}, {'char_start': 519, 'char_end': 521, 'chars': ' +'}, {'char_start': 522, 'char_end': 525, 'chars': '"\'"'}, {'char_start': 927, 'char_end': 946, 'chars': '\'" + str(x[0]) + "\''}, {'char_start': 958, '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. |
update_user | def update_user(username, chat_id, last_update):
conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\users\\" + username + '.db')
conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\cf.db')
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\sett... | cwe-089 | {'deleted': [{'line_no': 8, 'char_start': 426, 'char_end': 527, 'line': ' cursor_settings.execute("select last_problem from users where chat_id = \'" + str(chat_id) + "\'")\n'}, {'line_no': 17, 'char_start': 862, 'char_end': 980, 'line': ' cursor.execute("select * from result where problem = \'" + str(x[0... | {'deleted': [{'char_start': 502, 'char_end': 503, 'chars': "'"}, {'char_start': 504, 'char_end': 506, 'chars': ' +'}, {'char_start': 519, 'char_end': 521, 'chars': ' +'}, {'char_start': 522, 'char_end': 525, 'chars': '"\'"'}, {'char_start': 927, 'char_end': 946, 'chars': '\'" + str(x[0]) + "\''}, {'char_start': 958, '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. |
save_accepted_transaction | def save_accepted_transaction(self, user_id, project_id, money):
self.cursor.execute("update users set money = money - %s where id = %s"%(money, user_id))
self.cursor.execute("update projects set money = money + %s where id = %s" % (money, project_id))
self.cursor.execute("insert into transa... | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 69, 'char_end': 167, 'line': ' self.cursor.execute("update users set money = money - %s where id = %s"%(money, user_id))\n'}, {'line_no': 3, 'char_start': 167, 'char_end': 273, 'line': ' self.cursor.execute("update projects set money = money + %s where id = %s" % ... | {'deleted': [{'char_start': 148, 'char_end': 149, 'chars': '%'}, {'char_start': 249, 'char_end': 251, 'chars': ' %'}, {'char_start': 414, 'char_end': 416, 'chars': ' %'}], 'added': [{'char_start': 148, 'char_end': 150, 'chars': ', '}, {'char_start': 250, 'char_end': 251, 'chars': ','}, {'char_start': 390, 'char_end': 4... | 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_accepted_transaction | def save_accepted_transaction(self, user_id, project_id, money):
self.cursor.execute("update users set money = money - %s where id = %s", (money, user_id))
self.cursor.execute("update projects set money = money + %s where id = %s", (money, project_id))
self.cursor.execute("insert into transa... | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 69, 'char_end': 167, 'line': ' self.cursor.execute("update users set money = money - %s where id = %s"%(money, user_id))\n'}, {'line_no': 3, 'char_start': 167, 'char_end': 273, 'line': ' self.cursor.execute("update projects set money = money + %s where id = %s" % ... | {'deleted': [{'char_start': 148, 'char_end': 149, 'chars': '%'}, {'char_start': 249, 'char_end': 251, 'chars': ' %'}, {'char_start': 414, 'char_end': 416, 'chars': ' %'}], 'added': [{'char_start': 148, 'char_end': 150, 'chars': ', '}, {'char_start': 250, 'char_end': 251, 'chars': ','}, {'char_start': 390, 'char_end': 4... | 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. |
shame_ask | def shame_ask(name):
db = db_connect()
cursor = db.cursor()
try:
cursor.execute('''
SELECT shame FROM people WHERE name='{}'
'''.format(name))
shame = cursor.fetchone()
db.close()
if shame is None:
logger.debug('No shame found for name {}'.... | cwe-089 | {'deleted': [{'line_no': 6, 'char_start': 104, 'char_end': 157, 'line': " SELECT shame FROM people WHERE name='{}'\n"}, {'line_no': 7, 'char_start': 157, 'char_end': 187, 'line': " '''.format(name))\n"}], 'added': [{'line_no': 6, 'char_start': 104, 'char_end': 161, 'line': ' SELECT sham... | {'deleted': [{'char_start': 152, 'char_end': 156, 'chars': "'{}'"}, {'char_start': 172, 'char_end': 179, 'chars': '.format'}], 'added': [{'char_start': 152, 'char_end': 160, 'chars': '%(name)s'}, {'char_start': 176, 'char_end': 178, 'chars': ', '}, {'char_start': 183, 'char_end': 185, '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. |
shame_ask | def shame_ask(name):
db = db_connect()
cursor = db.cursor()
try:
cursor.execute('''
SELECT shame FROM people WHERE name=%(name)s
''', (name, ))
shame = cursor.fetchone()
db.close()
if shame is None:
logger.debug('No shame found for name {}'... | cwe-089 | {'deleted': [{'line_no': 6, 'char_start': 104, 'char_end': 157, 'line': " SELECT shame FROM people WHERE name='{}'\n"}, {'line_no': 7, 'char_start': 157, 'char_end': 187, 'line': " '''.format(name))\n"}], 'added': [{'line_no': 6, 'char_start': 104, 'char_end': 161, 'line': ' SELECT sham... | {'deleted': [{'char_start': 152, 'char_end': 156, 'chars': "'{}'"}, {'char_start': 172, 'char_end': 179, 'chars': '.format'}], 'added': [{'char_start': 152, 'char_end': 160, 'chars': '%(name)s'}, {'char_start': 176, 'char_end': 178, 'chars': ', '}, {'char_start': 183, 'char_end': 185, '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. |
incrementOption | def incrementOption(cursor, poll_name, option):
key = poll_name+"-"+option
req = "UPDATE {} SET count=count+1 WHERE name_option = '{}';".format(CFG("options_table_name"), key)
cursor.execute(req) | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 79, 'char_end': 184, 'line': ' req = "UPDATE {} SET count=count+1 WHERE name_option = \'{}\';".format(CFG("options_table_name"), key)\n'}, {'line_no': 4, 'char_start': 184, 'char_end': 207, 'line': ' cursor.execute(req)\n'}], 'added': [{'line_no': 3, 'char_start': 79, 'ch... | {'deleted': [{'char_start': 135, 'char_end': 136, 'chars': ' '}, {'char_start': 137, 'char_end': 143, 'chars': " '{}';"}, {'char_start': 177, 'char_end': 182, 'chars': ', key'}], 'added': [{'char_start': 136, 'char_end': 137, 'chars': '?'}, {'char_start': 195, 'char_end': 203, 'chars': ', (key,)'}]} | 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. |
incrementOption | def incrementOption(cursor, poll_name, option):
key = poll_name+"-"+option
req = "UPDATE {} SET count=count+1 WHERE name_option=?".format(CFG("options_table_name"))
cursor.execute(req, (key,)) | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 79, 'char_end': 184, 'line': ' req = "UPDATE {} SET count=count+1 WHERE name_option = \'{}\';".format(CFG("options_table_name"), key)\n'}, {'line_no': 4, 'char_start': 184, 'char_end': 207, 'line': ' cursor.execute(req)\n'}], 'added': [{'line_no': 3, 'char_start': 79, 'ch... | {'deleted': [{'char_start': 135, 'char_end': 136, 'chars': ' '}, {'char_start': 137, 'char_end': 143, 'chars': " '{}';"}, {'char_start': 177, 'char_end': 182, 'chars': ', key'}], 'added': [{'char_start': 136, 'char_end': 137, 'chars': '?'}, {'char_start': 195, 'char_end': 203, 'chars': ', (key,)'}]} | 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. |
overview | @app.route('/overview/<classNum>')
def overview(classNum):
if 'username' in session:
classNoSpace = classNum.split(' ')[0]+classNum.split(' ')[1]
#Save the current course as a session variable.
session['currentCourse'] = classNoSpace
conn = mysql.connect()
cursor = conn.cursor()
cursor.execute("SELECT c... | cwe-089 | {'deleted': [{'line_no': 12, 'char_start': 294, 'char_end': 408, 'line': '\t\tcursor.execute("SELECT courseName,courseOverview from courses where courseAbbreviation=\'" + classNoSpace + "\'")\n'}], 'added': [{'line_no': 12, 'char_start': 294, 'char_end': 404, 'line': '\t\tcursor.execute("SELECT courseName,courseOvervie... | {'deleted': [{'char_start': 383, 'char_end': 384, 'chars': "'"}, {'char_start': 386, 'char_end': 388, 'chars': '+ '}, {'char_start': 400, 'char_end': 406, 'chars': ' + "\'"'}], 'added': [{'char_start': 383, 'char_end': 385, 'chars': '%s'}, {'char_start': 386, 'char_end': 387, 'chars': ','}, {'char_start': 388, '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. |
overview | @app.route('/overview/<classNum>')
def overview(classNum):
if 'username' in session:
classNoSpace = classNum.split(' ')[0]+classNum.split(' ')[1]
#Save the current course as a session variable.
session['currentCourse'] = classNoSpace
conn = mysql.connect()
cursor = conn.cursor()
cursor.execute("SELECT c... | cwe-089 | {'deleted': [{'line_no': 12, 'char_start': 294, 'char_end': 408, 'line': '\t\tcursor.execute("SELECT courseName,courseOverview from courses where courseAbbreviation=\'" + classNoSpace + "\'")\n'}], 'added': [{'line_no': 12, 'char_start': 294, 'char_end': 404, 'line': '\t\tcursor.execute("SELECT courseName,courseOvervie... | {'deleted': [{'char_start': 383, 'char_end': 384, 'chars': "'"}, {'char_start': 386, 'char_end': 388, 'chars': '+ '}, {'char_start': 400, 'char_end': 406, 'chars': ' + "\'"'}], 'added': [{'char_start': 383, 'char_end': 385, 'chars': '%s'}, {'char_start': 386, 'char_end': 387, 'chars': ','}, {'char_start': 388, '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. |
addTags | def addTags(tag_list, listing_id):
"""
Adds a list of tags tag_list for a given listing with listing_id to the database
"""
cur = conn.cursor()
for x in tag_list:
sql = "INSERT INTO {} VALUES {}".format(listing_tags_table_name, str((listing_id, x)))
cur.execute(sql) | cwe-089 | {'deleted': [{'line_no': 7, 'char_start': 183, 'char_end': 278, 'line': ' sql = "INSERT INTO {} VALUES {}".format(listing_tags_table_name, str((listing_id, x)))\n'}, {'line_no': 8, 'char_start': 278, 'char_end': 302, 'line': ' cur.execute(sql)\n'}], 'added': [{'line_no': 7, 'char_start': 183, 'char_end': ... | {'deleted': [{'char_start': 210, 'char_end': 212, 'chars': '{}'}, {'char_start': 220, 'char_end': 222, 'chars': '{}'}, {'char_start': 223, 'char_end': 226, 'chars': '.fo'}, {'char_start': 227, 'char_end': 229, 'chars': 'ma'}, {'char_start': 256, 'char_end': 261, 'chars': 'str(('}, {'char_start': 276, 'char_end': 302, '... | 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. |
addTags | def addTags(tag_list, listing_id):
"""
Adds a list of tags tag_list for a given listing with listing_id to the database
"""
cur = conn.cursor()
for x in tag_list:
sql = "INSERT INTO %s VALUES (%s %s)"
cur.execute(sql, (listing_tags_table_name, listing_id, x)) | cwe-089 | {'deleted': [{'line_no': 7, 'char_start': 183, 'char_end': 278, 'line': ' sql = "INSERT INTO {} VALUES {}".format(listing_tags_table_name, str((listing_id, x)))\n'}, {'line_no': 8, 'char_start': 278, 'char_end': 302, 'line': ' cur.execute(sql)\n'}], 'added': [{'line_no': 7, 'char_start': 183, 'char_end': ... | {'deleted': [{'char_start': 210, 'char_end': 212, 'chars': '{}'}, {'char_start': 220, 'char_end': 222, 'chars': '{}'}, {'char_start': 223, 'char_end': 226, 'chars': '.fo'}, {'char_start': 227, 'char_end': 229, 'chars': 'ma'}, {'char_start': 256, 'char_end': 261, 'chars': 'str(('}, {'char_start': 276, 'char_end': 302, '... | 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. |
edit | @mod.route('/edit/<int:cmt_id>', methods=['GET', 'POST'])
def edit(cmt_id):
m = None
if request.method == 'GET':
sql = "SELECT * FROM comment where cmt_id = %d;" % (cmt_id)
cursor.execute(sql)
m = cursor.fetchone()
return render_template('comment/edit.html', m=m, cmt_id=cmt_id)
... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 121, 'char_end': 189, 'line': ' sql = "SELECT * FROM comment where cmt_id = %d;" % (cmt_id)\n'}, {'line_no': 6, 'char_start': 189, 'char_end': 217, 'line': ' cursor.execute(sql)\n'}, {'line_no': 12, 'char_start': 395, 'char_end': 468, 'line': ' sql = "UPDAT... | {'deleted': [{'char_start': 130, 'char_end': 135, 'chars': 'ql = '}, {'char_start': 174, 'char_end': 175, 'chars': 'd'}, {'char_start': 177, 'char_end': 179, 'chars': ' %'}, {'char_start': 188, 'char_end': 215, 'chars': '\n cursor.execute(sql'}, {'char_start': 404, 'char_end': 409, 'chars': 'ql = '}, {'char_star... | 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. |
edit | @mod.route('/edit/<int:cmt_id>', methods=['GET', 'POST'])
def edit(cmt_id):
m = None
if request.method == 'GET':
cursor.execute("SELECT * FROM comment where cmt_id = %s;", (cmt_id,))
m = cursor.fetchone()
return render_template('comment/edit.html', m=m, cmt_id=cmt_id)
if request.met... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 121, 'char_end': 189, 'line': ' sql = "SELECT * FROM comment where cmt_id = %d;" % (cmt_id)\n'}, {'line_no': 6, 'char_start': 189, 'char_end': 217, 'line': ' cursor.execute(sql)\n'}, {'line_no': 12, 'char_start': 395, 'char_end': 468, 'line': ' sql = "UPDAT... | {'deleted': [{'char_start': 130, 'char_end': 135, 'chars': 'ql = '}, {'char_start': 174, 'char_end': 175, 'chars': 'd'}, {'char_start': 177, 'char_end': 179, 'chars': ' %'}, {'char_start': 188, 'char_end': 215, 'chars': '\n cursor.execute(sql'}, {'char_start': 404, 'char_end': 409, 'chars': 'ql = '}, {'char_star... | 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. |
process_form | def process_form():
# see https://docs.python.org/3.4/library/cgi.html for the basic usage
# here.
form = cgi.FieldStorage()
if "player1" not in form or "player2" not in form or "size" not in form:
raise FormError("Invalid parameters.")
player1 = form["player1"].value
player2 = form["... | cwe-089 | {'deleted': [{'line_no': 35, 'char_start': 1148, 'char_end': 1261, 'line': ' cursor.execute("""INSERT INTO games(player1,player2,size) VALUES("%s","%s",%d);""" % (player1,player2,size))\n'}], 'added': [{'line_no': 35, 'char_start': 1148, 'char_end': 1260, 'line': ' cursor.execute("""INSERT INTO games(player1,play... | {'deleted': [{'char_start': 1234, 'char_end': 1236, 'chars': ' %'}], 'added': [{'char_start': 1234, 'char_end': 1235, '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. |
process_form | def process_form():
# see https://docs.python.org/3.4/library/cgi.html for the basic usage
# here.
form = cgi.FieldStorage()
if "player1" not in form or "player2" not in form or "size" not in form:
raise FormError("Invalid parameters.")
player1 = form["player1"].value
player2 = form["... | cwe-089 | {'deleted': [{'line_no': 35, 'char_start': 1148, 'char_end': 1261, 'line': ' cursor.execute("""INSERT INTO games(player1,player2,size) VALUES("%s","%s",%d);""" % (player1,player2,size))\n'}], 'added': [{'line_no': 35, 'char_start': 1148, 'char_end': 1260, 'line': ' cursor.execute("""INSERT INTO games(player1,play... | {'deleted': [{'char_start': 1234, 'char_end': 1236, 'chars': ' %'}], 'added': [{'char_start': 1234, 'char_end': 1235, '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. |
clean_cache | def clean_cache(self, limit):
"""
Method that remove several User objects from cache - the least
active users
:param limit: number of the users that the method should remove
from cache
:return: None
"""
log.info('Figuring out the least active users..... | cwe-089 | {'deleted': [{'line_no': 18, 'char_start': 628, 'char_end': 663, 'line': " f'LIMIT {limit}')\n"}, {'line_no': 21, 'char_start': 677, 'char_end': 722, 'line': ' cursor = db.execute_query(query)\n'}], 'added': [{'line_no': 18, 'char_start': 628, 'char_end': 658, 'line': " f'LIMI... | {'deleted': [{'char_start': 653, 'char_end': 654, 'chars': '{'}, {'char_start': 659, 'char_end': 662, 'chars': "}')"}], 'added': [{'char_start': 653, 'char_end': 680, 'chars': "%s')\n\n parameters = "}, {'char_start': 685, 'char_end': 686, 'chars': ','}, {'char_start': 744, 'char_end': 756, 'chars': ', parameter... | 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. |
clean_cache | def clean_cache(self, limit):
"""
Method that remove several User objects from cache - the least
active users
:param limit: number of the users that the method should remove
from cache
:return: None
"""
log.info('Figuring out the least active users..... | cwe-089 | {'deleted': [{'line_no': 18, 'char_start': 628, 'char_end': 663, 'line': " f'LIMIT {limit}')\n"}, {'line_no': 21, 'char_start': 677, 'char_end': 722, 'line': ' cursor = db.execute_query(query)\n'}], 'added': [{'line_no': 18, 'char_start': 628, 'char_end': 658, 'line': " f'LIMI... | {'deleted': [{'char_start': 653, 'char_end': 654, 'chars': '{'}, {'char_start': 659, 'char_end': 662, 'chars': "}')"}], 'added': [{'char_start': 653, 'char_end': 680, 'chars': "%s')\n\n parameters = "}, {'char_start': 685, 'char_end': 686, 'chars': ','}, {'char_start': 744, 'char_end': 756, 'chars': ', parameter... | 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. |
quiz | @app.route('/quiz')
def quiz():
varga = request.args.get('varga')
try:
rows =[]
with sql.connect('amara.db') as con:
con.row_factory = sql.Row
cur = con.cursor()
cur.execute("select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada... | cwe-089 | {'deleted': [{'line_no': 12, 'char_start': 213, 'char_end': 371, 'line': ' cur.execute("select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = \'%s\' order by random() limit 1;" % varga)\n'}, {'line_no': 16, 'char_start': 445, 'char_end': 560, 'line': ' cur.exec... | {'deleted': [{'char_start': 329, 'char_end': 333, 'chars': "'%s'"}, {'char_start': 361, 'char_end': 363, 'chars': ' %'}, {'char_start': 506, 'char_end': 510, 'chars': "'%s'"}, {'char_start': 523, 'char_end': 527, 'chars': "'%s'"}, {'char_start': 540, 'char_end': 542, 'chars': ' %'}, {'char_start': 543, 'char_end': 544,... | 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. |
quiz | @app.route('/quiz')
def quiz():
varga = request.args.get('varga')
try:
rows =[]
with sql.connect('amara.db') as con:
con.row_factory = sql.Row
cur = con.cursor()
cur.execute("select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada... | cwe-089 | {'deleted': [{'line_no': 12, 'char_start': 213, 'char_end': 371, 'line': ' cur.execute("select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = \'%s\' order by random() limit 1;" % varga)\n'}, {'line_no': 16, 'char_start': 445, 'char_end': 560, 'line': ' cur.exec... | {'deleted': [{'char_start': 329, 'char_end': 333, 'chars': "'%s'"}, {'char_start': 361, 'char_end': 363, 'chars': ' %'}, {'char_start': 506, 'char_end': 510, 'chars': "'%s'"}, {'char_start': 523, 'char_end': 527, 'chars': "'%s'"}, {'char_start': 540, 'char_end': 542, 'chars': ' %'}, {'char_start': 543, 'char_end': 544,... | 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. |
reportMatch._checkPairing | def _checkPairing():
if winner == loser:
raise ValueError('Attempt to match player against self')
q = '''
SELECT COUNT(*) FROM matches
WHERE (matches.winner_id = %s AND matches.loser_id = %s)
OR (matches.winner_id = %s AND matches.loser_id = %s);
''... | cwe-089 | {'deleted': [{'line_no': 9, 'char_start': 310, 'char_end': 355, 'line': " ''' % (winner, loser, loser, winner)\n"}, {'line_no': 10, 'char_start': 355, 'char_end': 378, 'line': ' cur.execute(q)\n'}], 'added': [{'line_no': 9, 'char_start': 310, 'char_end': 322, 'line': " '''\n"}, {'line_no': 10, 'cha... | {'deleted': [{'char_start': 322, 'char_end': 323, 'chars': '%'}, {'char_start': 354, 'char_end': 376, 'chars': '\n cur.execute(q'}], 'added': [{'char_start': 321, 'char_end': 327, 'chars': '\n '}, {'char_start': 328, 'char_end': 344, 'chars': ' cur.execute(q,'}]} | 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. |
reportMatch._checkPairing | def _checkPairing():
if winner == loser:
raise ValueError('Attempt to match player against self')
q = '''
SELECT COUNT(*) FROM matches
WHERE (matches.winner_id = %s AND matches.loser_id = %s)
OR (matches.winner_id = %s AND matches.loser_id = %s);
''... | cwe-089 | {'deleted': [{'line_no': 9, 'char_start': 310, 'char_end': 355, 'line': " ''' % (winner, loser, loser, winner)\n"}, {'line_no': 10, 'char_start': 355, 'char_end': 378, 'line': ' cur.execute(q)\n'}], 'added': [{'line_no': 9, 'char_start': 310, 'char_end': 322, 'line': " '''\n"}, {'line_no': 10, 'cha... | {'deleted': [{'char_start': 322, 'char_end': 323, 'chars': '%'}, {'char_start': 354, 'char_end': 376, 'chars': '\n cur.execute(q'}], 'added': [{'char_start': 321, 'char_end': 327, 'chars': '\n '}, {'char_start': 328, 'char_end': 344, 'chars': ' cur.execute(q,'}]} | 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_month_data_row | def add_month_data_row(self, inverter_serial, ts, etoday, etotal):
y = datetime.fromtimestamp(ts) - timedelta(days=1)
y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())
query = '''
INSERT INTO MonthData (
TimeStamp,
Ser... | cwe-089 | {'deleted': [{'line_no': 13, 'char_start': 434, 'char_end': 454, 'line': ' %s,\n'}, {'line_no': 14, 'char_start': 454, 'char_end': 474, 'line': ' %s,\n'}, {'line_no': 15, 'char_start': 474, 'char_end': 494, 'line': ' %s,\n'}, {'line_no': 16, 'char_start': 494, 'char_end': 51... | {'deleted': [{'char_start': 450, 'char_end': 452, 'chars': '%s'}, {'char_start': 470, 'char_end': 472, 'chars': '%s'}, {'char_start': 490, 'char_end': 492, 'chars': '%s'}, {'char_start': 510, 'char_end': 512, 'chars': '%s'}, {'char_start': 540, 'char_end': 541, 'chars': '%'}, {'char_start': 581, 'char_end': 610, '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_month_data_row | def add_month_data_row(self, inverter_serial, ts, etoday, etotal):
y = datetime.fromtimestamp(ts) - timedelta(days=1)
y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())
query = '''
INSERT INTO MonthData (
TimeStamp,
Ser... | cwe-089 | {'deleted': [{'line_no': 13, 'char_start': 434, 'char_end': 454, 'line': ' %s,\n'}, {'line_no': 14, 'char_start': 454, 'char_end': 474, 'line': ' %s,\n'}, {'line_no': 15, 'char_start': 474, 'char_end': 494, 'line': ' %s,\n'}, {'line_no': 16, 'char_start': 494, 'char_end': 51... | {'deleted': [{'char_start': 450, 'char_end': 452, 'chars': '%s'}, {'char_start': 470, 'char_end': 472, 'chars': '%s'}, {'char_start': 490, 'char_end': 492, 'chars': '%s'}, {'char_start': 510, 'char_end': 512, 'chars': '%s'}, {'char_start': 540, 'char_end': 541, 'chars': '%'}, {'char_start': 581, 'char_end': 610, '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. |
create_playlist | def create_playlist(name, db):
db.execute(
"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);".format(name=name)) | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 47, 'char_end': 140, 'line': ' "INSERT INTO playlist (name, video_position) VALUES(\'{name}\', 0);".format(name=name))\n'}], 'added': [{'line_no': 3, 'char_start': 47, 'char_end': 125, 'line': ' "INSERT INTO playlist (name, video_position) VALUES(%s, 0);", (name,)... | {'deleted': [{'char_start': 107, 'char_end': 115, 'chars': "'{name}'"}, {'char_start': 121, 'char_end': 128, 'chars': '.format'}, {'char_start': 133, 'char_end': 138, 'chars': '=name'}], 'added': [{'char_start': 107, 'char_end': 109, 'chars': '%s'}, {'char_start': 115, 'char_end': 117, 'chars': ', '}, {'char_start': 12... | 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. |
create_playlist | def create_playlist(name, db):
db.execute(
"INSERT INTO playlist (name, video_position) VALUES(%s, 0);", (name,)) | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 47, 'char_end': 140, 'line': ' "INSERT INTO playlist (name, video_position) VALUES(\'{name}\', 0);".format(name=name))\n'}], 'added': [{'line_no': 3, 'char_start': 47, 'char_end': 125, 'line': ' "INSERT INTO playlist (name, video_position) VALUES(%s, 0);", (name,)... | {'deleted': [{'char_start': 107, 'char_end': 115, 'chars': "'{name}'"}, {'char_start': 121, 'char_end': 128, 'chars': '.format'}, {'char_start': 133, 'char_end': 138, 'chars': '=name'}], 'added': [{'char_start': 107, 'char_end': 109, 'chars': '%s'}, {'char_start': 115, 'char_end': 117, 'chars': ', '}, {'char_start': 12... | 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. |
karma_ask | def karma_ask(name):
db = db_connect()
cursor = db.cursor()
try:
cursor.execute(
''' SELECT karma FROM people WHERE name='{}' '''.format(name))
karma = cursor.fetchone()
if karma is None:
logger.debug('No karma found for name {}'.format(name))
db.c... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 77, 'char_end': 101, 'line': ' cursor.execute(\n'}, {'line_no': 6, 'char_start': 101, 'char_end': 176, 'line': " ''' SELECT karma FROM people WHERE name='{}' '''.format(name))\n"}], 'added': [{'line_no': 5, 'char_start': 77, 'char_end': 154, 'line': " c... | {'deleted': [{'char_start': 100, 'char_end': 113, 'chars': '\n '}, {'char_start': 153, 'char_end': 157, 'chars': "'{}'"}, {'char_start': 161, 'char_end': 168, 'chars': '.format'}], 'added': [{'char_start': 140, 'char_end': 148, 'chars': '%(name)s'}, {'char_start': 152, 'char_end': 177, 'chars': ',\n ... | 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. |
karma_ask | def karma_ask(name):
db = db_connect()
cursor = db.cursor()
try:
cursor.execute(''' SELECT karma FROM people WHERE name=%(name)s ''',
(name, ))
karma = cursor.fetchone()
if karma is None:
logger.debug('No karma found for name {}'.format(name))
... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 77, 'char_end': 101, 'line': ' cursor.execute(\n'}, {'line_no': 6, 'char_start': 101, 'char_end': 176, 'line': " ''' SELECT karma FROM people WHERE name='{}' '''.format(name))\n"}], 'added': [{'line_no': 5, 'char_start': 77, 'char_end': 154, 'line': " c... | {'deleted': [{'char_start': 100, 'char_end': 113, 'chars': '\n '}, {'char_start': 153, 'char_end': 157, 'chars': "'{}'"}, {'char_start': 161, 'char_end': 168, 'chars': '.format'}], 'added': [{'char_start': 140, 'char_end': 148, 'chars': '%(name)s'}, {'char_start': 152, 'char_end': 177, 'chars': ',\n ... | 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. |
post | def post(self):
""" Returns JWT upon login verification """
json_data = request.get_json()
if not json_data['email']:
return jsonify({"msg": "Missing email"}), 400
data = database_utilities.execute_query(
f"""select * from admins where email = '{json_data['em... | cwe-089 | {'deleted': [{'line_no': 8, 'char_start': 254, 'char_end': 332, 'line': ' f"""select * from admins where email = \'{json_data[\'email\']}\'""")\n'}], 'added': [{'line_no': 8, 'char_start': 254, 'char_end': 336, 'line': ' f"""select * from admins where email = %s""", (json_data[\'email\'], ))\n'}]} | {'deleted': [{'char_start': 305, 'char_end': 307, 'chars': "'{"}, {'char_start': 325, 'char_end': 330, 'chars': '}\'"""'}], 'added': [{'char_start': 305, 'char_end': 313, 'chars': '%s""", ('}, {'char_start': 331, 'char_end': 334, '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. |
post | def post(self):
""" Returns JWT upon login verification """
json_data = request.get_json()
if not json_data['email']:
return jsonify({"msg": "Missing email"}), 400
data = database_utilities.execute_query(
f"""select * from admins where email = %s""", (json_da... | cwe-089 | {'deleted': [{'line_no': 8, 'char_start': 254, 'char_end': 332, 'line': ' f"""select * from admins where email = \'{json_data[\'email\']}\'""")\n'}], 'added': [{'line_no': 8, 'char_start': 254, 'char_end': 336, 'line': ' f"""select * from admins where email = %s""", (json_data[\'email\'], ))\n'}]} | {'deleted': [{'char_start': 305, 'char_end': 307, 'chars': "'{"}, {'char_start': 325, 'char_end': 330, 'chars': '}\'"""'}], 'added': [{'char_start': 305, 'char_end': 313, 'chars': '%s""", ('}, {'char_start': 331, 'char_end': 334, '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. |
add_day_data_row | def add_day_data_row(self, ts, data, prev_etotal):
if data['power'] > 0:
inv_serial = data['source']['serial_id']
query = '''
INSERT INTO DayData (
TimeStamp,
Serial,
Power,
TotalYield
... | cwe-089 | {'deleted': [{'line_no': 13, 'char_start': 340, 'char_end': 363, 'line': ' %s,\n'}, {'line_no': 14, 'char_start': 363, 'char_end': 386, 'line': ' %s,\n'}, {'line_no': 15, 'char_start': 386, 'char_end': 409, 'line': ' %s,\n'}, {'line_no': 16, 'char_start': 409, 'char... | {'deleted': [{'char_start': 359, 'char_end': 361, 'chars': '%s'}, {'char_start': 382, 'char_end': 384, 'chars': '%s'}, {'char_start': 405, 'char_end': 407, 'chars': '%s'}, {'char_start': 428, 'char_end': 430, 'chars': '%s'}, {'char_start': 465, 'char_end': 466, 'chars': '%'}, {'char_start': 529, 'char_end': 562, '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_day_data_row | def add_day_data_row(self, ts, data, prev_etotal):
if data['power'] > 0:
inv_serial = data['source']['serial_id']
query = '''
INSERT INTO DayData (
TimeStamp,
Serial,
Power,
TotalYield
... | cwe-089 | {'deleted': [{'line_no': 13, 'char_start': 340, 'char_end': 363, 'line': ' %s,\n'}, {'line_no': 14, 'char_start': 363, 'char_end': 386, 'line': ' %s,\n'}, {'line_no': 15, 'char_start': 386, 'char_end': 409, 'line': ' %s,\n'}, {'line_no': 16, 'char_start': 409, 'char... | {'deleted': [{'char_start': 359, 'char_end': 361, 'chars': '%s'}, {'char_start': 382, 'char_end': 384, 'chars': '%s'}, {'char_start': 405, 'char_end': 407, 'chars': '%s'}, {'char_start': 428, 'char_end': 430, 'chars': '%s'}, {'char_start': 465, 'char_end': 466, 'chars': '%'}, {'char_start': 529, 'char_end': 562, '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. |
store_metadata | def store_metadata(self, session, key, mType, value):
if (self.idNormalizer is not None):
id = self.idNormalizer.process_string(session, id)
elif type(id) == unicode:
id = id.encode('utf-8')
else:
id = str(id)
self._openContainer(session)
q... | cwe-089 | {'deleted': [{'line_no': 9, 'char_start': 311, 'char_end': 379, 'line': ' query = ("UPDATE %s SET %s = %r WHERE identifier = \'%s\';" %\n'}, {'line_no': 10, 'char_start': 379, 'char_end': 427, 'line': ' (self.table, mType, value, id)\n'}, {'line_no': 13, 'char_start': 459, 'char_end': 490, 'line'... | {'deleted': [{'char_start': 348, 'char_end': 350, 'chars': '%r'}, {'char_start': 370, 'char_end': 374, 'chars': "'%s'"}, {'char_start': 414, 'char_end': 415, 'chars': ','}, {'char_start': 416, 'char_end': 422, 'chars': 'value,'}, {'char_start': 423, 'char_end': 425, 'chars': 'id'}, {'char_start': 435, 'char_end': 441, ... | 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. |
store_metadata | def store_metadata(self, session, key, mType, value):
if (self.idNormalizer is not None):
id = self.idNormalizer.process_string(session, id)
elif type(id) == unicode:
id = id.encode('utf-8')
else:
id = str(id)
self._openContainer(session)
q... | cwe-089 | {'deleted': [{'line_no': 9, 'char_start': 311, 'char_end': 379, 'line': ' query = ("UPDATE %s SET %s = %r WHERE identifier = \'%s\';" %\n'}, {'line_no': 10, 'char_start': 379, 'char_end': 427, 'line': ' (self.table, mType, value, id)\n'}, {'line_no': 13, 'char_start': 459, 'char_end': 490, 'line'... | {'deleted': [{'char_start': 348, 'char_end': 350, 'chars': '%r'}, {'char_start': 370, 'char_end': 374, 'chars': "'%s'"}, {'char_start': 414, 'char_end': 415, 'chars': ','}, {'char_start': 416, 'char_end': 422, 'chars': 'value,'}, {'char_start': 423, 'char_end': 425, 'chars': 'id'}, {'char_start': 435, 'char_end': 441, ... | 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 | def get(self, space_id):
""" Fetch data for space with the corresponding space_id """
return database_utilities.execute_query(
f"""select * from spaces where space_id = '{space_id}'""") | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 147, 'char_end': 217, 'line': ' f"""select * from spaces where space_id = \'{space_id}\'""")\n'}], 'added': [{'line_no': 4, 'char_start': 147, 'char_end': 221, 'line': ' f"""select * from spaces where space_id = %s""", (space_id, ))\n'}]} | {'deleted': [{'char_start': 201, 'char_end': 203, 'chars': "'{"}, {'char_start': 211, 'char_end': 216, 'chars': '}\'"""'}], 'added': [{'char_start': 201, 'char_end': 209, 'chars': '%s""", ('}, {'char_start': 217, 'char_end': 220, '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. |
get | def get(self, space_id):
""" Fetch data for space with the corresponding space_id """
return database_utilities.execute_query(
f"""select * from spaces where space_id = %s""", (space_id, )) | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 147, 'char_end': 217, 'line': ' f"""select * from spaces where space_id = \'{space_id}\'""")\n'}], 'added': [{'line_no': 4, 'char_start': 147, 'char_end': 221, 'line': ' f"""select * from spaces where space_id = %s""", (space_id, ))\n'}]} | {'deleted': [{'char_start': 201, 'char_end': 203, 'chars': "'{"}, {'char_start': 211, 'char_end': 216, 'chars': '}\'"""'}], 'added': [{'char_start': 201, 'char_end': 209, 'chars': '%s""", ('}, {'char_start': 217, 'char_end': 220, '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 | def check(current_num):
try:
cursor.execute('SELECT * FROM comics WHERE num="%s"' % current_num)
except sqlite3.OperationalError:
cursor.execute('CREATE TABLE comics (num text)')
return False
else:
return False if cursor.fetchone() is None else True | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 33, 'char_end': 109, 'line': ' cursor.execute(\'SELECT * FROM comics WHERE num="%s"\' % current_num)\n'}], 'added': [{'line_no': 3, 'char_start': 33, 'char_end': 108, 'line': " cursor.execute('SELECT * FROM comics WHERE num=?', (current_num,))\n"}]} | {'deleted': [{'char_start': 88, 'char_end': 92, 'chars': '"%s"'}, {'char_start': 93, 'char_end': 95, 'chars': ' %'}], 'added': [{'char_start': 88, 'char_end': 89, 'chars': '?'}, {'char_start': 90, 'char_end': 91, 'chars': ','}, {'char_start': 92, 'char_end': 93, 'chars': '('}, {'char_start': 104, 'char_end': 106, '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. |
check | def check(current_num):
try:
cursor.execute('SELECT * FROM comics WHERE num=?', (current_num,))
except sqlite3.OperationalError:
cursor.execute('CREATE TABLE comics (num text)')
return False
else:
return False if cursor.fetchone() is None else True | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 33, 'char_end': 109, 'line': ' cursor.execute(\'SELECT * FROM comics WHERE num="%s"\' % current_num)\n'}], 'added': [{'line_no': 3, 'char_start': 33, 'char_end': 108, 'line': " cursor.execute('SELECT * FROM comics WHERE num=?', (current_num,))\n"}]} | {'deleted': [{'char_start': 88, 'char_end': 92, 'chars': '"%s"'}, {'char_start': 93, 'char_end': 95, 'chars': ' %'}], 'added': [{'char_start': 88, 'char_end': 89, 'chars': '?'}, {'char_start': 90, 'char_end': 91, 'chars': ','}, {'char_start': 92, 'char_end': 93, 'chars': '('}, {'char_start': 104, 'char_end': 106, '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_crawl | @app.route('/delete_crawl', methods=['POST'])
@is_logged_in
def delete_crawl():
# Get Form Fields
cid = request.form['cid']
# Create cursor
cur = mysql.connection.cursor()
# Get user by username
result = cur.execute("DELETE FROM Crawls WHERE cid = %s" % cid)
#... | cwe-089 | {'deleted': [{'line_no': 12, 'char_start': 238, 'char_end': 310, 'line': ' result = cur.execute("DELETE FROM Crawls WHERE cid = %s" % cid)\n'}], 'added': [{'line_no': 12, 'char_start': 238, 'char_end': 315, 'line': ' result = cur.execute("""DELETE FROM Crawls WHERE cid = %s""" (cid,))\n'}]} | {'deleted': [{'char_start': 303, 'char_end': 305, 'chars': '% '}], 'added': [{'char_start': 268, 'char_end': 270, 'chars': '""'}, {'char_start': 304, 'char_end': 306, 'chars': '""'}, {'char_start': 307, 'char_end': 308, 'chars': '('}, {'char_start': 311, 'char_end': 313, '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_crawl | @app.route('/delete_crawl', methods=['POST'])
@is_logged_in
def delete_crawl():
# Get Form Fields
cid = request.form['cid']
# Create cursor
cur = mysql.connection.cursor()
# Get user by username
result = cur.execute("""DELETE FROM Crawls WHERE cid = %s""" (cid,))
... | cwe-089 | {'deleted': [{'line_no': 12, 'char_start': 238, 'char_end': 310, 'line': ' result = cur.execute("DELETE FROM Crawls WHERE cid = %s" % cid)\n'}], 'added': [{'line_no': 12, 'char_start': 238, 'char_end': 315, 'line': ' result = cur.execute("""DELETE FROM Crawls WHERE cid = %s""" (cid,))\n'}]} | {'deleted': [{'char_start': 303, 'char_end': 305, 'chars': '% '}], 'added': [{'char_start': 268, 'char_end': 270, 'chars': '""'}, {'char_start': 304, 'char_end': 306, 'chars': '""'}, {'char_start': 307, 'char_end': 308, 'chars': '('}, {'char_start': 311, 'char_end': 313, '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. |
add_movie | @app.route('/movies/add', methods=['GET', 'POST'])
def add_movie():
form = MovieForm()
if not form.validate_on_submit():
return render_template('new_movie.html', title='Add New Movie', form=form)
lang_id = add_language(form.data['language'])
movie = {
'title': '',
'descri... | cwe-089 | {'deleted': [{'line_no': 22, 'char_start': 784, 'char_end': 836, 'line': " VALUES ('{}', '{}', {}, {}, {}, {}, {}, {})\n"}, {'line_no': 23, 'char_start': 836, 'char_end': 887, 'line': ' """.format(*[v for k, v in movie.items()])\n'}, {'line_no': 26, 'char_start': 902, 'char_end': 989, 'line': ' cur... | {'deleted': [{'char_start': 800, 'char_end': 804, 'chars': "'{}'"}, {'char_start': 806, 'char_end': 810, 'chars': "'{}'"}, {'char_start': 812, 'char_end': 814, 'chars': '{}'}, {'char_start': 816, 'char_end': 818, 'chars': '{}'}, {'char_start': 820, 'char_end': 822, 'chars': '{}'}, {'char_start': 824, 'char_end': 826, '... | 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_movie | @app.route('/movies/add', methods=['GET', 'POST'])
def add_movie():
form = MovieForm()
if not form.validate_on_submit():
return render_template('new_movie.html', title='Add New Movie', form=form)
lang_id = add_language(form.data['language'])
movie = {
'title': '',
'descri... | cwe-089 | {'deleted': [{'line_no': 22, 'char_start': 784, 'char_end': 836, 'line': " VALUES ('{}', '{}', {}, {}, {}, {}, {}, {})\n"}, {'line_no': 23, 'char_start': 836, 'char_end': 887, 'line': ' """.format(*[v for k, v in movie.items()])\n'}, {'line_no': 26, 'char_start': 902, 'char_end': 989, 'line': ' cur... | {'deleted': [{'char_start': 800, 'char_end': 804, 'chars': "'{}'"}, {'char_start': 806, 'char_end': 810, 'chars': "'{}'"}, {'char_start': 812, 'char_end': 814, 'chars': '{}'}, {'char_start': 816, 'char_end': 818, 'chars': '{}'}, {'char_start': 820, 'char_end': 822, 'chars': '{}'}, {'char_start': 824, 'char_end': 826, '... | 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. |
new_category | def new_category(category_name):
try:
conn = check_heroku_db()
cur = conn.cursor()
cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))
conn.commit()
conn.close()
except psycopg2.DatabaseError as e:
print('Error %s' % e)
sys.... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 103, 'char_end': 194, 'line': " cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))\n"}], 'added': [{'line_no': 5, 'char_start': 103, 'char_end': 104, 'line': '\n'}, {'line_no': 6, 'char_start': 104, 'char_end': 169, 'line': ' query ... | {'deleted': [{'char_start': 111, 'char_end': 112, 'chars': 'c'}, {'char_start': 114, 'char_end': 126, 'chars': ".execute('''"}, {'char_start': 171, 'char_end': 175, 'chars': "''',"}], 'added': [{'char_start': 103, 'char_end': 104, 'chars': '\n'}, {'char_start': 112, 'char_end': 113, 'chars': 'q'}, {'char_start': 115, '... | 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. |
new_category | def new_category(category_name):
try:
conn = check_heroku_db()
cur = conn.cursor()
query = "INSERT INTO categories (cat_name) VALUES (%s);"
data = (category_name,)
cur.execute(query, data)
conn.commit()
conn.close()
except psycopg2.DatabaseError as e:
... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 103, 'char_end': 194, 'line': " cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))\n"}], 'added': [{'line_no': 5, 'char_start': 103, 'char_end': 104, 'line': '\n'}, {'line_no': 6, 'char_start': 104, 'char_end': 169, 'line': ' query ... | {'deleted': [{'char_start': 111, 'char_end': 112, 'chars': 'c'}, {'char_start': 114, 'char_end': 126, 'chars': ".execute('''"}, {'char_start': 171, 'char_end': 175, 'chars': "''',"}], 'added': [{'char_start': 103, 'char_end': 104, 'chars': '\n'}, {'char_start': 112, 'char_end': 113, 'chars': 'q'}, {'char_start': 115, '... | 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_month | def get_first_month(db, scene):
sql = "select date from matches where scene='{}' order by date limit 1;".format(scene)
res = db.exec(sql)
date = res[0][0]
return date | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 32, 'char_end': 123, 'line': ' sql = "select date from matches where scene=\'{}\' order by date limit 1;".format(scene)\n'}, {'line_no': 3, 'char_start': 123, 'char_end': 146, 'line': ' res = db.exec(sql)\n'}], 'added': [{'line_no': 2, 'char_start': 32, 'char_end': 114, '... | {'deleted': [{'char_start': 108, 'char_end': 111, 'chars': '.fo'}, {'char_start': 112, 'char_end': 116, 'chars': 'mat('}, {'char_start': 121, 'char_end': 122, 'chars': ')'}], 'added': [{'char_start': 82, 'char_end': 87, 'chars': 'scene'}, {'char_start': 113, 'char_end': 119, 'chars': '\n a'}, {'char_start': 120, '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_month | def get_first_month(db, scene):
sql = "select date from matches where scene='{scene}' order by date limit 1;"
args = {'scene': scene}
res = db.exec(sql, args)
date = res[0][0]
return date | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 32, 'char_end': 123, 'line': ' sql = "select date from matches where scene=\'{}\' order by date limit 1;".format(scene)\n'}, {'line_no': 3, 'char_start': 123, 'char_end': 146, 'line': ' res = db.exec(sql)\n'}], 'added': [{'line_no': 2, 'char_start': 32, 'char_end': 114, '... | {'deleted': [{'char_start': 108, 'char_end': 111, 'chars': '.fo'}, {'char_start': 112, 'char_end': 116, 'chars': 'mat('}, {'char_start': 121, 'char_end': 122, 'chars': ')'}], 'added': [{'char_start': 82, 'char_end': 87, 'chars': 'scene'}, {'char_start': 113, 'char_end': 119, 'chars': '\n a'}, {'char_start': 120, '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. |
getOptions | def getOptions(poll_name):
conn, c = connectDB()
options_str = queryOne(c, "SELECT options FROM {} WHERE name='{}'".format(CFG("poll_table_name"), poll_name))
if options_str == None:
return None
options = options_str.split(",")
closeDB(conn)
return options | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 53, 'char_end': 167, 'line': ' options_str = queryOne(c, "SELECT options FROM {} WHERE name=\'{}\'".format(CFG("poll_table_name"), poll_name))\n'}], 'added': [{'line_no': 3, 'char_start': 53, 'char_end': 132, 'line': ' req = "SELECT options FROM {} WHERE name=?".format(CF... | {'deleted': [{'char_start': 57, 'char_end': 67, 'chars': 'options_st'}, {'char_start': 71, 'char_end': 83, 'chars': 'queryOne(c, '}, {'char_start': 118, 'char_end': 122, 'chars': "'{}'"}], 'added': [{'char_start': 58, 'char_end': 60, 'chars': 'eq'}, {'char_start': 98, 'char_end': 99, 'chars': '?'}, {'char_start': 130, ... | 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. |
getOptions | def getOptions(poll_name):
conn, c = connectDB()
req = "SELECT options FROM {} WHERE name=?".format(CFG("poll_table_name"))
options_str = queryOne(c, req, (poll_name,))
if options_str == None:
return None
options = options_str.split(",")
closeDB(conn)
return options | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 53, 'char_end': 167, 'line': ' options_str = queryOne(c, "SELECT options FROM {} WHERE name=\'{}\'".format(CFG("poll_table_name"), poll_name))\n'}], 'added': [{'line_no': 3, 'char_start': 53, 'char_end': 132, 'line': ' req = "SELECT options FROM {} WHERE name=?".format(CF... | {'deleted': [{'char_start': 57, 'char_end': 67, 'chars': 'options_st'}, {'char_start': 71, 'char_end': 83, 'chars': 'queryOne(c, '}, {'char_start': 118, 'char_end': 122, 'chars': "'{}'"}], 'added': [{'char_start': 58, 'char_end': 60, 'chars': 'eq'}, {'char_start': 98, 'char_end': 99, 'chars': '?'}, {'char_start': 130, ... | 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_last_video_position | def retrieve_last_video_position(playlist_id, db):
db.execute("SELECT max(position) as position from video WHERE playlist_id={playlist_id};".format(
playlist_id=playlist_id))
row = db.fetchone()
return row['position'] | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 51, 'char_end': 153, 'line': ' db.execute("SELECT max(position) as position from video WHERE playlist_id={playlist_id};".format(\n'}, {'line_no': 3, 'char_start': 153, 'char_end': 187, 'line': ' playlist_id=playlist_id))\n'}], 'added': [{'line_no': 2, 'char_start': 51... | {'deleted': [{'char_start': 129, 'char_end': 136, 'chars': '{playli'}, {'char_start': 137, 'char_end': 142, 'chars': 't_id}'}, {'char_start': 144, 'char_end': 158, 'chars': '.format(\n '}, {'char_start': 159, 'char_end': 173, 'chars': ' playlist_id='}], 'added': [{'char_start': 66, 'char_end': 75, 'chars': '\n ... | 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_last_video_position | def retrieve_last_video_position(playlist_id, db):
db.execute(
"SELECT max(position) as position from video WHERE playlist_id=%s;", (playlist_id,))
row = db.fetchone()
return row['position'] | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 51, 'char_end': 153, 'line': ' db.execute("SELECT max(position) as position from video WHERE playlist_id={playlist_id};".format(\n'}, {'line_no': 3, 'char_start': 153, 'char_end': 187, 'line': ' playlist_id=playlist_id))\n'}], 'added': [{'line_no': 2, 'char_start': 51... | {'deleted': [{'char_start': 129, 'char_end': 136, 'chars': '{playli'}, {'char_start': 137, 'char_end': 142, 'chars': 't_id}'}, {'char_start': 144, 'char_end': 158, 'chars': '.format(\n '}, {'char_start': 159, 'char_end': 173, 'chars': ' playlist_id='}], 'added': [{'char_start': 66, 'char_end': 75, 'chars': '\n ... | 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_history | @app.route('/<page_name>/history')
def view_page_history(page_name):
query = db.query("select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = '%s'" % page_name)
page_histories = query.namedresult()
return render_template(
'pa... | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 69, 'char_end': 239, 'line': ' query = db.query("select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = \'%s\'" % page_name)\n'}], 'added': [{'line_no': 3, 'char_start': 69, 'char_end': 236, 'line': ' ... | {'deleted': [{'char_start': 220, 'char_end': 224, 'chars': "'%s'"}, {'char_start': 225, 'char_end': 227, 'chars': ' %'}], 'added': [{'char_start': 220, 'char_end': 222, 'chars': '$1'}, {'char_start': 223, 'char_end': 224, '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_history | @app.route('/<page_name>/history')
def view_page_history(page_name):
query = db.query("select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = $1", page_name)
page_histories = query.namedresult()
return render_template(
'page_... | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 69, 'char_end': 239, 'line': ' query = db.query("select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = \'%s\'" % page_name)\n'}], 'added': [{'line_no': 3, 'char_start': 69, 'char_end': 236, 'line': ' ... | {'deleted': [{'char_start': 220, 'char_end': 224, 'chars': "'%s'"}, {'char_start': 225, 'char_end': 227, 'chars': ' %'}], 'added': [{'char_start': 220, 'char_end': 222, 'chars': '$1'}, {'char_start': 223, 'char_end': 224, '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. |
add_input | def add_input(self, data):
connection = self.connects()
try:
# The following introduces a deliberate security flaw. See section on SQL injecton below
query = "INSERT INTO crimes (description) VALUES ('{}');".format(
data)
with connection.cursor() a... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 182, 'char_end': 260, 'line': ' query = "INSERT INTO crimes (description) VALUES (\'{}\');".format(\n'}, {'line_no': 6, 'char_start': 260, 'char_end': 282, 'line': ' data)\n'}, {'line_no': 8, 'char_start': 330, 'char_end': 368, 'line': ' ... | {'deleted': [{'char_start': 244, 'char_end': 248, 'chars': "'{}'"}, {'char_start': 251, 'char_end': 281, 'chars': '.format(\n data)'}], 'added': [{'char_start': 244, 'char_end': 246, 'chars': '%s'}, {'char_start': 334, 'char_end': 340, 'chars': ', data'}]} | 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_input | def add_input(self, data):
connection = self.connects()
try:
# The following introduces a deliberate security flaw. See section on SQL injecton below
query = "INSERT INTO crimes (description) VALUES (%s);"
with connection.cursor() as cursor:
cursor... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 182, 'char_end': 260, 'line': ' query = "INSERT INTO crimes (description) VALUES (\'{}\');".format(\n'}, {'line_no': 6, 'char_start': 260, 'char_end': 282, 'line': ' data)\n'}, {'line_no': 8, 'char_start': 330, 'char_end': 368, 'line': ' ... | {'deleted': [{'char_start': 244, 'char_end': 248, 'chars': "'{}'"}, {'char_start': 251, 'char_end': 281, 'chars': '.format(\n data)'}], 'added': [{'char_start': 244, 'char_end': 246, 'chars': '%s'}, {'char_start': 334, 'char_end': 340, 'chars': ', data'}]} | 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_top_author | def get_top_author(top_num):
""" query the top(top_num) popular author
top_num => list of [author, count]
"""
cmd = """SELECT authors.name,author_result.num
FROM authors JOIN
(SELECT SUM(article_result.num) as num,
article_result.aut... | cwe-089 | {'deleted': [{'line_no': 21, 'char_start': 931, 'char_end': 998, 'line': ' ORDER BY num DESC LIMIT {}""".format(top_num)\r\n'}, {'line_no': 22, 'char_start': 998, 'char_end': 1027, 'line': ' return execute_query(cmd)\r\n'}], 'added': [{'line_no': 21, 'char_start': 931, 'char_end': 982, 'line': ' ... | {'deleted': [{'char_start': 975, 'char_end': 977, 'chars': '{}'}, {'char_start': 980, 'char_end': 985, 'chars': '.form'}, {'char_start': 987, 'char_end': 988, 'chars': '('}, {'char_start': 995, 'char_end': 996, 'chars': ')'}], 'added': [{'char_start': 975, 'char_end': 977, 'chars': '%s'}, {'char_start': 980, '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_top_author | def get_top_author(top_num):
""" query the top(top_num) popular author
top_num => list of [author, count]
"""
cmd = """SELECT authors.name,author_result.num
FROM authors JOIN
(SELECT SUM(article_result.num) as num,
article_result.aut... | cwe-089 | {'deleted': [{'line_no': 21, 'char_start': 931, 'char_end': 998, 'line': ' ORDER BY num DESC LIMIT {}""".format(top_num)\r\n'}, {'line_no': 22, 'char_start': 998, 'char_end': 1027, 'line': ' return execute_query(cmd)\r\n'}], 'added': [{'line_no': 21, 'char_start': 931, 'char_end': 982, 'line': ' ... | {'deleted': [{'char_start': 975, 'char_end': 977, 'chars': '{}'}, {'char_start': 980, 'char_end': 985, 'chars': '.form'}, {'char_start': 987, 'char_end': 988, 'chars': '('}, {'char_start': 995, 'char_end': 996, 'chars': ')'}], 'added': [{'char_start': 975, 'char_end': 977, 'chars': '%s'}, {'char_start': 980, '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. |
get_all_referrers | @app.route('/get_all_referrers')
def get_all_referrers():
account_id = request.args.get('account_id')
if not isObject(account_id):
ws.send('{"id":1, "method":"call", "params":[0,"lookup_account_names",[["' + account_id + '"], 0]]}')
result_l = ws.recv()
j_l = json.loads(result_l)
... | cwe-089 | {'deleted': [{'line_no': 15, 'char_start': 430, 'char_end': 500, 'line': ' query = "select * from referrers where referrer=\'"+account_id+"\'"\n'}, {'line_no': 16, 'char_start': 500, 'char_end': 523, 'line': ' cur.execute(query)\n'}], 'added': [{'line_no': 15, 'char_start': 430, 'char_end': 486, 'line': ' quer... | {'deleted': [{'char_start': 482, 'char_end': 498, 'chars': '\'"+account_id+"\''}], 'added': [{'char_start': 482, 'char_end': 484, 'chars': '%s'}, {'char_start': 507, 'char_end': 522, 'chars': ', (account_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_all_referrers | @app.route('/get_all_referrers')
def get_all_referrers():
account_id = request.args.get('account_id')
if not isObject(account_id):
ws.send('{"id":1, "method":"call", "params":[0,"lookup_account_names",[["' + account_id + '"], 0]]}')
result_l = ws.recv()
j_l = json.loads(result_l)
... | cwe-089 | {'deleted': [{'line_no': 15, 'char_start': 430, 'char_end': 500, 'line': ' query = "select * from referrers where referrer=\'"+account_id+"\'"\n'}, {'line_no': 16, 'char_start': 500, 'char_end': 523, 'line': ' cur.execute(query)\n'}], 'added': [{'line_no': 15, 'char_start': 430, 'char_end': 486, 'line': ' quer... | {'deleted': [{'char_start': 482, 'char_end': 498, 'chars': '\'"+account_id+"\''}], 'added': [{'char_start': 482, 'char_end': 484, 'chars': '%s'}, {'char_start': 507, 'char_end': 522, 'chars': ', (account_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. |
add_translationname | def add_translationname(self, trname):
"""Add new translation by item name for an item."""
if self.connection:
for item in self.find_item_name([trname[0], '0']):
self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values ("%s", "%s", "%s... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 194, 'char_end': 359, 'line': ' self.cursor.execute(\'insert into itemtranslation (itemid, itemlanguageid, translation) values ("%s", "%s", "%s")\' % (item[0], trname[1], trname[2]))\n'}], 'added': [{'line_no': 5, 'char_start': 194, 'char_end': 248, 'line': ' ... | {'deleted': [{'char_start': 305, 'char_end': 309, 'chars': '"%s"'}, {'char_start': 311, 'char_end': 315, 'chars': '"%s"'}, {'char_start': 317, 'char_end': 321, 'chars': '"%s"'}, {'char_start': 323, 'char_end': 334, 'chars': ' % (item[0]'}, {'char_start': 337, 'char_end': 357, 'chars': 'rname[1], trname[2])'}], 'added':... | 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_translationname | def add_translationname(self, trname):
"""Add new translation by item name for an item."""
if self.connection:
for item in self.find_item_name([trname[0], '0']):
t = (item[0], trname[1], trname[2], )
self.cursor.execute('insert into itemtranslation (itemid... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 194, 'char_end': 359, 'line': ' self.cursor.execute(\'insert into itemtranslation (itemid, itemlanguageid, translation) values ("%s", "%s", "%s")\' % (item[0], trname[1], trname[2]))\n'}], 'added': [{'line_no': 5, 'char_start': 194, 'char_end': 248, 'line': ' ... | {'deleted': [{'char_start': 305, 'char_end': 309, 'chars': '"%s"'}, {'char_start': 311, 'char_end': 315, 'chars': '"%s"'}, {'char_start': 317, 'char_end': 321, 'chars': '"%s"'}, {'char_start': 323, 'char_end': 334, 'chars': ' % (item[0]'}, {'char_start': 337, 'char_end': 357, 'chars': 'rname[1], trname[2])'}], 'added':... | 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_max_task_id_for_project | @staticmethod
def get_max_task_id_for_project(project_id: int):
"""Gets the nights task id currently in use on a project"""
sql = """select max(id) from tasks where project_id = {0} GROUP BY project_id""".format(project_id)
result = db.engine.execute(sql)
if result.rowcount == 0:... | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 140, 'char_end': 248, 'line': ' sql = """select max(id) from tasks where project_id = {0} GROUP BY project_id""".format(project_id)\n'}, {'line_no': 5, 'char_start': 248, 'char_end': 288, 'line': ' result = db.engine.execute(sql)\n'}], 'added': [{'line_no': 4, 'ch... | {'deleted': [{'char_start': 202, 'char_end': 205, 'chars': '{0}'}, {'char_start': 228, 'char_end': 247, 'chars': '.format(project_id)'}], 'added': [{'char_start': 202, 'char_end': 213, 'chars': ':project_id'}, {'char_start': 272, 'char_end': 277, 'chars': 'text('}, {'char_start': 280, 'char_end': 304, 'chars': '), proj... | 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_max_task_id_for_project | @staticmethod
def get_max_task_id_for_project(project_id: int):
"""Gets the nights task id currently in use on a project"""
sql = """select max(id) from tasks where project_id = :project_id GROUP BY project_id"""
result = db.engine.execute(text(sql), project_id=project_id)
if res... | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 140, 'char_end': 248, 'line': ' sql = """select max(id) from tasks where project_id = {0} GROUP BY project_id""".format(project_id)\n'}, {'line_no': 5, 'char_start': 248, 'char_end': 288, 'line': ' result = db.engine.execute(sql)\n'}], 'added': [{'line_no': 4, 'ch... | {'deleted': [{'char_start': 202, 'char_end': 205, 'chars': '{0}'}, {'char_start': 228, 'char_end': 247, 'chars': '.format(project_id)'}], 'added': [{'char_start': 202, 'char_end': 213, 'chars': ':project_id'}, {'char_start': 272, 'char_end': 277, 'chars': 'text('}, {'char_start': 280, 'char_end': 304, 'chars': '), proj... | 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. |
findNPC | def findNPC(race, classe, sex,level):
c, conn = getConnection()
date = now()
#select image, SUM(legit) as l FROM npc WHERE race='Elf' AND class='Bard' AND sex='Male' GROUP BY image HAVING l>5 ORDER BY SUM(legit) DESC;
c.execute("select image, avg(legit) as l FROM npc WHERE race='"+race+"' AND class='"+classe+"' AND... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 221, 'char_end': 391, 'line': '\tc.execute("select image, avg(legit) as l FROM npc WHERE race=\'"+race+"\' AND class=\'"+classe+"\' AND sex=\'"+sex+"\' GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC;")\n'}], 'added': [{'line_no': 5, 'char_start': 221, 'char_end': 386, 'li... | {'deleted': [{'char_start': 283, 'char_end': 293, 'chars': '\'"+race+"\''}, {'char_start': 304, 'char_end': 316, 'chars': '\'"+classe+"\''}, {'char_start': 325, 'char_end': 334, 'chars': '\'"+sex+"\''}, {'char_start': 387, 'char_end': 388, 'chars': ';'}], 'added': [{'char_start': 283, 'char_end': 286, '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. |
findNPC | def findNPC(race, classe, sex,level):
c, conn = getConnection()
date = now()
#select image, SUM(legit) as l FROM npc WHERE race='Elf' AND class='Bard' AND sex='Male' GROUP BY image HAVING l>5 ORDER BY SUM(legit) DESC;
c.execute("select image, avg(legit) as l FROM npc WHERE race=(?) AND class=(?) AND sex=(?) GROUP B... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 221, 'char_end': 391, 'line': '\tc.execute("select image, avg(legit) as l FROM npc WHERE race=\'"+race+"\' AND class=\'"+classe+"\' AND sex=\'"+sex+"\' GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC;")\n'}], 'added': [{'line_no': 5, 'char_start': 221, 'char_end': 386, 'li... | {'deleted': [{'char_start': 283, 'char_end': 293, 'chars': '\'"+race+"\''}, {'char_start': 304, 'char_end': 316, 'chars': '\'"+classe+"\''}, {'char_start': 325, 'char_end': 334, 'chars': '\'"+sex+"\''}, {'char_start': 387, 'char_end': 388, 'chars': ';'}], 'added': [{'char_start': 283, 'char_end': 286, '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. |
edit | @mod.route('/edit/<int:msg_id>', methods=['GET', 'POST'])
def edit(msg_id):
m = None
if request.method == 'GET':
sql = "SELECT * FROM message where msg_id = %d;" % (msg_id)
cursor.execute(sql)
m = cursor.fetchone()
return render_template('message/edit.html', m=m, msg_id=msg_id)
... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 121, 'char_end': 189, 'line': ' sql = "SELECT * FROM message where msg_id = %d;" % (msg_id)\n'}, {'line_no': 6, 'char_start': 189, 'char_end': 217, 'line': ' cursor.execute(sql)\n'}, {'line_no': 12, 'char_start': 395, 'char_end': 468, 'line': ' sql = "UPDAT... | {'deleted': [{'char_start': 130, 'char_end': 135, 'chars': 'ql = '}, {'char_start': 174, 'char_end': 175, 'chars': 'd'}, {'char_start': 177, 'char_end': 179, 'chars': ' %'}, {'char_start': 188, 'char_end': 215, 'chars': '\n cursor.execute(sql'}, {'char_start': 404, 'char_end': 409, 'chars': 'ql = '}, {'char_star... | 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. |
edit | @mod.route('/edit/<int:msg_id>', methods=['GET', 'POST'])
def edit(msg_id):
m = None
if request.method == 'GET':
cursor.execute("SELECT * FROM message where msg_id = %s;", (msg_id,))
m = cursor.fetchone()
return render_template('message/edit.html', m=m, msg_id=msg_id)
if request.met... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 121, 'char_end': 189, 'line': ' sql = "SELECT * FROM message where msg_id = %d;" % (msg_id)\n'}, {'line_no': 6, 'char_start': 189, 'char_end': 217, 'line': ' cursor.execute(sql)\n'}, {'line_no': 12, 'char_start': 395, 'char_end': 468, 'line': ' sql = "UPDAT... | {'deleted': [{'char_start': 130, 'char_end': 135, 'chars': 'ql = '}, {'char_start': 174, 'char_end': 175, 'chars': 'd'}, {'char_start': 177, 'char_end': 179, 'chars': ' %'}, {'char_start': 188, 'char_end': 215, 'chars': '\n cursor.execute(sql'}, {'char_start': 404, 'char_end': 409, 'chars': 'ql = '}, {'char_star... | 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_input | def add_input(self,data):
connection = self.connect()
try:
query = "INSERT INTO crimes (description) VALUES ('{}');".format(data)
with connection.cursor() as cursor:
cursor.execute(query)
connection.commit()
finally:
connec... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 80, 'char_end': 163, 'line': ' query = "INSERT INTO crimes (description) VALUES (\'{}\');".format(data)\n'}, {'line_no': 7, 'char_start': 211, 'char_end': 249, 'line': ' cursor.execute(query)\n'}], 'added': [{'line_no': 5, 'char_start': 80, 'char_end':... | {'deleted': [{'char_start': 142, 'char_end': 146, 'chars': "'{}'"}, {'char_start': 149, 'char_end': 162, 'chars': '.format(data)'}], 'added': [{'char_start': 142, 'char_end': 144, 'chars': '%s'}, {'char_start': 232, 'char_end': 237, 'chars': ',data'}]} | 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_input | def add_input(self,data):
connection = self.connect()
try:
query = "INSERT INTO crimes (description) VALUES (%s);"
with connection.cursor() as cursor:
cursor.execute(query,data)
connection.commit()
finally:
connection.close... | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 80, 'char_end': 163, 'line': ' query = "INSERT INTO crimes (description) VALUES (\'{}\');".format(data)\n'}, {'line_no': 7, 'char_start': 211, 'char_end': 249, 'line': ' cursor.execute(query)\n'}], 'added': [{'line_no': 5, 'char_start': 80, 'char_end':... | {'deleted': [{'char_start': 142, 'char_end': 146, 'chars': "'{}'"}, {'char_start': 149, 'char_end': 162, 'chars': '.format(data)'}], 'added': [{'char_start': 142, 'char_end': 144, 'chars': '%s'}, {'char_start': 232, 'char_end': 237, 'chars': ',data'}]} | 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. |
fetch_resultSet | def fetch_resultSet(self, session, id):
self._openContainer(session)
sid = str(id)
if (self.idNormalizer is not None):
sid = self.idNormalizer.process_string(session, sid)
query = ("SELECT class, data FROM %s WHERE identifier = '%s';" %
(self.table, sid)... | cwe-089 | {'deleted': [{'line_no': 7, 'char_start': 213, 'char_end': 286, 'line': ' query = ("SELECT class, data FROM %s WHERE identifier = \'%s\';" %\n'}, {'line_no': 8, 'char_start': 286, 'char_end': 321, 'line': ' (self.table, sid)\n'}, {'line_no': 10, 'char_start': 340, 'char_end': 373, 'line': ' ... | {'deleted': [{'char_start': 277, 'char_end': 281, 'chars': "'%s'"}, {'char_start': 314, 'char_end': 319, 'chars': ', sid'}, {'char_start': 1338, 'char_end': 1342, 'chars': "'%s'"}, {'char_start': 1354, 'char_end': 1358, 'chars': "'%s'"}, {'char_start': 1398, 'char_end': 1402, 'chars': "'%s'"}, {'char_start': 1406, '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. |
fetch_resultSet | def fetch_resultSet(self, session, id):
self._openContainer(session)
sid = str(id)
if (self.idNormalizer is not None):
sid = self.idNormalizer.process_string(session, sid)
query = ("SELECT class, data FROM %s WHERE identifier = $1;" %
(self.table)
... | cwe-089 | {'deleted': [{'line_no': 7, 'char_start': 213, 'char_end': 286, 'line': ' query = ("SELECT class, data FROM %s WHERE identifier = \'%s\';" %\n'}, {'line_no': 8, 'char_start': 286, 'char_end': 321, 'line': ' (self.table, sid)\n'}, {'line_no': 10, 'char_start': 340, 'char_end': 373, 'line': ' ... | {'deleted': [{'char_start': 277, 'char_end': 281, 'chars': "'%s'"}, {'char_start': 314, 'char_end': 319, 'chars': ', sid'}, {'char_start': 1338, 'char_end': 1342, 'chars': "'%s'"}, {'char_start': 1354, 'char_end': 1358, 'chars': "'%s'"}, {'char_start': 1398, 'char_end': 1402, 'chars': "'%s'"}, {'char_start': 1406, '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. |
init_user | def init_user(username, chat_id):
conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\users\\" + username + '.db')
conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\cf.db')
cursor = conn.cursor()
cursor2 = conn2.cursor()
cursor.execute("CREATE TABLE result (p... | cwe-089 | {'deleted': [{'line_no': 22, 'char_start': 893, 'char_end': 894, 'line': '\n'}, {'line_no': 23, 'char_start': 894, 'char_end': 907, 'line': ' old = ""\n'}, {'line_no': 44, 'char_start': 1799, 'char_end': 1914, 'line': ' cursor.execute("select * from result where problem = \'" + s[3] + "\'and diff ... | {'deleted': [{'char_start': 893, 'char_end': 907, 'chars': '\n old = ""\n'}, {'char_start': 1872, 'char_end': 1883, 'chars': '\'" + s[3] +'}, {'char_start': 1884, 'char_end': 1886, 'chars': '"\''}, {'char_start': 1897, 'char_end': 1898, 'chars': "'"}, {'char_start': 1900, 'char_end': 1901, 'chars': '+'}, {'char_star... | 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_user | def init_user(username, chat_id):
conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\users\\" + username + '.db')
conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\cf.db')
cursor = conn.cursor()
cursor2 = conn2.cursor()
cursor.execute("CREATE TABLE result (p... | cwe-089 | {'deleted': [{'line_no': 22, 'char_start': 893, 'char_end': 894, 'line': '\n'}, {'line_no': 23, 'char_start': 894, 'char_end': 907, 'line': ' old = ""\n'}, {'line_no': 44, 'char_start': 1799, 'char_end': 1914, 'line': ' cursor.execute("select * from result where problem = \'" + s[3] + "\'and diff ... | {'deleted': [{'char_start': 893, 'char_end': 907, 'chars': '\n old = ""\n'}, {'char_start': 1872, 'char_end': 1883, 'chars': '\'" + s[3] +'}, {'char_start': 1884, 'char_end': 1886, 'chars': '"\''}, {'char_start': 1897, 'char_end': 1898, 'chars': "'"}, {'char_start': 1900, 'char_end': 1901, 'chars': '+'}, {'char_star... | 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. |
process_vote | def process_vote(target,action,chan,mask,db,notice,conn):
if ' ' in target:
notice('Invalid nick')
return
try: votes2kick = database.get(db,'channels','votekick','chan',chan)
except: votes2kick = 10
try: votes2ban = database.get(db,'channels','voteban','chan',chan)
except: votes2ba... | cwe-089 | {'deleted': [{'line_no': 22, 'char_start': 707, 'char_end': 850, 'line': ' voters = db.execute("SELECT voters FROM votes where chan=\'{}\' and action=\'{}\' and target like \'{}\'".format(chan,action,target)).fetchone()\n'}, {'line_no': 51, 'char_start': 1781, 'char_end': 1914, 'line': ' if votefinished: db.execu... | {'deleted': [{'char_start': 768, 'char_end': 772, 'chars': "'{}'"}, {'char_start': 784, 'char_end': 788, 'chars': "'{}'"}, {'char_start': 805, 'char_end': 809, 'chars': "'{}'"}, {'char_start': 810, 'char_end': 818, 'chars': '.format('}, {'char_start': 836, 'char_end': 837, 'chars': ')'}, {'char_start': 1843, '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. |
process_vote | def process_vote(target,action,chan,mask,db,notice,conn):
if ' ' in target:
notice('Invalid nick')
return
try: votes2kick = database.get(db,'channels','votekick','chan',chan)
except: votes2kick = 10
try: votes2ban = database.get(db,'channels','voteban','chan',chan)
except: votes2ba... | cwe-089 | {'deleted': [{'line_no': 22, 'char_start': 707, 'char_end': 850, 'line': ' voters = db.execute("SELECT voters FROM votes where chan=\'{}\' and action=\'{}\' and target like \'{}\'".format(chan,action,target)).fetchone()\n'}, {'line_no': 51, 'char_start': 1781, 'char_end': 1914, 'line': ' if votefinished: db.execu... | {'deleted': [{'char_start': 768, 'char_end': 772, 'chars': "'{}'"}, {'char_start': 784, 'char_end': 788, 'chars': "'{}'"}, {'char_start': 805, 'char_end': 809, 'chars': "'{}'"}, {'char_start': 810, 'char_end': 818, 'chars': '.format('}, {'char_start': 836, 'char_end': 837, 'chars': ')'}, {'char_start': 1843, '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. |
like | @mod.route('/like/<int:msg_id>', methods=['GET', 'POST'])
def like(msg_id):
if request.method == 'GET':
user_id = session['logged_id']
c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
sql = "INSERT INTO like_msg(msg_id, user_id,c_time) " + \
"VALUES(%d,'%s','%s');" % (ms... | cwe-089 | {'deleted': [{'line_no': 6, 'char_start': 209, 'char_end': 275, 'line': ' sql = "INSERT INTO like_msg(msg_id, user_id,c_time) " + \\\n'}, {'line_no': 7, 'char_start': 275, 'char_end': 343, 'line': ' "VALUES(%d,\'%s\',\'%s\');" % (msg_id, user_id, c_time)\n'}, {'line_no': 8, 'char_start': 343, 'cha... | {'deleted': [{'char_start': 218, 'char_end': 223, 'chars': 'ql = '}, {'char_start': 269, 'char_end': 292, 'chars': '" + \\\n "'}, {'char_start': 300, 'char_end': 301, 'chars': 'd'}, {'char_start': 302, 'char_end': 303, 'chars': "'"}, {'char_start': 305, 'char_end': 306, 'chars': "'"}, {'char_start': 307,... | 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. |
like | @mod.route('/like/<int:msg_id>', methods=['GET', 'POST'])
def like(msg_id):
if request.method == 'GET':
user_id = session['logged_id']
c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
cursor.execute("INSERT INTO like_msg(msg_id, user_id,c_time) VALUES(%s,%s,%s);", (msg_id, user_id, c_ti... | cwe-089 | {'deleted': [{'line_no': 6, 'char_start': 209, 'char_end': 275, 'line': ' sql = "INSERT INTO like_msg(msg_id, user_id,c_time) " + \\\n'}, {'line_no': 7, 'char_start': 275, 'char_end': 343, 'line': ' "VALUES(%d,\'%s\',\'%s\');" % (msg_id, user_id, c_time)\n'}, {'line_no': 8, 'char_start': 343, 'cha... | {'deleted': [{'char_start': 218, 'char_end': 223, 'chars': 'ql = '}, {'char_start': 269, 'char_end': 292, 'chars': '" + \\\n "'}, {'char_start': 300, 'char_end': 301, 'chars': 'd'}, {'char_start': 302, 'char_end': 303, 'chars': "'"}, {'char_start': 305, 'char_end': 306, 'chars': "'"}, {'char_start': 307,... | 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_to_tag_num | def tag_to_tag_num(self, tag):
''' Returns tag_num given tag. '''
q = "SELECT rowid FROM tags WHERE tag = '" + tag + "'"
self.query(q)
return self.c.fetchone()[0] | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 79, 'char_end': 142, 'line': ' q = "SELECT rowid FROM tags WHERE tag = \'" + tag + "\'"\n'}, {'line_no': 5, 'char_start': 142, 'char_end': 164, 'line': ' self.query(q)\n'}], 'added': [{'line_no': 4, 'char_start': 79, 'char_end': 130, 'line': ' q = "SELECT r... | {'deleted': [{'char_start': 127, 'char_end': 140, 'chars': '\'" + tag + "\''}], 'added': [{'char_start': 127, 'char_end': 128, 'chars': '?'}, {'char_start': 150, 'char_end': 155, 'chars': ', tag'}]} | 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_to_tag_num | def tag_to_tag_num(self, tag):
''' Returns tag_num given tag. '''
q = "SELECT rowid FROM tags WHERE tag = ?"
self.query(q, tag)
return self.c.fetchone()[0] | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 79, 'char_end': 142, 'line': ' q = "SELECT rowid FROM tags WHERE tag = \'" + tag + "\'"\n'}, {'line_no': 5, 'char_start': 142, 'char_end': 164, 'line': ' self.query(q)\n'}], 'added': [{'line_no': 4, 'char_start': 79, 'char_end': 130, 'line': ' q = "SELECT r... | {'deleted': [{'char_start': 127, 'char_end': 140, 'chars': '\'" + tag + "\''}], 'added': [{'char_start': 127, 'char_end': 128, 'chars': '?'}, {'char_start': 150, 'char_end': 155, 'chars': ', tag'}]} | 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_history_and_sourcebyinstitution | def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):
"""
Get all current sources and title numbers from Solr and log them into database.
"""
current_sources = get_all_current_sources(k10plus, ai)
current_institutions = get_all_current_institutions(k10plus, ai)
old_sourcebyinsti... | cwe-089 | {'deleted': [{'line_no': 30, 'char_start': 1094, 'char_end': 1218, 'line': ' sql = \'INSERT INTO history (sourcebyinstitution, titles) VALUES ("%s", %s)\' % (sourcebyinstitution, number)\n'}, {'line_no': 31, 'char_start': 1218, 'char_end': 1254, 'line': ' sqlite.execute(sql)\n'}, {'line_no... | {'deleted': [{'char_start': 1175, 'char_end': 1179, 'chars': '"%s"'}, {'char_start': 1181, 'char_end': 1183, 'chars': '%s'}, {'char_start': 1185, 'char_end': 1217, 'chars': ' % (sourcebyinstitution, number)'}, {'char_start': 1601, 'char_end': 1605, 'chars': '"%s"'}, {'char_start': 1607, 'char_end': 1609, 'chars': '%s'}... | 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_history_and_sourcebyinstitution | def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):
"""
Get all current sources and title numbers from Solr and log them into database.
"""
current_sources = get_all_current_sources(k10plus, ai)
current_institutions = get_all_current_institutions(k10plus, ai)
old_sourcebyinsti... | cwe-089 | {'deleted': [{'line_no': 30, 'char_start': 1094, 'char_end': 1218, 'line': ' sql = \'INSERT INTO history (sourcebyinstitution, titles) VALUES ("%s", %s)\' % (sourcebyinstitution, number)\n'}, {'line_no': 31, 'char_start': 1218, 'char_end': 1254, 'line': ' sqlite.execute(sql)\n'}, {'line_no... | {'deleted': [{'char_start': 1175, 'char_end': 1179, 'chars': '"%s"'}, {'char_start': 1181, 'char_end': 1183, 'chars': '%s'}, {'char_start': 1185, 'char_end': 1217, 'chars': ' % (sourcebyinstitution, number)'}, {'char_start': 1601, 'char_end': 1605, 'chars': '"%s"'}, {'char_start': 1607, 'char_end': 1609, 'chars': '%s'}... | 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. |
change_message | def change_message(self, new_message, logged_user):
update_sql = """
UPDATE Clients
SET message = '{}'
WHERE client_id = '{}'
""".format(new_message, logged_user.get_client_id())
cursor = self.__conn.cursor()
cursor.execute(update_sql)
se... | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 108, 'char_end': 139, 'line': " SET message = '{}'\n"}, {'line_no': 5, 'char_start': 139, 'char_end': 174, 'line': " WHERE client_id = '{}'\n"}, {'line_no': 6, 'char_start': 174, 'char_end': 235, 'line': ' """.format(new_message, logged_user.get_cli... | {'deleted': [{'char_start': 134, 'char_end': 138, 'chars': "'{}'"}, {'char_start': 169, 'char_end': 173, 'chars': "'{}'"}, {'char_start': 185, 'char_end': 234, 'chars': '.format(new_message, logged_user.get_client_id())'}], 'added': [{'char_start': 134, 'char_end': 135, 'chars': '?'}, {'char_start': 166, 'char_end': 16... | 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. |
change_message | def change_message(self, new_message, logged_user):
update_sql = """
UPDATE Clients
SET message = ?
WHERE client_id = ?
"""
cursor = self.__conn.cursor()
cursor.execute(update_sql, (new_message, logged_user.get_client_id()))
self.__conn.c... | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 108, 'char_end': 139, 'line': " SET message = '{}'\n"}, {'line_no': 5, 'char_start': 139, 'char_end': 174, 'line': " WHERE client_id = '{}'\n"}, {'line_no': 6, 'char_start': 174, 'char_end': 235, 'line': ' """.format(new_message, logged_user.get_cli... | {'deleted': [{'char_start': 134, 'char_end': 138, 'chars': "'{}'"}, {'char_start': 169, 'char_end': 173, 'chars': "'{}'"}, {'char_start': 185, 'char_end': 234, 'chars': '.format(new_message, logged_user.get_client_id())'}], 'added': [{'char_start': 134, 'char_end': 135, 'chars': '?'}, {'char_start': 166, 'char_end': 16... | 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. |
create_event | def create_event(self, title, start_time, time_zone, server_id, description):
sql = """INSERT INTO events (title, start_time, time_zone, server_id, description)
VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')
""".format(title, start_time, time_zone, server_id, description)
... | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 82, 'char_end': 173, 'line': ' sql = """INSERT INTO events (title, start_time, time_zone, server_id, description)\n'}, {'line_no': 3, 'char_start': 173, 'char_end': 233, 'line': " VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')\n"}, {'line_no': 4, 'char_start'... | {'deleted': [{'char_start': 187, 'char_end': 190, 'chars': ' '}, {'char_start': 198, 'char_end': 203, 'chars': "'{0}'"}, {'char_start': 205, 'char_end': 210, 'chars': "'{1}'"}, {'char_start': 212, 'char_end': 217, 'chars': "'{2}'"}, {'char_start': 219, 'char_end': 224, 'chars': "'{3}'"}, {'char_start': 226, '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. |
create_event | def create_event(self, title, start_time, time_zone, server_id, description):
sql = """
INSERT INTO events (title, start_time, time_zone, server_id, description)
VALUES (%s, %s, %s, %s, %s)
"""
self.cur.execute(sql, (title, start_time, time_zone, server_id, ... | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 82, 'char_end': 173, 'line': ' sql = """INSERT INTO events (title, start_time, time_zone, server_id, description)\n'}, {'line_no': 3, 'char_start': 173, 'char_end': 233, 'line': " VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')\n"}, {'line_no': 4, 'char_start'... | {'deleted': [{'char_start': 187, 'char_end': 190, 'chars': ' '}, {'char_start': 198, 'char_end': 203, 'chars': "'{0}'"}, {'char_start': 205, 'char_end': 210, 'chars': "'{1}'"}, {'char_start': 212, 'char_end': 217, 'chars': "'{2}'"}, {'char_start': 219, 'char_end': 224, 'chars': "'{3}'"}, {'char_start': 226, '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. |
get_login2 | @bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)
def get_login2(message):
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db")
conn = settings.cursor()
if bases.createuserbase.check_username(message.text... | cwe-089 | {'deleted': [{'line_no': 9, 'char_start': 465, 'char_end': 466, 'line': '\n'}, {'line_no': 10, 'char_start': 466, 'char_end': 553, 'line': ' conn.execute("select * from users where chat_id = \'" + str(message.chat.id) + "\'")\n'}], 'added': [{'line_no': 9, 'char_start': 465, 'char_end': 548, 'line': ' conn.execut... | {'deleted': [{'char_start': 465, 'char_end': 466, 'chars': '\n'}, {'char_start': 520, 'char_end': 521, 'chars': "'"}, {'char_start': 522, 'char_end': 524, 'chars': ' +'}, {'char_start': 545, 'char_end': 551, 'chars': ' + "\'"'}], 'added': [{'char_start': 519, 'char_end': 520, 'chars': '?'}, {'char_start': 521, '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. |
get_login2 | @bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)
def get_login2(message):
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db")
conn = settings.cursor()
if bases.createuserbase.check_username(message.text... | cwe-089 | {'deleted': [{'line_no': 9, 'char_start': 465, 'char_end': 466, 'line': '\n'}, {'line_no': 10, 'char_start': 466, 'char_end': 553, 'line': ' conn.execute("select * from users where chat_id = \'" + str(message.chat.id) + "\'")\n'}], 'added': [{'line_no': 9, 'char_start': 465, 'char_end': 548, 'line': ' conn.execut... | {'deleted': [{'char_start': 465, 'char_end': 466, 'chars': '\n'}, {'char_start': 520, 'char_end': 521, 'chars': "'"}, {'char_start': 522, 'char_end': 524, 'chars': ' +'}, {'char_start': 545, 'char_end': 551, 'chars': ' + "\'"'}], 'added': [{'char_start': 519, 'char_end': 520, 'chars': '?'}, {'char_start': 521, '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. |
get_bracket_graph_data | def get_bracket_graph_data(db, tag):
# First, we have to find out which scenes this player has brackets in
sql = "SELECT DISTINCT scene FROM ranks WHERE player='{}'".format(tag)
scenes = db.exec(sql)
scenes = [s[0] for s in scenes]
bracket_placings_by_scene = {s: get_bracket_placings_in_scene(db, s... | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 111, 'char_end': 186, 'line': ' sql = "SELECT DISTINCT scene FROM ranks WHERE player=\'{}\'".format(tag)\n'}, {'line_no': 4, 'char_start': 186, 'char_end': 212, 'line': ' scenes = db.exec(sql)\n'}], 'added': [{'line_no': 3, 'char_start': 111, 'char_end': 177, 'line': ' ... | {'deleted': [{'char_start': 173, 'char_end': 176, 'chars': '.fo'}, {'char_start': 177, 'char_end': 178, 'chars': 'm'}, {'char_start': 179, 'char_end': 181, 'chars': 't('}, {'char_start': 184, 'char_end': 185, 'chars': ')'}], 'added': [{'char_start': 170, 'char_end': 173, 'chars': 'tag'}, {'char_start': 176, '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_bracket_graph_data | def get_bracket_graph_data(db, tag):
# First, we have to find out which scenes this player has brackets in
sql = "SELECT DISTINCT scene FROM ranks WHERE player='{tag}'"
args = {'tag': tag}
scenes = db.exec(sql, args)
scenes = [s[0] for s in scenes]
bracket_placings_by_scene = {s: get_bracket_pl... | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 111, 'char_end': 186, 'line': ' sql = "SELECT DISTINCT scene FROM ranks WHERE player=\'{}\'".format(tag)\n'}, {'line_no': 4, 'char_start': 186, 'char_end': 212, 'line': ' scenes = db.exec(sql)\n'}], 'added': [{'line_no': 3, 'char_start': 111, 'char_end': 177, 'line': ' ... | {'deleted': [{'char_start': 173, 'char_end': 176, 'chars': '.fo'}, {'char_start': 177, 'char_end': 178, 'chars': 'm'}, {'char_start': 179, 'char_end': 181, 'chars': 't('}, {'char_start': 184, 'char_end': 185, 'chars': ')'}], 'added': [{'char_start': 170, 'char_end': 173, 'chars': 'tag'}, {'char_start': 176, '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. |
get | def get(self, email):
""" Fetch data for admin with the corresponding email """
return database_utilities.execute_query(f"""select * from admins where email = '{email}'""") | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 92, 'char_end': 192, 'line': ' return database_utilities.execute_query(f"""select * from admins where email = \'{email}\'""")\n'}], 'added': [{'line_no': 3, 'char_start': 92, 'char_end': 196, 'line': ' return database_utilities.execute_query(f"""select * from admi... | {'deleted': [{'char_start': 179, 'char_end': 181, 'chars': "'{"}, {'char_start': 186, 'char_end': 191, 'chars': '}\'"""'}], 'added': [{'char_start': 179, 'char_end': 187, 'chars': '%s""", ('}, {'char_start': 192, 'char_end': 195, '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. |
get | def get(self, email):
""" Fetch data for admin with the corresponding email """
return database_utilities.execute_query(f"""select * from admins where email = %s""", (email, )) | cwe-089 | {'deleted': [{'line_no': 3, 'char_start': 92, 'char_end': 192, 'line': ' return database_utilities.execute_query(f"""select * from admins where email = \'{email}\'""")\n'}], 'added': [{'line_no': 3, 'char_start': 92, 'char_end': 196, 'line': ' return database_utilities.execute_query(f"""select * from admi... | {'deleted': [{'char_start': 179, 'char_end': 181, 'chars': "'{"}, {'char_start': 186, 'char_end': 191, 'chars': '}\'"""'}], 'added': [{'char_start': 179, 'char_end': 187, 'chars': '%s""", ('}, {'char_start': 192, 'char_end': 195, '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. |
insertUsage | def insertUsage(user, command):
c, conn = getConnection()
date = now()
c.execute("INSERT INTO usage (date,user,command) VALUES ('"+date+"','"+str(user)+"','"+command+"')")
conn.commit()
conn.close() | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 73, 'char_end': 175, 'line': '\tc.execute("INSERT INTO usage (date,user,command) VALUES (\'"+date+"\',\'"+str(user)+"\',\'"+command+"\')")\n'}], 'added': [{'line_no': 4, 'char_start': 73, 'char_end': 165, 'line': '\tc.execute("INSERT INTO usage (date,user,command) VALUES (?,?,?... | {'deleted': [{'char_start': 131, 'char_end': 132, 'chars': "'"}, {'char_start': 133, 'char_end': 134, 'chars': '+'}, {'char_start': 138, 'char_end': 141, 'chars': '+"\''}, {'char_start': 142, 'char_end': 145, 'chars': '\'"+'}, {'char_start': 154, 'char_end': 157, 'chars': '+"\''}, {'char_start': 158, 'char_end': 161, '... | 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. |
insertUsage | def insertUsage(user, command):
c, conn = getConnection()
date = now()
c.execute("INSERT INTO usage (date,user,command) VALUES (?,?,?)",(date,str(user),command))
conn.commit()
conn.close() | cwe-089 | {'deleted': [{'line_no': 4, 'char_start': 73, 'char_end': 175, 'line': '\tc.execute("INSERT INTO usage (date,user,command) VALUES (\'"+date+"\',\'"+str(user)+"\',\'"+command+"\')")\n'}], 'added': [{'line_no': 4, 'char_start': 73, 'char_end': 165, 'line': '\tc.execute("INSERT INTO usage (date,user,command) VALUES (?,?,?... | {'deleted': [{'char_start': 131, 'char_end': 132, 'chars': "'"}, {'char_start': 133, 'char_end': 134, 'chars': '+'}, {'char_start': 138, 'char_end': 141, 'chars': '+"\''}, {'char_start': 142, 'char_end': 145, 'chars': '\'"+'}, {'char_start': 154, 'char_end': 157, 'chars': '+"\''}, {'char_start': 158, 'char_end': 161, '... | 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_email | def verify_email(self, member):
query = "SELECT COUNT(email) FROM members WHERE email = '{email}'".format(email = member)
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': 36, 'char_end': 134, 'line': ' query = "SELECT COUNT(email) FROM members WHERE email = \'{email}\'".format(email = member)\n'}, {'line_no': 3, 'char_start': 134, 'char_end': 169, 'line': ' self.cursor.execute(query)\n'}], 'added': [{'line_no': 2, 'char_start': 36,... | {'deleted': [{'char_start': 44, 'char_end': 46, 'chars': 'qu'}, {'char_start': 48, 'char_end': 52, 'chars': 'y = '}, {'char_start': 101, 'char_end': 102, 'chars': '{'}, {'char_start': 107, 'char_end': 108, 'chars': '}'}, {'char_start': 110, 'char_end': 118, 'chars': '.format('}, {'char_start': 123, 'char_end': 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. |
verify_email | def verify_email(self, member):
self.cursor.execute("SELECT COUNT(email) FROM members WHERE email = ':email'", {'email':member})
result = self.cursor.fetchone()
if (int(result[0]) > 0):
return True
else:
return False | cwe-089 | {'deleted': [{'line_no': 2, 'char_start': 36, 'char_end': 134, 'line': ' query = "SELECT COUNT(email) FROM members WHERE email = \'{email}\'".format(email = member)\n'}, {'line_no': 3, 'char_start': 134, 'char_end': 169, 'line': ' self.cursor.execute(query)\n'}], 'added': [{'line_no': 2, 'char_start': 36,... | {'deleted': [{'char_start': 44, 'char_end': 46, 'chars': 'qu'}, {'char_start': 48, 'char_end': 52, 'chars': 'y = '}, {'char_start': 101, 'char_end': 102, 'chars': '{'}, {'char_start': 107, 'char_end': 108, 'chars': '}'}, {'char_start': 110, 'char_end': 118, 'chars': '.format('}, {'char_start': 123, 'char_end': 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_previous_yields | def get_previous_yields(self, inverter_serial):
query = '''
SELECT TimeStamp, EToday, ETotal
FROM Inverters
WHERE Serial = '%s'
''' % (inverter_serial)
self.c.execute(query)
data = self.c.fetchone()
return data[0], data[1], data[2] | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 142, 'char_end': 173, 'line': " WHERE Serial = '%s'\n"}, {'line_no': 6, 'char_start': 173, 'char_end': 205, 'line': " ''' % (inverter_serial)\n"}, {'line_no': 7, 'char_start': 205, 'char_end': 235, 'line': ' self.c.execute(query)\n'}], 'added': [{'line_n... | {'deleted': [{'char_start': 165, 'char_end': 166, 'chars': ' '}, {'char_start': 167, 'char_end': 172, 'chars': " '%s'"}, {'char_start': 184, 'char_end': 204, 'chars': ' % (inverter_serial)'}], 'added': [{'char_start': 166, 'char_end': 167, 'chars': '?'}, {'char_start': 208, 'char_end': 228, 'chars': ', (inverter_serial... | 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_previous_yields | def get_previous_yields(self, inverter_serial):
query = '''
SELECT TimeStamp, EToday, ETotal
FROM Inverters
WHERE Serial=?
'''
self.c.execute(query, (inverter_serial,))
data = self.c.fetchone()
return data[0], data[1], data[2] | cwe-089 | {'deleted': [{'line_no': 5, 'char_start': 142, 'char_end': 173, 'line': " WHERE Serial = '%s'\n"}, {'line_no': 6, 'char_start': 173, 'char_end': 205, 'line': " ''' % (inverter_serial)\n"}, {'line_no': 7, 'char_start': 205, 'char_end': 235, 'line': ' self.c.execute(query)\n'}], 'added': [{'line_n... | {'deleted': [{'char_start': 165, 'char_end': 166, 'chars': ' '}, {'char_start': 167, 'char_end': 172, 'chars': " '%s'"}, {'char_start': 184, 'char_end': 204, 'chars': ' % (inverter_serial)'}], 'added': [{'char_start': 166, 'char_end': 167, 'chars': '?'}, {'char_start': 208, 'char_end': 228, 'chars': ', (inverter_serial... | 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. |
referrer_count | @app.route('/referrer_count')
def referrer_count():
account_id = request.args.get('account_id')
if not isObject(account_id):
ws.send('{"id":1, "method":"call", "params":[0,"lookup_account_names",[["' + account_id + '"], 0]]}')
result_l = ws.recv()
j_l = json.loads(result_l)
acc... | cwe-089 | {'deleted': [{'line_no': 15, 'char_start': 424, 'char_end': 501, 'line': ' query = "select count(*) from referrers where referrer=\'"+account_id+"\'"\n'}, {'line_no': 16, 'char_start': 501, 'char_end': 524, 'line': ' cur.execute(query)\n'}], 'added': [{'line_no': 15, 'char_start': 424, 'char_end': 487, 'line': ' ... | {'deleted': [{'char_start': 483, 'char_end': 499, 'chars': '\'"+account_id+"\''}], 'added': [{'char_start': 483, 'char_end': 485, 'chars': '%s'}, {'char_start': 508, 'char_end': 523, 'chars': ', (account_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. |
referrer_count | @app.route('/referrer_count')
def referrer_count():
account_id = request.args.get('account_id')
if not isObject(account_id):
ws.send('{"id":1, "method":"call", "params":[0,"lookup_account_names",[["' + account_id + '"], 0]]}')
result_l = ws.recv()
j_l = json.loads(result_l)
acc... | cwe-089 | {'deleted': [{'line_no': 15, 'char_start': 424, 'char_end': 501, 'line': ' query = "select count(*) from referrers where referrer=\'"+account_id+"\'"\n'}, {'line_no': 16, 'char_start': 501, 'char_end': 524, 'line': ' cur.execute(query)\n'}], 'added': [{'line_no': 15, 'char_start': 424, 'char_end': 487, 'line': ' ... | {'deleted': [{'char_start': 483, 'char_end': 499, 'chars': '\'"+account_id+"\''}], 'added': [{'char_start': 483, 'char_end': 485, 'chars': '%s'}, {'char_start': 508, 'char_end': 523, 'chars': ', (account_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. |
analyze_scene | def analyze_scene(self, scene):
base_urls = scene.get_base_urls()
users = scene.get_users()
name = scene.get_name()
LOG.info('found the following users for scene {}: {}'.format(name, users))
# This scene might have one user who always posts the brackets on their challonge ac... | cwe-089 | {'deleted': [{'line_no': 10, 'char_start': 402, 'char_end': 480, 'line': ' sql = "SELECT * FROM user_analyzed WHERE user=\'{}\';".format(user)\n'}, {'line_no': 11, 'char_start': 480, 'char_end': 520, 'line': ' results = self.db.exec(sql)\n'}, {'line_no': 21, 'char_start': 1217, 'char_end': 1325, '... | {'deleted': [{'char_start': 466, 'char_end': 469, 'chars': '.fo'}, {'char_start': 470, 'char_end': 474, 'chars': 'mat('}, {'char_start': 478, 'char_end': 479, 'chars': ')'}, {'char_start': 1302, 'char_end': 1305, 'chars': '.fo'}, {'char_start': 1306, 'char_end': 1307, 'chars': 'm'}, {'char_start': 1309, 'char_end': 131... | 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. |
analyze_scene | def analyze_scene(self, scene):
base_urls = scene.get_base_urls()
users = scene.get_users()
name = scene.get_name()
LOG.info('found the following users for scene {}: {}'.format(name, users))
# This scene might have one user who always posts the brackets on their challonge ac... | cwe-089 | {'deleted': [{'line_no': 10, 'char_start': 402, 'char_end': 480, 'line': ' sql = "SELECT * FROM user_analyzed WHERE user=\'{}\';".format(user)\n'}, {'line_no': 11, 'char_start': 480, 'char_end': 520, 'line': ' results = self.db.exec(sql)\n'}, {'line_no': 21, 'char_start': 1217, 'char_end': 1325, '... | {'deleted': [{'char_start': 466, 'char_end': 469, 'chars': '.fo'}, {'char_start': 470, 'char_end': 474, 'chars': 'mat('}, {'char_start': 478, 'char_end': 479, 'chars': ')'}, {'char_start': 1302, 'char_end': 1305, 'chars': '.fo'}, {'char_start': 1306, 'char_end': 1307, 'chars': 'm'}, {'char_start': 1309, 'char_end': 131... | 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. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.