cwe
stringclasses
9 values
func_name
stringclasses
551 values
func_src_before
stringlengths
72
114k
func_src_after
stringclasses
576 values
line_changes
stringclasses
576 values
char_changes
stringclasses
574 values
commit_link
stringclasses
430 values
file_name
stringclasses
411 values
vul_type
stringclasses
9 values
num_tokens
float64
16
28.1k
⌀
refactored
bool
2 classes
parsing_score
bool
2 classes
generated
bool
2 classes
cwe-089
compare_and_update
@staticmethod def compare_and_update(user, message): """ This method compare a user object from the bot and his info from the Telegram message to check whether a user has changed his bio or not. If yes, the user object that represents him in the bot will be updated accord...
@staticmethod def compare_and_update(user, message): """ This method compare a user object from the bot and his info from the Telegram message to check whether a user has changed his bio or not. If yes, the user object that represents him in the bot will be updated accord...
{'deleted': [{'line_no': 41, 'char_start': 1578, 'char_end': 1635, 'line': ' f"SET first_name=\'{user.first_name}\', "\n'}, {'line_no': 42, 'char_start': 1635, 'char_end': 1684, 'line': ' f"nickname=\'{user.nickname}\', "\n'}, {'line_no': 43, 'char_start': 1684, 'char_end': 1734, 'line':...
{'deleted': [{'char_start': 1612, 'char_end': 1615, 'chars': "'{u"}, {'char_start': 1616, 'char_end': 1631, 'chars': "er.first_name}'"}, {'char_start': 1663, 'char_end': 1666, 'chars': "'{u"}, {'char_start': 1667, 'char_end': 1680, 'chars': "er.nickname}'"}, {'char_start': 1713, 'char_end': 1722, 'chars': "'{user.la"},...
github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a
photogpsbot/users.py
cwe-089
401
false
true
false
cwe-089
delete_data
def delete_data(self, session, id): self._openContainer(session) sid = str(id) if (self.idNormalizer is not None): sid = self.idNormalizer.process_string(session, str(id)) query = "DELETE FROM %s WHERE identifier = '%s';" % (self.table, sid) self._query(query) ...
def delete_data(self, session, id): self._openContainer(session) sid = str(id) if (self.idNormalizer is not None): sid = self.idNormalizer.process_string(session, str(id)) query = "DELETE FROM %s WHERE identifier = $1;" % (self.table) self._query(query, sid) ...
{'deleted': [{'line_no': 6, 'char_start': 212, 'char_end': 290, 'line': ' query = "DELETE FROM %s WHERE identifier = \'%s\';" % (self.table, sid)\n'}, {'line_no': 7, 'char_start': 290, 'char_end': 317, 'line': ' self._query(query)\n'}], 'added': [{'line_no': 6, 'char_start': 212, 'char_end': 283, 'line': ...
{'deleted': [{'char_start': 263, 'char_end': 267, 'chars': "'%s'"}, {'char_start': 283, 'char_end': 288, 'chars': ', sid'}], 'added': [{'char_start': 263, 'char_end': 265, 'chars': '$1'}, {'char_start': 308, 'char_end': 313, 'chars': ', sid'}]}
github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e
cheshire3/sql/postgresStore.py
cwe-089
79
false
true
false
cwe-089
update_title
def update_title(self, title = None): if (not self.title): self.title = title # This will fall to a sql injection sql = "UPDATE jdk_entries SET title = '" + self.title + "'" + \ "WHERE jdk_entries.id = '" + self.entry_id + "';" db_execute(sql) self.update_date_modified() ...
def update_title(self, title = None): if (not self.title): self.title = title quote_tuple = self.title, self.entry_id # This will fall to a sql injection sql = "UPDATE jdk_entries SET title = ?" + \ "WHERE jdk_entries.id = ?;" db_execute(sql, quote_tuple) self.update_...
{'deleted': [{'line_no': 6, 'char_start': 132, 'char_end': 200, 'line': ' sql = "UPDATE jdk_entries SET title = \'" + self.title + "\'" + \\\n'}, {'line_no': 7, 'char_start': 200, 'char_end': 261, 'line': ' "WHERE jdk_entries.id = \'" + self.entry_id + "\';" \n'}, {'line_no': 9, 'char_start': 262, 'char_end...
{'deleted': [{'char_start': 174, 'char_end': 194, 'chars': '\'" + self.title + "\''}, {'char_start': 234, 'char_end': 257, 'chars': '\'" + self.entry_id + "\''}], 'added': [{'char_start': 95, 'char_end': 140, 'chars': 'quote_tuple = self.title, self.entry_id\n\n '}, {'char_start': 219, 'char_end': 220, 'chars': '?'}...
github.com/peterlebrun/jdk/commit/000238566fbe55ba09676c3d57af04ae207235ae
entry.py
cwe-089
85
false
true
false
cwe-089
user_verify
def user_verify(self): eid = self.email code = self.password if eid.strip() == '': return if code.strip() == '': return query = '''select * from usr where email like\''''+eid+'\'' cursor = g.conn.execute(query) for row in cursor: ...
def user_verify(self): eid = self.email code = self.password if eid.strip() == '': return if code.strip() == '': return query = 'select * from usr where email like %s' cursor = g.conn.execute(query, (eid, )) for row in cursor: ...
{'deleted': [{'line_no': 8, 'char_start': 180, 'char_end': 248, 'line': " query = '''select * from usr where email like\\''''+eid+'\\''\n"}, {'line_no': 9, 'char_start': 248, 'char_end': 287, 'line': ' cursor = g.conn.execute(query)\n'}], 'added': [{'line_no': 8, 'char_start': 180, 'char_end': 236, 'line'...
{'deleted': [{'char_start': 197, 'char_end': 199, 'chars': "''"}, {'char_start': 233, 'char_end': 246, 'chars': "\\''''+eid+'\\'"}], 'added': [{'char_start': 231, 'char_end': 234, 'chars': ' %s'}, {'char_start': 273, 'char_end': 282, 'chars': ', (eid, )'}]}
github.com/Daniel-Bu/w4111-project1/commit/fe04bedc72e62fd4c4ee046a9af29fd81e9b3340
Web-app/User.py
cwe-089
115
false
true
false
cwe-089
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...
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...
{'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'}]}
github.com/JeremiahO/crimemap/commit/c17537fcd7aa4e2a26f7ca5cefaeb356ff646858
dbhelper.py
cwe-089
80
false
true
false
cwe-089
top_proxies
@app.route('/top_proxies') def top_proxies(): con = psycopg2.connect(**config.POSTGRES) cur = con.cursor() query = "SELECT sum(amount) FROM holders" cur.execute(query) total = cur.fetchone() total_votes = total[0] query = "SELECT voting_as FROM holders WHERE voting_as<>'1.2.5' group by vot...
@app.route('/top_proxies') def top_proxies(): con = psycopg2.connect(**config.POSTGRES) cur = con.cursor() query = "SELECT sum(amount) FROM holders" cur.execute(query) total = cur.fetchone() total_votes = total[0] query = "SELECT voting_as FROM holders WHERE voting_as<>'1.2.5' group by vot...
{'deleted': [{'line_no': 25, 'char_start': 551, 'char_end': 650, 'line': ' query = "SELECT account_name, amount FROM holders WHERE account_id=\'"+proxy_id+"\' LIMIT 1"\n'}, {'line_no': 26, 'char_start': 650, 'char_end': 677, 'line': ' cur.execute(query)\n'}, {'line_no': 39, 'char_start': 910, 'char_end': ...
{'deleted': [{'char_start': 626, 'char_end': 640, 'chars': '\'"+proxy_id+"\''}, {'char_start': 982, 'char_end': 996, 'chars': '\'"+proxy_id+"\''}], 'added': [{'char_start': 626, 'char_end': 628, 'chars': '%s'}, {'char_start': 663, 'char_end': 676, 'chars': ', (proxy_id,)'}, {'char_start': 983, 'char_end': 985, 'chars':...
github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60
api.py
cwe-089
429
false
true
false
cwe-089
add_consumption_data_row
def add_consumption_data_row(self, ts, energy_used, power_used): if power_used > 0: query = ''' INSERT OR IGNORE INTO Consumption ( TimeStamp, EnergyUsed, PowerUsed ) VAL...
def add_consumption_data_row(self, ts, energy_used, power_used): if power_used > 0: query = ''' INSERT OR IGNORE INTO Consumption ( TimeStamp, EnergyUsed, PowerUsed ) VAL...
{'deleted': [{'line_no': 11, 'char_start': 326, 'char_end': 350, 'line': ' %s,\n'}, {'line_no': 12, 'char_start': 350, 'char_end': 374, 'line': ' %s,\n'}, {'line_no': 13, 'char_start': 374, 'char_end': 397, 'line': ' %s\n'}, {'line_no': 15, 'char_start': 416, 'ch...
{'deleted': [{'char_start': 346, 'char_end': 348, 'chars': '%s'}, {'char_start': 370, 'char_end': 372, 'chars': '%s'}, {'char_start': 394, 'char_end': 396, 'chars': '%s'}, {'char_start': 431, 'char_end': 444, 'chars': ' % (ts, 0, 0)'}, {'char_start': 586, 'char_end': 588, 'chars': '%s'}, {'char_start': 630, 'char_end':...
github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65
util/database.py
cwe-089
144
false
true
false
cwe-089
get_current_state
def get_current_state(chat_id): settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__))+"\\bases\\settings.db") conn = settings.cursor() conn.execute("select * from users where chat_id = '" + str(chat_id) + "'") name = conn.fetchone() if name != None: return name[4] else: ...
def get_current_state(chat_id): settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__))+"\\bases\\settings.db") conn = settings.cursor() conn.execute("select * from users where chat_id = ?", (str(chat_id),)) name = conn.fetchone() if name != None: return name[4] else: ...
{'deleted': [{'line_no': 4, 'char_start': 159, 'char_end': 238, 'line': ' conn.execute("select * from users where chat_id = \'" + str(chat_id) + "\'")\n'}], 'added': [{'line_no': 4, 'char_start': 159, 'char_end': 234, 'line': ' conn.execute("select * from users where chat_id = ?", (str(chat_id),))\n'}]}
{'deleted': [{'char_start': 213, 'char_end': 214, 'chars': "'"}, {'char_start': 215, 'char_end': 217, 'chars': ' +'}, {'char_start': 230, 'char_end': 236, 'chars': ' + "\'"'}], 'added': [{'char_start': 213, 'char_end': 214, 'chars': '?'}, {'char_start': 215, 'char_end': 216, 'chars': ','}, {'char_start': 217, 'char_end...
github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90
bot.py
cwe-089
85
false
true
false
cwe-089
stats
@bot.message_handler(commands=['stats']) def stats(message): settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db") conn = settings.cursor() conn.execute("select * from users where chat_id = '" + str(message.chat.id) + "'") name = conn.fetchone() settings.clo...
@bot.message_handler(commands=['stats']) def stats(message): settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db") conn = settings.cursor() conn.execute("select * from users where chat_id = ?", (str(message.chat.id),)) name = conn.fetchone() settings.close()...
{'deleted': [{'line_no': 5, 'char_start': 190, 'char_end': 277, 'line': ' conn.execute("select * from users where chat_id = \'" + str(message.chat.id) + "\'")\n'}], 'added': [{'line_no': 5, 'char_start': 190, 'char_end': 273, 'line': ' conn.execute("select * from users where chat_id = ?", (str(message.chat.id),))...
{'deleted': [{'char_start': 244, 'char_end': 245, 'chars': "'"}, {'char_start': 246, 'char_end': 248, 'chars': ' +'}, {'char_start': 269, 'char_end': 275, 'chars': ' + "\'"'}], 'added': [{'char_start': 244, 'char_end': 245, 'chars': '?'}, {'char_start': 246, 'char_end': 247, 'chars': ','}, {'char_start': 248, 'char_end...
github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90
bot.py
cwe-089
247
false
true
false
cwe-089
__init__.callback
def callback(recipeName): menu.pack_forget() viewRecipeFrame.pack(expand=True, fill='both') groceryButton.pack_forget() database_file = "meal_planner.db" print(recipeName) with sqlite3.connect(database_file) as conn: cursor ...
def callback(recipeName): menu.pack_forget() viewRecipeFrame.pack(expand=True, fill='both') groceryButton.pack_forget() database_file = "meal_planner.db" print(recipeName) with sqlite3.connect(database_file) as conn: cursor ...
{'deleted': [{'line_no': 9, 'char_start': 336, 'char_end': 448, 'line': ' selection = cursor.execute("""SELECT * FROM recipe WHERE name = """ + "\\"" + recipeName + "\\"")\n'}], 'added': [{'line_no': 9, 'char_start': 336, 'char_end': 439, 'line': ' selection = cursor.execute("""SELECT * FR...
{'deleted': [{'char_start': 419, 'char_end': 421, 'chars': ' +'}, {'char_start': 422, 'char_end': 429, 'chars': '"\\"" + '}, {'char_start': 439, 'char_end': 441, 'chars': ' +'}, {'char_start': 442, 'char_end': 446, 'chars': '"\\""'}], 'added': [{'char_start': 416, 'char_end': 418, 'chars': '?;'}, {'char_start': 421, 'c...
github.com/trishamoyer/RecipePlanner-Python/commit/44d2ce370715d9344fad34b3b749322ab095a925
mealPlan.py
cwe-089
377
false
true
false
cwe-089
also_add
def also_add(name, also): db = db_connect() cursor = db.cursor() try: cursor.execute(''' INSERT INTO isalso(name,also) VALUES('{}','{}') '''.format(name, also)) db.commit() logger.debug('added to isalso name {} with value {}'.format( name, also)) ...
def also_add(name, also): db = db_connect() cursor = db.cursor() try: cursor.execute(''' INSERT INTO isalso(name,also) VALUES(%(name)s,%(also)s) ''', ( name, also, )) db.commit() logger.debug('added to isalso name {} with value ...
{'deleted': [{'line_no': 6, 'char_start': 109, 'char_end': 169, 'line': " INSERT INTO isalso(name,also) VALUES('{}','{}')\n"}, {'line_no': 7, 'char_start': 169, 'char_end': 205, 'line': " '''.format(name, also))\n"}], 'added': [{'line_no': 6, 'char_start': 109, 'char_end': 177, 'line': ' ...
{'deleted': [{'char_start': 158, 'char_end': 162, 'chars': "'{}'"}, {'char_start': 163, 'char_end': 167, 'chars': "'{}'"}, {'char_start': 184, 'char_end': 191, 'chars': '.format'}], 'added': [{'char_start': 158, 'char_end': 166, 'chars': '%(name)s'}, {'char_start': 167, 'char_end': 175, 'chars': '%(also)s'}, {'char_sta...
github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a
KarmaBoi/dbopts.py
cwe-089
98
false
true
false
cwe-089
add_item
def add_item(self, item): """"Add new item.""" if self.connection: self.cursor.execute('insert into item (name, shoppinglistid) values ("%s", "%s")' % (item[0], item[1])) self.connection.commit()
def add_item(self, item): """"Add new item.""" if self.connection: t = (item[0], item[1], ) self.cursor.execute('insert into item (name, shoppinglistid) values (?, ?)', t) self.connection.commit()
{'deleted': [{'line_no': 4, 'char_start': 87, 'char_end': 203, 'line': ' self.cursor.execute(\'insert into item (name, shoppinglistid) values ("%s", "%s")\' % (item[0], item[1]))\n'}], 'added': [{'line_no': 4, 'char_start': 87, 'char_end': 124, 'line': ' t = (item[0], item[1], )\n'}, {'line_no': 5...
{'deleted': [{'char_start': 168, 'char_end': 172, 'chars': '"%s"'}, {'char_start': 174, 'char_end': 178, 'chars': '"%s"'}, {'char_start': 180, 'char_end': 191, 'chars': ' % (item[0]'}, {'char_start': 193, 'char_end': 194, 'chars': 'i'}, {'char_start': 195, 'char_end': 201, 'chars': 'em[1])'}], 'added': [{'char_start': ...
github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a
ecosldb/ecosldb.py
cwe-089
58
false
true
false
cwe-089
send_message
@frappe.whitelist(allow_guest=True) def send_message(subject="Website Query", message="", sender="", status="Open"): from frappe.www.contact import send_message as website_send_message lead = customer = None website_send_message(subject, message, sender) customer = frappe.db.sql("""select distinct dl.link_name fr...
@frappe.whitelist(allow_guest=True) def send_message(subject="Website Query", message="", sender="", status="Open"): from frappe.www.contact import send_message as website_send_message lead = customer = None website_send_message(subject, message, sender) customer = frappe.db.sql("""select distinct dl.link_name fr...
{'deleted': [{'line_no': 10, 'char_start': 424, 'char_end': 482, 'line': '\t\tand c.email_id=\'{email_id}\'""".format(email_id=sender))\n'}], 'added': [{'line_no': 10, 'char_start': 424, 'char_end': 458, 'line': '\t\tand c.email_id = %s""", sender)\n'}]}
{'deleted': [{'char_start': 441, 'char_end': 453, 'chars': "'{email_id}'"}, {'char_start': 456, 'char_end': 473, 'chars': '.format(email_id='}, {'char_start': 479, 'char_end': 480, 'chars': ')'}], 'added': [{'char_start': 440, 'char_end': 441, 'chars': ' '}, {'char_start': 442, 'char_end': 445, 'chars': ' %s'}, {'char_...
github.com/libracore/erpnext/commit/9acb885e60f77cd4e9ea8c98bdc39c18abcac731
erpnext/templates/utils.py
cwe-089
364
false
true
false
cwe-089
test_process_as_form
@unpack def test_process_as_form(self, job_number, dcn_key, was_prev_matched, was_prev_closed, was_prev_tracked): email_obj = { 'sender' : "Alex Roy <Alex.Roy@dilfo.com>", 'subject' : "DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`", 'date' : "Tue, 7 May 20...
@unpack def test_process_as_form(self, job_number, dcn_key, was_prev_matched, was_prev_closed, was_prev_tracked): email_obj = { 'sender' : "Alex Roy <Alex.Roy@dilfo.com>", 'subject' : "DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`", 'date' : "Tue, 7 May 20...
{'deleted': [{'line_no': 18, 'char_start': 823, 'char_end': 876, 'line': " VALUES ({}, 'alex.roy616@gmail.com', {})\n"}, {'line_no': 22, 'char_start': 992, 'char_end': 1045, 'line': " VALUES ({}, 'alex.roy616@gmail.com', {})\n"}, {'line_no': 26, 'char_start': 1151, 'char_end': 1244, 'line': ' ...
{'deleted': [{'char_start': 843, 'char_end': 845, 'chars': '{}'}, {'char_start': 872, 'char_end': 874, 'chars': '{}'}, {'char_start': 1012, 'char_end': 1014, 'chars': '{}'}, {'char_start': 1041, 'char_end': 1043, 'chars': '{}'}, {'char_start': 1206, 'char_end': 1214, 'chars': '.format('}, {'char_start': 1241, 'char_end...
github.com/confirmationbias616/certificate_checker/commit/9e890b9613b627e3a5995d0e4a594c8e0831e2ce
tests.py
cwe-089
641
false
true
false
cwe-089
set_language
def set_language(self, lang): """ Update language of user in the User object and in the database :param lang: string with language tag like "en-US" :return: None """ log.debug('Updating info about user %s language ' 'in memory & database...', self) ...
def set_language(self, lang): """ Update language of user in the User object and in the database :param lang: string with language tag like "en-US" :return: None """ log.debug('Updating info about user %s language ' 'in memory & database...', self) ...
{'deleted': [{'line_no': 13, 'char_start': 383, 'char_end': 435, 'line': ' f"SET language=\'{self.language}\' "\n'}, {'line_no': 14, 'char_start': 435, 'char_end': 487, 'line': ' f"WHERE chat_id=\'{self.chat_id}\'")\n'}, {'line_no': 17, 'char_start': 501, 'char_end': 527, 'line': ' ...
{'deleted': [{'char_start': 415, 'char_end': 417, 'chars': "'{"}, {'char_start': 418, 'char_end': 432, 'chars': "elf.language}'"}, {'char_start': 468, 'char_end': 470, 'chars': "'{"}, {'char_start': 482, 'char_end': 487, 'chars': '}\'")\n'}], 'added': [{'char_start': 415, 'char_end': 416, 'chars': '%'}, {'char_start': ...
github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a
photogpsbot/users.py
cwe-089
143
false
true
false
cwe-089
isValidAdmToken
def isValidAdmToken(adm_token): conn, c = connectDB() req = "SELECT * from {} where adm_token='{}'".format(CFG("admintoken_table_name"), adm_token) answer = bool(queryOne(c, req)) closeDB(conn) return answer
def isValidAdmToken(adm_token): conn, c = connectDB() req = "SELECT * from {} where adm_token=?".format(CFG("admintoken_table_name")) answer = bool(queryOne(c, req, (adm_token,))) closeDB(conn) return answer
{'deleted': [{'line_no': 3, 'char_start': 58, 'char_end': 157, 'line': ' req = "SELECT * from {} where adm_token=\'{}\'".format(CFG("admintoken_table_name"), adm_token)\n'}, {'line_no': 4, 'char_start': 157, 'char_end': 193, 'line': ' answer = bool(queryOne(c, req))\n'}], 'added': [{'line_no': 3, 'char_start': 5...
{'deleted': [{'char_start': 103, 'char_end': 107, 'chars': "'{}'"}, {'char_start': 144, 'char_end': 155, 'chars': ', adm_token'}], 'added': [{'char_start': 103, 'char_end': 104, 'chars': '?'}, {'char_start': 176, 'char_end': 190, 'chars': ', (adm_token,)'}]}
github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109
database.py
cwe-089
64
false
true
false
cwe-089
auto_unlock_tasks
@staticmethod def auto_unlock_tasks(project_id: int): """Unlock all tasks locked for longer than the auto-unlock delta""" expiry_delta = Task.auto_unlock_delta() lock_duration = (datetime.datetime.min + expiry_delta).time().isoformat() expiry_date = datetime.datetime.utcnow() - e...
@staticmethod def auto_unlock_tasks(project_id: int): """Unlock all tasks locked for longer than the auto-unlock delta""" expiry_delta = Task.auto_unlock_delta() lock_duration = (datetime.datetime.min + expiry_delta).time().isoformat() expiry_date = datetime.datetime.utcnow() - e...
{'deleted': [{'line_no': 14, 'char_start': 652, 'char_end': 687, 'line': ' AND t.project_id = {0}\n'}, {'line_no': 15, 'char_start': 687, 'char_end': 727, 'line': " AND th.action_date <= '{1}'\n"}, {'line_no': 16, 'char_start': 727, 'char_end': 780, 'line': " '''.format(project_id, str(...
{'deleted': [{'char_start': 683, 'char_end': 686, 'chars': '{0}'}, {'char_start': 721, 'char_end': 726, 'chars': "'{1}'"}, {'char_start': 742, 'char_end': 779, 'chars': '.format(project_id, str(expiry_date))'}], 'added': [{'char_start': 683, 'char_end': 694, 'chars': ':project_id'}, {'char_start': 729, 'char_end': 741,...
github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a
server/models/postgis/task.py
cwe-089
248
false
true
false
cwe-089
save_failure_transaction
def save_failure_transaction(self, user_id, project_id, money): self.cursor.execute("insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, %s, now(), 'failed' )" % (project_id, user_id, money)) self.db.commit()
def save_failure_transaction(self, user_id, project_id, money): self.cursor.execute("insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, " "%s, now(), 'failed' )", (project_id, user_id, money)) self.db.commit()
{'deleted': [{'line_no': 2, 'char_start': 68, 'char_end': 239, 'line': ' self.cursor.execute("insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, %s, now(), \'failed\' )" % (project_id, user_id, money))\n'}], 'added': [{'line_no': 2, 'char_start': 68, 'char_end': 186, 'line': '...
{'deleted': [{'char_start': 206, 'char_end': 208, 'chars': ' %'}], 'added': [{'char_start': 184, 'char_end': 215, 'chars': '"\n "'}, {'char_start': 237, 'char_end': 238, 'chars': ','}]}
github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b
backend/transactions/TransactionConnector.py
cwe-089
66
false
true
false
cwe-089
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
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
{'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...
github.com/kenboo98/291-Mini-Project-I/commit/3080ccb687c79c83954ce703faee8fcceec8c9eb
book_rides/book_rides.py
cwe-089
65
false
true
false
cwe-089
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...
@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...
{'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...
github.com/CaitlinKennedy/Tech-Track/commit/20ef2d4010f9497b8221524edd0c706e2c6a4147
src/tech_track.py
cwe-089
139
false
true
false
cwe-089
registerPlayer
def registerPlayer(name): """Adds a player to the tournament database. The database assigns a unique serial id number for the player. (This should be handled by your SQL database schema, not in your Python code.) Args: name: the player's full name (need not be unique). """ conn = connec...
def registerPlayer(name): """Adds a player to the tournament database. The database assigns a unique serial id number for the player. (This should be handled by your SQL database schema, not in your Python code.) Args: name: the player's full name (need not be unique). """ conn = connec...
{'deleted': [{'line_no': 12, 'char_start': 351, 'char_end': 425, 'line': ' cursor.execute("INSERT INTO players (name) VALUES (\'%s\')" % (name,));\n'}], 'added': [{'line_no': 12, 'char_start': 351, 'char_end': 405, 'line': ' query = "INSERT INTO players (name) VALUES (%s);"\n'}, {'line_no': 13, 'char_start': 405,...
{'deleted': [{'char_start': 355, 'char_end': 356, 'chars': 'c'}, {'char_start': 357, 'char_end': 360, 'chars': 'rso'}, {'char_start': 361, 'char_end': 370, 'chars': '.execute('}, {'char_start': 406, 'char_end': 407, 'chars': "'"}, {'char_start': 409, 'char_end': 410, 'chars': "'"}, {'char_start': 413, 'char_end': 414, ...
github.com/sarahkcaplan/tournament/commit/40aba5686059f5f398f6323b1483412c56140cc0
tournament.py
cwe-089
106
false
true
false
cwe-089
insertNPC
def insertNPC(name, race,classe,sex,level,image,legit): c, conn = getConnection() date = now() c.execute("INSERT INTO npc VALUES ('"+date+"','"+str(name)+"','"+race+"','"+classe+"','"+sex+"','"+str(level)+"','"+image+"','"+str(legit)+"')") conn.commit() conn.close()
def insertNPC(name, race,classe,sex,level,image,legit): c, conn = getConnection() date = now() c.execute("INSERT INTO npc VALUES (?,?,?,?,?,?,?,?)",(date,str(name),race,classe,sex,str(level),image,str(legit))) conn.commit() conn.close()
{'deleted': [{'line_no': 4, 'char_start': 97, 'char_end': 243, 'line': '\tc.execute("INSERT INTO npc VALUES (\'"+date+"\',\'"+str(name)+"\',\'"+race+"\',\'"+classe+"\',\'"+sex+"\',\'"+str(level)+"\',\'"+image+"\',\'"+str(legit)+"\')")\n'}], 'added': [{'line_no': 4, 'char_start': 97, 'char_end': 213, 'line': '\tc.execut...
{'deleted': [{'char_start': 133, 'char_end': 134, 'chars': "'"}, {'char_start': 135, 'char_end': 136, 'chars': '+'}, {'char_start': 140, 'char_end': 143, 'chars': '+"\''}, {'char_start': 144, 'char_end': 147, 'chars': '\'"+'}, {'char_start': 156, 'char_end': 159, 'chars': '+"\''}, {'char_start': 160, 'char_end': 163, '...
github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0
database.py
cwe-089
73
false
true
false
cwe-089
tid_num_to_tag_nums
def tid_num_to_tag_nums(self, tid_num): ''' Returns list of the associated tag_nums to the given tid_num. ''' q = "SELECT tag FROM tid_tag WHERE tid = '" + str(tid_num) + "'" self.query(q) return [i[0] for i in self.c.fetchall()]
def tid_num_to_tag_nums(self, tid_num): ''' Returns list of the associated tag_nums to the given tid_num. ''' q = "SELECT tag FROM tid_tag WHERE tid = ?" self.query(q, tid_num) return [i[0] for i in self.c.fetchall()]
{'deleted': [{'line_no': 4, 'char_start': 123, 'char_end': 196, 'line': ' q = "SELECT tag FROM tid_tag WHERE tid = \'" + str(tid_num) + "\'"\n'}, {'line_no': 5, 'char_start': 196, 'char_end': 218, 'line': ' self.query(q)\n'}], 'added': [{'line_no': 4, 'char_start': 123, 'char_end': 175, 'line': ' q...
{'deleted': [{'char_start': 172, 'char_end': 194, 'chars': '\'" + str(tid_num) + "\''}], 'added': [{'char_start': 172, 'char_end': 173, 'chars': '?'}, {'char_start': 195, 'char_end': 204, 'chars': ', tid_num'}]}
github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b
modules/query_lastfm.py
cwe-089
68
false
true
false
cwe-089
writeToDb
def writeToDb(self, url): try: self.cursor.execute("INSERT INTO queue (url, visited) VALUES ('{}', '0');".format(url)) self.db.commit() except Exception as e: print(e)
def writeToDb(self, url): try: self.cursor.execute("INSERT INTO queue (url, visited) VALUES (?, '0');", url) self.db.commit() except Exception as e: print(e)
{'deleted': [{'line_no': 3, 'char_start': 43, 'char_end': 143, 'line': ' self.cursor.execute("INSERT INTO queue (url, visited) VALUES (\'{}\', \'0\');".format(url))\n'}], 'added': [{'line_no': 3, 'char_start': 43, 'char_end': 133, 'line': ' self.cursor.execute("INSERT INTO queue (url, visited) VAL...
{'deleted': [{'char_start': 117, 'char_end': 121, 'chars': "'{}'"}, {'char_start': 129, 'char_end': 137, 'chars': '.format('}, {'char_start': 140, 'char_end': 141, 'chars': ')'}], 'added': [{'char_start': 117, 'char_end': 118, 'chars': '?'}, {'char_start': 126, 'char_end': 128, 'chars': ', '}]}
github.com/jappe999/WebScraper/commit/46a4e0843aa44d903293637afad53dfcbc37b480
beta/database.py
cwe-089
50
false
true
false
cwe-089
test
@mod.route('/test', methods=['GET', 'POST']) def test(): user_id = session['logged_id'] sql = 'SELECT * FROM message where user_id = %d ORDER BY c_time DESC' \ % (user_id) cursor.execute(sql) m = cursor.fetchall() print(m)
@mod.route('/test', methods=['GET', 'POST']) def test(): user_id = session['logged_id'] cursor.execute('SELECT * FROM message where user_id = %s ORDER BY c_time DESC', (user_id,)) m = cursor.fetchall() print(m)
{'deleted': [{'line_no': 4, 'char_start': 92, 'char_end': 168, 'line': " sql = 'SELECT * FROM message where user_id = %d ORDER BY c_time DESC' \\\n"}, {'line_no': 5, 'char_start': 168, 'char_end': 188, 'line': ' % (user_id)\n'}, {'line_no': 6, 'char_start': 188, 'char_end': 212, 'line': ' cursor.execute(sq...
{'deleted': [{'char_start': 97, 'char_end': 102, 'chars': 'ql = '}, {'char_start': 142, 'char_end': 143, 'chars': 'd'}, {'char_start': 165, 'char_end': 177, 'chars': ' \\\n %'}, {'char_start': 187, 'char_end': 210, 'chars': '\n cursor.execute(sql'}], 'added': [{'char_start': 96, 'char_end': 99, 'chars': 'cur'...
github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9
flaskr/flaskr/views/message.py
cwe-089
67
false
true
false
cwe-089
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...
@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...
{'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,)'}]}
github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60
api.py
cwe-089
146
false
true
false
cwe-089
change_pass
def change_pass(self, new_pass, logged_user): update_sql = """ UPDATE Clients SET password = '{}' WHERE client_id = '{}' """.format(new_pass, logged_user.get_client_id()) cursor = self.__conn.cursor() cursor.execute(update_sql) self.__con...
def change_pass(self, new_pass, logged_user): update_sql = """ UPDATE Clients SET password = ? WHERE client_id = ? """ cursor = self.__conn.cursor() cursor.execute(update_sql, (new_pass, logged_user.get_client_id())) self.__conn.commit()
{'deleted': [{'line_no': 4, 'char_start': 102, 'char_end': 134, 'line': " SET password = '{}'\n"}, {'line_no': 5, 'char_start': 134, 'char_end': 169, 'line': " WHERE client_id = '{}'\n"}, {'line_no': 6, 'char_start': 169, 'char_end': 227, 'line': ' """.format(new_pass, logged_user.get_clien...
{'deleted': [{'char_start': 129, 'char_end': 133, 'chars': "'{}'"}, {'char_start': 164, 'char_end': 168, 'chars': "'{}'"}, {'char_start': 180, 'char_end': 226, 'chars': '.format(new_pass, logged_user.get_client_id())'}], 'added': [{'char_start': 129, 'char_end': 130, 'chars': '?'}, {'char_start': 161, 'char_end': 162, ...
github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3
Week_9/sql_manager.py
cwe-089
66
false
true
false
cwe-089
fetch_issue
def fetch_issue(cursor, id): """ Fetch an issue by id along with its tags. Returns None if no issue with the specified id exists in the database. """ cursor.execute(f""" SELECT issue.id, issue.title, issue.description, tag.namespace, ...
def fetch_issue(cursor, id): """ Fetch an issue by id along with its tags. Returns None if no issue with the specified id exists in the database. """ cursor.execute(""" SELECT issue.id, issue.title, issue.description, tag.namespace, ...
{'deleted': [{'line_no': 6, 'char_start': 166, 'char_end': 190, 'line': ' cursor.execute(f"""\n'}, {'line_no': 18, 'char_start': 457, 'char_end': 485, 'line': ' issue.id = {id}\n'}, {'line_no': 19, 'char_start': 485, 'char_end': 494, 'line': ' """)\n'}], 'added': [{'line_no': 6, 'char_start': 166, 'cha...
{'deleted': [{'char_start': 185, 'char_end': 186, 'chars': 'f'}, {'char_start': 480, 'char_end': 484, 'chars': '{id}'}], 'added': [{'char_start': 479, 'char_end': 480, 'chars': '?'}, {'char_start': 488, 'char_end': 495, 'chars': ', (id,)'}]}
github.com/nutty7t/tissue/commit/306dd094749bb39cbd5c74a6ded3d3b191033061
server/server.py
cwe-089
207
false
true
false
cwe-089
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']
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']
{'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 ...
github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6
video/video_repository.py
cwe-089
52
false
true
false
cwe-089
get_requested_month_for_inverter
def get_requested_month_for_inverter(self, inverter_serial, date): data = dict() month_start, month_end = self.get_epoch_month(date) data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)...
def get_requested_month_for_inverter(self, inverter_serial, date): data = dict() month_start, month_end = self.get_epoch_month(date) data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)...
{'deleted': [{'line_no': 11, 'char_start': 444, 'char_end': 506, 'line': ' WHERE TimeStamp BETWEEN %s AND %s AND Serial = %s\n'}, {'line_no': 15, 'char_start': 553, 'char_end': 639, 'line': ' for row in self.c.execute(query % (month_start, month_end, inverter_serial)):\n'}, {'line_no': 24, 'char_start...
{'deleted': [{'char_start': 480, 'char_end': 482, 'chars': '%s'}, {'char_start': 487, 'char_end': 489, 'chars': '%s'}, {'char_start': 500, 'char_end': 501, 'chars': ' '}, {'char_start': 502, 'char_end': 505, 'chars': ' %s'}, {'char_start': 592, 'char_end': 594, 'chars': ' %'}, {'char_start': 966, 'char_end': 967, 'char...
github.com/philipptrenz/sunportal/commit/7eef493a168ed4e6731ff800713bfb8aee99a506
util/database.py
cwe-089
309
false
true
false
cwe-089
getCommentsLike
def getCommentsLike(self,commentid): sqlText="select userid from comment_like where commentid=%d"%(commentid) result=sql.queryDB(self.conn,sqlText) return result;
def getCommentsLike(self,commentid): sqlText="select userid from comment_like where commentid=%s" params=[commentid] result=sql.queryDB(self.conn,sqlText,params) return result;
{'deleted': [{'line_no': 2, 'char_start': 41, 'char_end': 122, 'line': ' sqlText="select userid from comment_like where commentid=%d"%(commentid)\n'}, {'line_no': 3, 'char_start': 122, 'char_end': 168, 'line': ' result=sql.queryDB(self.conn,sqlText)\n'}], 'added': [{'line_no': 2, 'char_start': 41, 'char_e...
{'deleted': [{'char_start': 107, 'char_end': 108, 'chars': 'd'}, {'char_start': 109, 'char_end': 111, 'chars': '%('}, {'char_start': 120, 'char_end': 121, 'chars': ')'}], 'added': [{'char_start': 107, 'char_end': 108, 'chars': 's'}, {'char_start': 109, 'char_end': 126, 'chars': '\n params=['}, {'char_start': 135...
github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9
modules/comment.py
cwe-089
44
false
true
false
cwe-089
register
@mod.route('/register', methods=['GET', 'POST']) def register(): if request.method == 'POST': error = None email = request.form['email'].strip() nickname = request.form['nickname'].strip() password = request.form['password'].strip() password2 = request.form['password2'].strip...
@mod.route('/register', methods=['GET', 'POST']) def register(): if request.method == 'POST': error = None email = request.form['email'].strip() nickname = request.form['nickname'].strip() password = request.form['password'].strip() password2 = request.form['password2'].strip...
{'deleted': [{'line_no': 22, 'char_start': 852, 'char_end': 918, 'line': ' sql = "SELECT * FROM users where email = \'%s\';" % (email)\n'}, {'line_no': 23, 'char_start': 918, 'char_end': 946, 'line': ' cursor.execute(sql)\n'}], 'added': [{'line_no': 22, 'char_start': 852, 'char_end': 926, 'line': ' ...
{'deleted': [{'char_start': 861, 'char_end': 866, 'chars': 'ql = '}, {'char_start': 901, 'char_end': 902, 'chars': "'"}, {'char_start': 904, 'char_end': 905, 'chars': "'"}, {'char_start': 907, 'char_end': 909, 'chars': ' %'}, {'char_start': 917, 'char_end': 944, 'chars': '\n cursor.execute(sql'}], 'added': [{'ch...
github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9
flaskr/flaskr/views/users.py
cwe-089
334
false
true
false
cwe-089
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
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
{'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...
github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63
bracket_utils.py
cwe-089
51
false
true
false
cwe-089
karma_add
def karma_add(name): karma = karma_ask(name) db = db_connect() cursor = db.cursor() if karma is None: try: cursor.execute(''' INSERT INTO people(name,karma,shame) VALUES('{}',1,0) '''.format(name)) db.commit() logger.debug('Inse...
def karma_add(name): karma = karma_ask(name) db = db_connect() cursor = db.cursor() if karma is None: try: cursor.execute(''' INSERT INTO people(name,karma,shame) VALUES(%(name)s,1,0) ''', name) db.commit() logger.debug('Inserte...
{'deleted': [{'line_no': 8, 'char_start': 162, 'char_end': 232, 'line': " INSERT INTO people(name,karma,shame) VALUES('{}',1,0)\n"}, {'line_no': 9, 'char_start': 232, 'char_end': 266, 'line': " '''.format(name))\n"}, {'line_no': 20, 'char_start': 588, 'char_end': 653, 'line': " ...
{'deleted': [{'char_start': 222, 'char_end': 226, 'chars': "'{}'"}, {'char_start': 251, 'char_end': 259, 'chars': '.format('}, {'char_start': 263, 'char_end': 264, 'chars': ')'}, {'char_start': 630, 'char_end': 633, 'chars': '{0}'}, {'char_start': 647, 'char_end': 652, 'chars': "'{1}'"}, {'char_start': 672, 'char_end':...
github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a
KarmaBoi/dbopts.py
cwe-089
207
false
true
false
cwe-089
build_board
def build_board(conn, game,size): # we'll build the empty board, and then fill in with the move list that # we get from the DB. board = [] for i in range(size): board.append([""]*size) # search for all moves that have happenend during this game. cursor = conn.cursor() cursor.execut...
def build_board(conn, game,size): # we'll build the empty board, and then fill in with the move list that # we get from the DB. board = [] for i in range(size): board.append([""]*size) # search for all moves that have happenend during this game. cursor = conn.cursor() cursor.execut...
{'deleted': [{'line_no': 11, 'char_start': 303, 'char_end': 380, 'line': ' cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;" % game)\n'}], 'added': [{'line_no': 11, 'char_start': 303, 'char_end': 382, 'line': ' cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;", (game,))\n'}]}
{'deleted': [{'char_start': 371, 'char_end': 373, 'chars': ' %'}], 'added': [{'char_start': 371, 'char_end': 372, 'chars': ','}, {'char_start': 373, 'char_end': 374, 'chars': '('}, {'char_start': 378, 'char_end': 380, 'chars': ',)'}]}
github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da
cgi/common.py
cwe-089
270
false
true
false
cwe-089
closeGame
def closeGame(ID): db.execute("UPDATE games set Running = 'No' WHERE ID = %i" % ID) database.commit()
def closeGame(ID): db.execute("UPDATE games set Running = 'No' WHERE ID = ?", ID) database.commit()
{'deleted': [{'line_no': 2, 'char_start': 19, 'char_end': 85, 'line': '\tdb.execute("UPDATE games set Running = \'No\' WHERE ID = %i" % ID)\n'}], 'added': [{'line_no': 2, 'char_start': 19, 'char_end': 83, 'line': '\tdb.execute("UPDATE games set Running = \'No\' WHERE ID = ?", ID)\n'}]}
{'deleted': [{'char_start': 75, 'char_end': 77, 'chars': '%i'}, {'char_start': 78, 'char_end': 80, 'chars': ' %'}], 'added': [{'char_start': 75, 'char_end': 76, 'chars': '?'}, {'char_start': 77, 'char_end': 78, 'chars': ','}]}
github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2
plugins/database.py
cwe-089
29
false
true
false
cwe-089
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}'""")
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, ))
{'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': ', )'}]}
github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485
apis/spaces.py
cwe-089
44
false
true
false
cwe-089
sloka
@app.route('/sloka') def sloka(): sloka_number = request.args.get('sloka_number') sloka_number_parts = sloka_number.split('.') sloka_number_previous = "%s.%s.%d" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])-1) sloka_number_next = "%s.%s.%d" % (sloka_number_parts[0], slo...
@app.route('/sloka') def sloka(): sloka_number = request.args.get('sloka_number') sloka_number_parts = sloka_number.split('.') sloka_number_previous = "%s.%s.%d" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])-1) sloka_number_next = "%s.%s.%d" % (sloka_number_parts[0], slo...
{'deleted': [{'line_no': 15, 'char_start': 494, 'char_end': 602, 'line': ' cur.execute("select * from mula where sloka_number = \'%s\' order by sloka_line;" % sloka_number)\n'}, {'line_no': 18, 'char_start': 638, 'char_end': 738, 'line': ' cur.execute("select * from pada where sloka_number = \'%s\...
{'deleted': [{'char_start': 559, 'char_end': 563, 'chars': "'%s'"}, {'char_start': 585, 'char_end': 587, 'chars': ' %'}, {'char_start': 703, 'char_end': 707, 'chars': "'%s'"}, {'char_start': 721, 'char_end': 723, 'chars': ' %'}], 'added': [{'char_start': 559, 'char_end': 560, 'chars': '?'}, {'char_start': 582, 'char_en...
github.com/aupasana/amara-quiz/commit/6ceb5dc8ec38b4a3f1399e578ab970f7e3354922
docker/app.py
cwe-089
299
false
true
false
cwe-089
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...
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...
{'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'}...
github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a
bin/solrcheckup.py
cwe-089
587
false
true
false
cwe-089
update_inverter
def update_inverter(self, inverter_serial, ts, status, etoday, etotal): query = ''' UPDATE Inverters SET TimeStamp='%s', Status='%s', eToday='%s', eTotal='%s' WHERE Serial='%s'; ''' % (ts, stat...
def update_inverter(self, inverter_serial, ts, status, etoday, etotal): query = ''' UPDATE Inverters SET TimeStamp=?, Status=?, eToday=?, eTotal=? WHERE Serial=?; ''' self.c.execute(que...
{'deleted': [{'line_no': 5, 'char_start': 146, 'char_end': 179, 'line': " TimeStamp='%s', \n"}, {'line_no': 6, 'char_start': 179, 'char_end': 209, 'line': " Status='%s', \n"}, {'line_no': 7, 'char_start': 209, 'char_end': 238, 'line': " eToday='%s',\n"}, {'line_no': 8, 'char...
{'deleted': [{'char_start': 172, 'char_end': 176, 'chars': "'%s'"}, {'char_start': 202, 'char_end': 206, 'chars': "'%s'"}, {'char_start': 232, 'char_end': 236, 'chars': "'%s'"}, {'char_start': 261, 'char_end': 265, 'chars': "'%s'"}, {'char_start': 291, 'char_end': 295, 'chars': "'%s'"}, {'char_start': 309, 'char_end': ...
github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65
util/database.py
cwe-089
89
false
true
false
cwe-089
get
def get(self, user_id): """ Fetch data for user with corresponding user_id """ return database_utilities.execute_query(f"""select * from users where user_id = '{user_id}'""")
def get(self, user_id): """ Fetch data for user with corresponding user_id """ return database_utilities.execute_query(f"""select * from users where user_id = %s""", (user_id, ))
{'deleted': [{'line_no': 3, 'char_start': 91, 'char_end': 194, 'line': ' return database_utilities.execute_query(f"""select * from users where user_id = \'{user_id}\'""")\n'}], 'added': [{'line_no': 3, 'char_start': 91, 'char_end': 198, 'line': ' return database_utilities.execute_query(f"""select * from u...
{'deleted': [{'char_start': 179, 'char_end': 181, 'chars': "'{"}, {'char_start': 188, 'char_end': 193, 'chars': '}\'"""'}], 'added': [{'char_start': 179, 'char_end': 187, 'chars': '%s""", ('}, {'char_start': 194, 'char_end': 197, 'chars': ', )'}]}
github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485
apis/users.py
cwe-089
41
false
true
false
cwe-089
null
def check_match(): if winner == loser: raise ValueError('Attempt to match player against self') sql_query = ''' SELECT COUNT(*) FROM matches WHERE (matches.winner_id = %s AND matches.loser_id = %s) OR (matches.winner_id = %s AND matches.loser_id = %s); ''' % (winner, loser, loser,...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def analyze_pair(): if winner == loser: raise ValueError('Attempt to match player against self') query = ''' SELECT COUNT(*) FROM matches WHERE (matches.winner_id = %s AND matches.loser_id = %s) OR (matches.winner_id = %s AND matches.loser_id = %s); ''' % (winner, loser, loser, wi...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def inspect_pair(): if winner == loser: raise ValueError('Attempt to match player against self') command = ''' SELECT COUNT(*) FROM matches WHERE (matches.winner_id = %s AND matches.loser_id = %s) OR (matches.winner_id = %s AND matches.loser_id = %s); ''' % (winner, loser, loser, ...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@bot.message_handler(commands=['stats']) def retrieve_user_statistics(message): db = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db") cursor_db = db.cursor() cursor_db.execute("select * from users where chat_id = '" + str(message.chat.id) + "'") data = cursor_db.fetc...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@bot.message_handler(commands=['stats']) def user_stats_command(message): con = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db") cur = con.cursor() cur.execute("select * from users where chat_id = '" + str(message.chat.id) + "'") user_details = cur.fetchone() con...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@bot.message_handler(commands=['stats']) def stats_handler(message): database_connection = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db") cursor = database_connection.cursor() cursor.execute("select * from users where chat_id = '" + str(message.chat.id) + "'") user...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def fetchPollOptions(poll_title): db_connection, cursor = connectDB() query_result = queryOne(cursor, "SELECT options FROM {} WHERE name='{}'".format(CFG("poll_table_name"), poll_title)) if query_result is None: return None option_list = query_result.split(",") closeDB(db_connection) re...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def retrievePollChoices(poll_identifier): database_conn, db_cursor = connectDB() options_string = queryOne(db_cursor, "SELECT options FROM {} WHERE name='{}'".format(CFG("poll_table_name"), poll_identifier)) if options_string == None: return None choices = options_string.split(",") closeDB(...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def obtain_articles(subject): with conn.cursor(cursor_factory=DictCursor) as cur: command = "SELECT * FROM articles WHERE subject='" + subject + "' ORDER BY last_submitted DESC" cur.execute(command) articles = cur.fetchall() return articles
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def get_articles_filtered_by_subject(subject_keyword): with conn.cursor(cursor_factory=DictCursor) as cur: sql_request = "SELECT * FROM articles WHERE subject='" + subject_keyword + "' ORDER BY last_submitted DESC" cur.execute(sql_request) articles_retrieved = cur.fetchall() return ...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def submit_crime(self, desc): db_conn = self.connect() try: sql_query = "INSERT INTO crimes (description) VALUES ('{}');".format(desc) with db_conn.cursor() as cursor: cursor.execute(sql_query) db_conn.commit() finally: db_conn.close()
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def enter_crime(self, entry): connection = self.connect() try: sql_command = "INSERT INTO crimes (description) VALUES ('{}');".format(entry) with connection.cursor() as cursor: cursor.execute(sql_command) connection.commit() finally: connection.close()
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/sloka') def fetch_sloka_details(): query_param = request.args.get('sloka_number') parts = query_param.split('.') prev_sloka = "%s.%s.%d" % (parts[0], parts[1], int(parts[2]) - 1) next_sloka = "%s.%s.%d" % (parts[0], parts[1], int(parts[2]) + 1) try: with sql.connect('amara.db')...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/sloka') def sloka_query(): param = request.args.get('sloka_number') sections = param.split('.') prev = "%s.%s.%d" % (sections[0], sections[1], int(sections[2]) - 1) nxt = "%s.%s.%d" % (sections[0], sections[1], int(sections[2]) + 1) try: with sql.connect('amara.db') as conn: ...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/sloka') def sloka_display(): sloka_id = request.args.get('sloka_number') parts = sloka_id.split('.') prev_sloka_id = "%s.%s.%d" % (parts[0], parts[1], int(parts[2]) - 1) next_sloka_id = "%s.%s.%d" % (parts[0], parts[1], int(parts[2]) + 1) try: with sql.connect('amara.db') as co...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/sloka') def sloka_show(): sloka_no = request.args.get('sloka_number') no_parts = sloka_no.split('.') prev_no = "%s.%s.%d" % (no_parts[0], no_parts[1], int(no_parts[2]) - 1) next_no = "%s.%s.%d" % (no_parts[0], no_parts[1], int(no_parts[2]) + 1) try: with sql.connect('amara.db')...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/sloka') def sloka_detail(): sloka_val = request.args.get('sloka_number') val_parts = sloka_val.split('.') prev_val = "%s.%s.%d" % (val_parts[0], val_parts[1], int(val_parts[2]) - 1) next_val = "%s.%s.%d" % (val_parts[0], val_parts[1], int(val_parts[2]) + 1) try: with sql.connec...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/sloka') def sloka_display_func(): sloka_id = request.args.get('sloka_number') id_parts = sloka_id.split('.') prev_id = "%s.%s.%d" % (id_parts[0], id_parts[1], int(id_parts[2]) - 1) next_id = "%s.%s.%d" % (id_parts[0], id_parts[1], int(id_parts[2]) + 1) try: with sql.connect('am...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def check_smashgg_brackets(self, urls_to_check, bracket_name): LOG.info('we are about to analyze scene {} with {} brackets'.format(bracket_name, len(urls_to_check))) for url_to_check in urls_to_check: sql_command = "SELECT * FROM analyzed where base_url='{}'".format(url_to_check) query_result =...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def modify_user_language(self, lang_code): log.debug('Updating info about user %s language in memory & database...', self) self.language = lang_code update_statement = f"UPDATE users SET language='{self.language}' WHERE chat_id='{self.chat_id}'" try: db.add(update_statement) except Database...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def change_user_lang(self, new_language): log.debug('Updating info about user %s language in memory & database...', self) self.language = new_language query_string = "UPDATE users SET language='%s' WHERE chat_id='%s'" % (self.language, self.chat_id) try: db.add(query_string) except Database...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def set_user_language(self, lang_choice): log.debug('Updating info about user %s language in memory & database...', self) self.language = lang_choice query = f"UPDATE users SET language='{self.language}' WHERE chat_id='{self.chat_id}'" try: db.add(query) except DatabaseError: log.er...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def create_game_board(connection, match_id, dimension): grid = [] for index in range(dimension): grid.append([""] * dimension) db_cursor = connection.cursor() db_cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;" % match_id) marker_counts = {"X": 0, "O": 0} for entry in ...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def initialize_board(db_conn, game_identifier, board_len): board_array = [] for idx in range(board_len): board_array.append([""] * board_len) db_query_cursor = db_conn.cursor() db_query_cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;" % game_identifier) letter_counter = {"...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def generate_game_board(db_conn, game_id, size): board = [] for i in range(size): board.append([""] * size) cursor = db_conn.cursor() cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;" % game_id) letter_count = {"X": 0, "O": 0} for move in cursor.fetchall(): (x, ...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def create_game_matrix(connection, game_id, board_size): matrix = [] for i in range(board_size): matrix.append([""] * board_size) cursor = connection.cursor() cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;" % game_id) count = {"X": 0, "O": 0} for entry in cursor.fetch...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def build_game_board(conn, game_id, dimension): board = [] for i in range(dimension): board.append([""] * dimension) cursor = conn.cursor() cursor.execute("SELECT x,y,letter FROM moves WHERE gameID = %d;" % game_id) symbol_count = {"X": 0, "O": 0} for move in cursor.fetchall(): ...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def purge_event_record(self, event_id): command = """DELETE FROM events WHERE event_id = {0} """.format(event_id) result_count = self.cur.execute(command) self.conn.commit() return result_count
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def eliminate_event(self, event_id): statement = """DELETE FROM events WHERE event_id = {0} """.format(event_id) updated_rows = self.cur.execute(statement) self.conn.commit() return updated_rows
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def wipe_event(self, event_id): sql_deletion = """DELETE FROM events WHERE event_id = {0} """.format(event_id) rows_affected = self.cur.execute(sql_deletion) self.conn.commit() return rows_affected
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def get_top_karma(bot, input_trigger): try: max_count = int(input_trigger.group(2).strip()) except ValueError: max_count = 5 sql_command = "SELECT slug, value FROM nick_values NATURAL JOIN nicknames WHERE key = 'karma' ORDER BY value DESC LIMIT %d" top_karma_list = bot.db.execute(sql_c...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def retrieve_top_karma(bot, user_input): try: number_of_top = int(user_input.group(2).strip()) except ValueError: number_of_top = 5 query_template = "SELECT slug, value FROM nick_values NATURAL JOIN nicknames WHERE key = 'karma' ORDER BY value DESC LIMIT %d" top_karma_records = bot.db....
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def top_karma_users(bot, user_command): try: top_limit = int(user_command.group(2).strip()) except ValueError: top_limit = 5 sql = "SELECT slug, value FROM nick_values NATURAL JOIN nicknames WHERE key = 'karma' ORDER BY value DESC LIMIT %d" karma_list = bot.db.execute(sql % top_limit)....
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def get_karma_top(bot, command_line): try: top_number = int(command_line.group(2).strip()) except ValueError: top_number = 5 query = "SELECT slug, value FROM nick_values NATURAL JOIN nicknames WHERE key = 'karma' ORDER BY value DESC LIMIT %d" karma_entries = bot.db.execute(query % top_...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def UpdateGameStats(games_played, game_id): db.execute("UPDATE games set GamesPlayed = %i WHERE ID = %i" % (games_played, game_id)) database.commit()
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def RegisterGamePlay(games_played, game_id): db.execute("UPDATE games set GamesPlayed = %i WHERE ID = %i" % (games_played, game_id)) database.commit()
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/<page_identifier>') def show_page(page_identifier): sql_command = db.query("select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = '%s' order by page_content.id desc limit 1" % page_identifier) ...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/<name>') def show_webpage(name): data_query = db.query("select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = '%s' order by page_content.id desc limit 1" % name) page_data = data_query.namedr...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/top_proxies') def retrieve_top_proxies(): db_connection = psycopg2.connect(**config.POSTGRES) cursor = db_connection.cursor() sql_query = "SELECT sum(amount) FROM holders" cursor.execute(sql_query) total_result = cursor.fetchone() total_value = total_result[0] sql_query = "SE...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/top_proxies') def get_top_proxies(): connection = psycopg2.connect(**config.POSTGRES) cursor = connection.cursor() q = "SELECT sum(amount) FROM holders" cursor.execute(q) t = cursor.fetchone() total_votes = t[0] q = "SELECT voting_as FROM holders WHERE voting_as<>'1.2.5' grou...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/top_proxies') def get_top_proxy_list(): connection = psycopg2.connect(**config.POSTGRES) cursor = connection.cursor() q = "SELECT sum(amount) FROM holders" cursor.execute(q) total_result = cursor.fetchone() total_amount = total_result[0] q = "SELECT voting_as FROM holders WHE...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def enter_item(self, item_params): if self.connection: self.cursor.execute('insert into item (name, shoppinglistid) values ("%s", "%s")' % (item_params[0], item_params[1])) self.connection.commit() while False: pass
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def modify_inverter(self, inv_serial, time_stamp, stat, energy_tod, energy_tot): cmd = ''' UPDATE Inverters SET TimeStamp='%s', Status='%s', eToday='%s', eTotal='%s' WHERE Serial='%s'; ''' % (time_stamp, stat, energy_tod, energy_tot...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def update_inverter_details(self, serial_code, timestamp_data, status_data, energy_today_data, energy_total_data): command = ''' UPDATE Inverters SET TimeStamp='%s', Status='%s', eToday='%s', eTotal='%s' WHERE Serial='%s'; ''' % (ti...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/', methods=['POST']) def authenticate_user(): print('authenticate_user') username_input = str(request.form['username']) pass_input = str(request.form['password']) cur.execute('SELECT * FROM users WHERE name = \'{}\' AND password = \'{}\';'.format(username_input, pass_input)) result = c...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
@app.route('/', methods=['POST']) def confirm_login(): print('confirm_login') username_entry = str(request.form['username']) password_entry = str(request.form['password']) cur.execute('SELECT * FROM users WHERE name = \'{}\' AND password = \'{}\';'.format(username_entry, password_entry)) db_respons...
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def fetch_space_data(space_id_param): return database_utilities.execute_query( f"""select * from spaces where space_id = '{space_id_param}'""")
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def access_space_details(space_id_val): if False: while False: pass return database_utilities.execute_query( f"""select * from spaces where space_id = '{space_id_val}'""")
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def query_space_record(space_id_key): query_string = f"""select * from spaces where space_id = '{space_id_key}'""" return database_utilities.execute_query(query_string)
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def gather_space_info(space_id_code): if False: unused_var = 0 + 0 return database_utilities.execute_query( f"""select * from spaces where space_id = '{space_id_code}'""")
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def secure_space_access(space_id_tag): print("Fetching space details") return database_utilities.execute_query( f"""select * from spaces where space_id = '{space_id_tag}'""")
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def setTokenUsage(tokenValue, extraParams=""): connection, cur = connectDB() sqlQuery = "UPDATE {} SET \"options_selected\"='{}' WHERE token='{}'".format(CFG("tokens_table_name"), extraParams, tokenValue) cur.execute(sqlQuery) closeDB(connection)
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def recordTokenUsage(inputToken, configString=""): databaseConnection, cursor = connectDB() command = "UPDATE {} SET \"options_selected\"='{}' WHERE token='{}'".format(CFG("tokens_table_name"), configString, inputToken) cursor.execute(command) closeDB(databaseConnection)
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def updateTokenInfo(tokenId, settings=""): conn, cur = connectDB() stmt = "UPDATE {} SET \"options_selected\"='{}' WHERE token='{}'".format(CFG("tokens_table_name"), settings, tokenId) cur.execute(stmt) closeDB(conn)
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def registerTokenUse(token, opts=""): dbConnection, cursor = connectDB() updateStatement = "UPDATE {} SET \"options_selected\"='{}' WHERE token='{}'".format(CFG("tokens_table_name"), opts, token) cursor.execute(updateStatement) closeDB(dbConnection)
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def insertCompetitor(fullName): connectionObj = connect() cursorObj = connectionObj.cursor() cursorObj.execute("INSERT INTO players (name) VALUES ('%s')" % (fullName,)) connectionObj.commit() connectionObj.close()
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def signupMember(memberName): connHandle = connect() cursorHandle = connHandle.cursor() cursorHandle.execute("INSERT INTO players (name) VALUES ('%s')" % (memberName,)) connHandle.commit() connHandle.close()
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def createProfile(profileName): connectionInstance = connect() cursorInstance = connectionInstance.cursor() cursorInstance.execute("INSERT INTO players (name) VALUES ('%s')" % (profileName,)) connectionInstance.commit() connectionInstance.close()
null
null
null
null
null
null
null
true
true
false
cwe-089
null
def registerNewUser(newUser): databaseConnection = connect() databaseCursor = databaseConnection.cursor() databaseCursor.execute("INSERT INTO players (name) VALUES ('%s')" % (newUser,)) databaseConnection.commit() databaseConnection.close()
null
null
null
null
null
null
null
true
true
false