prompt stringclasses 1 value | completions listlengths 2 1.33k | labels listlengths 2 1.33k | source stringclasses 1 value | other_info dict | index int64 0 719 | cwe stringclasses 9 values | language stringclasses 6 values |
|---|---|---|---|---|---|---|---|
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/quiz')\ndef quiz():",
" varga = request.args.get('varga')",
" try:\n rows =[]",
" with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()",
" 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)",
" rows = cur.fetchall();",
" artha = rows[0][\"artha\"];",
" cur.execute(\"select pada from pada where varga = '%s' and artha = '%s' order by id\" % (varga, artha));",
" paryaya = cur.fetchall();",
" return render_template('quiz.html', rows=rows, paryaya=paryaya, varga=varga)\n finally:\n con.close()"
] | [
1,
1,
1,
1,
0,
1,
1,
0,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 330,
"char_start": 329,
"chars": "?"
},
{
"char_end": 359,
"char_start": 358,
"chars": ","
},
{
"char_end": 361,
"char_start": 360,
"chars": "["
},
{
"char_end": 367,
"char_start": 366,
"chars": "]"
},
{
"char_end": 505,
"char_start": 504,
"chars": "?"
},
{
"char_end": 519,
"char_start": 518,
"chars": "?"
},
{
"char_end": 533,
"char_start": 532,
"chars": ","
},
{
"char_end": 535,
"char_start": 534,
"chars": "["
},
{
"char_end": 548,
"char_start": 547,
"chars": "]"
}
],
"deleted": [
{
"char_end": 333,
"char_start": 329,
"chars": "'%s'"
},
{
"char_end": 363,
"char_start": 361,
"chars": " %"
},
{
"char_end": 510,
"char_start": 506,
"chars": "'%s'"
},
{
"char_end": 527,
"char_start": 523,
"chars": "'%s'"
},
{
"char_end": 542,
"char_start": 540,
"chars": " %"
},
{
"char_end": 544,
"char_start": 543,
"chars": "("
},
{
"char_end": 557,
"char_start": 556,
"chars": ")"
}
]
},
"commit_link": "github.com/aupasana/amara-quiz/commit/6ceb5dc8ec38b4a3f1399e578ab970f7e3354922",
"file_name": "docker/app.py",
"func_name": "quiz",
"line_changes": {
"added": [
{
"char_end": 369,
"char_start": 213,
"line": " cur.execute(\"select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = ? order by random() limit 1;\", [varga])\n",
"line_no": 12
},
{
"char_end": 551,
"char_start": 443,
"line": " cur.execute(\"select pada from pada where varga = ? and artha = ? order by id\", [varga, artha]);\n",
"line_no": 16
}
],
"deleted": [
{
"char_end": 371,
"char_start": 213,
"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": 12
},
{
"char_end": 560,
"char_start": 445,
"line": " cur.execute(\"select pada from pada where varga = '%s' and artha = '%s' order by id\" % (varga, artha));\n",
"line_no": 16
}
]
},
"vul_type": "cwe-089"
} | 300 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/quiz')\ndef quiz():",
" varga = request.args.get('varga')",
" try:\n rows =[]",
" with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()",
" cur.execute(\"select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = ? order by random() limit 1;\", [varga])",
" rows = cur.fetchall();",
" artha = rows[0][\"artha\"];",
" cur.execute(\"select pada from pada where varga = ? and artha = ? order by id\", [varga, artha]);",
" paryaya = cur.fetchall();",
" return render_template('quiz.html', rows=rows, paryaya=paryaya, varga=varga)\n finally:\n con.close()"
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 330,
"char_start": 329,
"chars": "?"
},
{
"char_end": 359,
"char_start": 358,
"chars": ","
},
{
"char_end": 361,
"char_start": 360,
"chars": "["
},
{
"char_end": 367,
"char_start": 366,
"chars": "]"
},
{
"char_end": 505,
"char_start": 504,
"chars": "?"
},
{
"char_end": 519,
"char_start": 518,
"chars": "?"
},
{
"char_end": 533,
"char_start": 532,
"chars": ","
},
{
"char_end": 535,
"char_start": 534,
"chars": "["
},
{
"char_end": 548,
"char_start": 547,
"chars": "]"
}
],
"deleted": [
{
"char_end": 333,
"char_start": 329,
"chars": "'%s'"
},
{
"char_end": 363,
"char_start": 361,
"chars": " %"
},
{
"char_end": 510,
"char_start": 506,
"chars": "'%s'"
},
{
"char_end": 527,
"char_start": 523,
"chars": "'%s'"
},
{
"char_end": 542,
"char_start": 540,
"chars": " %"
},
{
"char_end": 544,
"char_start": 543,
"chars": "("
},
{
"char_end": 557,
"char_start": 556,
"chars": ")"
}
]
},
"commit_link": "github.com/aupasana/amara-quiz/commit/6ceb5dc8ec38b4a3f1399e578ab970f7e3354922",
"file_name": "docker/app.py",
"func_name": "quiz",
"line_changes": {
"added": [
{
"char_end": 369,
"char_start": 213,
"line": " cur.execute(\"select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = ? order by random() limit 1;\", [varga])\n",
"line_no": 12
},
{
"char_end": 551,
"char_start": 443,
"line": " cur.execute(\"select pada from pada where varga = ? and artha = ? order by id\", [varga, artha]);\n",
"line_no": 16
}
],
"deleted": [
{
"char_end": 371,
"char_start": 213,
"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": 12
},
{
"char_end": 560,
"char_start": 445,
"line": " cur.execute(\"select pada from pada where varga = '%s' and artha = '%s' order by id\" % (varga, artha));\n",
"line_no": 16
}
]
},
"vul_type": "cwe-089"
} | 300 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def _checkPairing():\n if winner == loser:\n raise ValueError('Attempt to match player against self')",
" q = '''\n SELECT COUNT(*) FROM matches\n WHERE (matches.winner_id = %s AND matches.loser_id = %s)\n OR (matches.winner_id = %s AND matches.loser_id = %s);",
" ''' % (winner, loser, loser, winner)\n cur.execute(q)",
" if cur.fetchone()[0] > 0:\n raise ValueError('Pairing %s, %s already played' % (winner, loser))"
] | [
1,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 327,
"char_start": 321,
"chars": "\n "
},
{
"char_end": 344,
"char_start": 328,
"chars": " cur.execute(q,"
}
],
"deleted": [
{
"char_end": 323,
"char_start": 322,
"chars": "%"
},
{
"char_end": 376,
"char_start": 354,
"chars": "\n cur.execute(q"
}
]
},
"commit_link": "github.com/juanchopanza/Tournament/commit/5799aee52d2cabb685800b88977257bd0964d0da",
"file_name": "vagrant/tournament/tournament.py",
"func_name": "reportMatch._checkPairing",
"line_changes": {
"added": [
{
"char_end": 322,
"char_start": 310,
"line": " '''\n",
"line_no": 9
},
{
"char_end": 377,
"char_start": 322,
"line": " cur.execute(q, (winner, loser, loser, winner))\n",
"line_no": 10
}
],
"deleted": [
{
"char_end": 355,
"char_start": 310,
"line": " ''' % (winner, loser, loser, winner)\n",
"line_no": 9
},
{
"char_end": 378,
"char_start": 355,
"line": " cur.execute(q)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-089"
} | 301 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def _checkPairing():\n if winner == loser:\n raise ValueError('Attempt to match player against self')",
" q = '''\n SELECT COUNT(*) FROM matches\n WHERE (matches.winner_id = %s AND matches.loser_id = %s)\n OR (matches.winner_id = %s AND matches.loser_id = %s);",
" '''\n cur.execute(q, (winner, loser, loser, winner))",
" if cur.fetchone()[0] > 0:\n raise ValueError('Pairing %s, %s already played' % (winner, loser))"
] | [
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 327,
"char_start": 321,
"chars": "\n "
},
{
"char_end": 344,
"char_start": 328,
"chars": " cur.execute(q,"
}
],
"deleted": [
{
"char_end": 323,
"char_start": 322,
"chars": "%"
},
{
"char_end": 376,
"char_start": 354,
"chars": "\n cur.execute(q"
}
]
},
"commit_link": "github.com/juanchopanza/Tournament/commit/5799aee52d2cabb685800b88977257bd0964d0da",
"file_name": "vagrant/tournament/tournament.py",
"func_name": "reportMatch._checkPairing",
"line_changes": {
"added": [
{
"char_end": 322,
"char_start": 310,
"line": " '''\n",
"line_no": 9
},
{
"char_end": 377,
"char_start": 322,
"line": " cur.execute(q, (winner, loser, loser, winner))\n",
"line_no": 10
}
],
"deleted": [
{
"char_end": 355,
"char_start": 310,
"line": " ''' % (winner, loser, loser, winner)\n",
"line_no": 9
},
{
"char_end": 378,
"char_start": 355,
"line": " cur.execute(q)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-089"
} | 301 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_month_data_row(self, inverter_serial, ts, etoday, etotal):",
" y = datetime.fromtimestamp(ts) - timedelta(days=1)\n y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())",
" query = '''\n INSERT INTO MonthData (\n TimeStamp,\n Serial,\n DayYield,\n TotalYield \n ) VALUES (",
" %s,\n %s,\n %s,\n %s",
" );",
" ''' % (y_ts, inverter_serial, etoday, etotal)\n self.c.execute(query)"
] | [
1,
1,
1,
0,
1,
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 451,
"char_start": 450,
"chars": "?"
},
{
"char_end": 470,
"char_start": 469,
"chars": "?"
},
{
"char_end": 489,
"char_start": 488,
"chars": "?"
},
{
"char_end": 508,
"char_start": 507,
"chars": "?"
},
{
"char_end": 541,
"char_start": 535,
"chars": "\n "
},
{
"char_end": 565,
"char_start": 542,
"chars": " self.c.execute(query,"
}
],
"deleted": [
{
"char_end": 452,
"char_start": 450,
"chars": "%s"
},
{
"char_end": 472,
"char_start": 470,
"chars": "%s"
},
{
"char_end": 492,
"char_start": 490,
"chars": "%s"
},
{
"char_end": 512,
"char_start": 510,
"chars": "%s"
},
{
"char_end": 541,
"char_start": 540,
"chars": "%"
},
{
"char_end": 610,
"char_start": 581,
"chars": "\n self.c.execute(query"
}
]
},
"commit_link": "github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65",
"file_name": "util/database.py",
"func_name": "add_month_data_row",
"line_changes": {
"added": [
{
"char_end": 453,
"char_start": 434,
"line": " ?,\n",
"line_no": 13
},
{
"char_end": 472,
"char_start": 453,
"line": " ?,\n",
"line_no": 14
},
{
"char_end": 491,
"char_start": 472,
"line": " ?,\n",
"line_no": 15
},
{
"char_end": 509,
"char_start": 491,
"line": " ?\n",
"line_no": 16
},
{
"char_end": 536,
"char_start": 524,
"line": " '''\n",
"line_no": 18
},
{
"char_end": 606,
"char_start": 536,
"line": " self.c.execute(query, (y_ts, inverter_serial, etoday, etotal))\n",
"line_no": 19
}
],
"deleted": [
{
"char_end": 454,
"char_start": 434,
"line": " %s,\n",
"line_no": 13
},
{
"char_end": 474,
"char_start": 454,
"line": " %s,\n",
"line_no": 14
},
{
"char_end": 494,
"char_start": 474,
"line": " %s,\n",
"line_no": 15
},
{
"char_end": 513,
"char_start": 494,
"line": " %s\n",
"line_no": 16
},
{
"char_end": 582,
"char_start": 528,
"line": " ''' % (y_ts, inverter_serial, etoday, etotal)\n",
"line_no": 18
},
{
"char_end": 611,
"char_start": 582,
"line": " self.c.execute(query)\n",
"line_no": 19
}
]
},
"vul_type": "cwe-089"
} | 302 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_month_data_row(self, inverter_serial, ts, etoday, etotal):",
" y = datetime.fromtimestamp(ts) - timedelta(days=1)\n y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())",
" query = '''\n INSERT INTO MonthData (\n TimeStamp,\n Serial,\n DayYield,\n TotalYield \n ) VALUES (",
" ?,\n ?,\n ?,\n ?",
" );",
" '''\n self.c.execute(query, (y_ts, inverter_serial, etoday, etotal))"
] | [
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 451,
"char_start": 450,
"chars": "?"
},
{
"char_end": 470,
"char_start": 469,
"chars": "?"
},
{
"char_end": 489,
"char_start": 488,
"chars": "?"
},
{
"char_end": 508,
"char_start": 507,
"chars": "?"
},
{
"char_end": 541,
"char_start": 535,
"chars": "\n "
},
{
"char_end": 565,
"char_start": 542,
"chars": " self.c.execute(query,"
}
],
"deleted": [
{
"char_end": 452,
"char_start": 450,
"chars": "%s"
},
{
"char_end": 472,
"char_start": 470,
"chars": "%s"
},
{
"char_end": 492,
"char_start": 490,
"chars": "%s"
},
{
"char_end": 512,
"char_start": 510,
"chars": "%s"
},
{
"char_end": 541,
"char_start": 540,
"chars": "%"
},
{
"char_end": 610,
"char_start": 581,
"chars": "\n self.c.execute(query"
}
]
},
"commit_link": "github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65",
"file_name": "util/database.py",
"func_name": "add_month_data_row",
"line_changes": {
"added": [
{
"char_end": 453,
"char_start": 434,
"line": " ?,\n",
"line_no": 13
},
{
"char_end": 472,
"char_start": 453,
"line": " ?,\n",
"line_no": 14
},
{
"char_end": 491,
"char_start": 472,
"line": " ?,\n",
"line_no": 15
},
{
"char_end": 509,
"char_start": 491,
"line": " ?\n",
"line_no": 16
},
{
"char_end": 536,
"char_start": 524,
"line": " '''\n",
"line_no": 18
},
{
"char_end": 606,
"char_start": 536,
"line": " self.c.execute(query, (y_ts, inverter_serial, etoday, etotal))\n",
"line_no": 19
}
],
"deleted": [
{
"char_end": 454,
"char_start": 434,
"line": " %s,\n",
"line_no": 13
},
{
"char_end": 474,
"char_start": 454,
"line": " %s,\n",
"line_no": 14
},
{
"char_end": 494,
"char_start": 474,
"line": " %s,\n",
"line_no": 15
},
{
"char_end": 513,
"char_start": 494,
"line": " %s\n",
"line_no": 16
},
{
"char_end": 582,
"char_start": 528,
"line": " ''' % (y_ts, inverter_serial, etoday, etotal)\n",
"line_no": 18
},
{
"char_end": 611,
"char_start": 582,
"line": " self.c.execute(query)\n",
"line_no": 19
}
]
},
"vul_type": "cwe-089"
} | 302 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def create_playlist(name, db):\n db.execute(",
" \"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);\".format(name=name))"
] | [
1,
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 109,
"char_start": 107,
"chars": "%s"
},
{
"char_end": 117,
"char_start": 115,
"chars": ", "
},
{
"char_end": 123,
"char_start": 122,
"chars": ","
}
],
"deleted": [
{
"char_end": 115,
"char_start": 107,
"chars": "'{name}'"
},
{
"char_end": 128,
"char_start": 121,
"chars": ".format"
},
{
"char_end": 138,
"char_start": 133,
"chars": "=name"
}
]
},
"commit_link": "github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6",
"file_name": "playlist/playlist_repository.py",
"func_name": "create_playlist",
"line_changes": {
"added": [
{
"char_end": 125,
"char_start": 47,
"line": " \"INSERT INTO playlist (name, video_position) VALUES(%s, 0);\", (name,))",
"line_no": 3
}
],
"deleted": [
{
"char_end": 140,
"char_start": 47,
"line": " \"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);\".format(name=name))\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 303 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def create_playlist(name, db):\n db.execute(",
" \"INSERT INTO playlist (name, video_position) VALUES(%s, 0);\", (name,))"
] | [
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 109,
"char_start": 107,
"chars": "%s"
},
{
"char_end": 117,
"char_start": 115,
"chars": ", "
},
{
"char_end": 123,
"char_start": 122,
"chars": ","
}
],
"deleted": [
{
"char_end": 115,
"char_start": 107,
"chars": "'{name}'"
},
{
"char_end": 128,
"char_start": 121,
"chars": ".format"
},
{
"char_end": 138,
"char_start": 133,
"chars": "=name"
}
]
},
"commit_link": "github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6",
"file_name": "playlist/playlist_repository.py",
"func_name": "create_playlist",
"line_changes": {
"added": [
{
"char_end": 125,
"char_start": 47,
"line": " \"INSERT INTO playlist (name, video_position) VALUES(%s, 0);\", (name,))",
"line_no": 3
}
],
"deleted": [
{
"char_end": 140,
"char_start": 47,
"line": " \"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);\".format(name=name))\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 303 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def karma_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:",
" cursor.execute(\n ''' SELECT karma FROM people WHERE name='{}' '''.format(name))",
" karma = cursor.fetchone()\n if karma is None:\n logger.debug('No karma found for name {}'.format(name))\n db.close()\n return karma\n else:\n karma = karma[0]\n logger.debug('karma of {} found for name {}'.format(karma, name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 148,
"char_start": 140,
"chars": "%(name)s"
},
{
"char_end": 177,
"char_start": 152,
"chars": ",\n "
},
{
"char_end": 184,
"char_start": 182,
"chars": ", "
}
],
"deleted": [
{
"char_end": 113,
"char_start": 100,
"chars": "\n "
},
{
"char_end": 157,
"char_start": 153,
"chars": "'{}'"
},
{
"char_end": 168,
"char_start": 161,
"chars": ".format"
}
]
},
"commit_link": "github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a",
"file_name": "KarmaBoi/dbopts.py",
"func_name": "karma_ask",
"line_changes": {
"added": [
{
"char_end": 154,
"char_start": 77,
"line": " cursor.execute(''' SELECT karma FROM people WHERE name=%(name)s ''',\n",
"line_no": 5
},
{
"char_end": 187,
"char_start": 154,
"line": " (name, ))\n",
"line_no": 6
}
],
"deleted": [
{
"char_end": 101,
"char_start": 77,
"line": " cursor.execute(\n",
"line_no": 5
},
{
"char_end": 176,
"char_start": 101,
"line": " ''' SELECT karma FROM people WHERE name='{}' '''.format(name))\n",
"line_no": 6
}
]
},
"vul_type": "cwe-089"
} | 304 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def karma_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:",
" cursor.execute(''' SELECT karma FROM people WHERE name=%(name)s ''',\n (name, ))",
" karma = cursor.fetchone()\n if karma is None:\n logger.debug('No karma found for name {}'.format(name))\n db.close()\n return karma\n else:\n karma = karma[0]\n logger.debug('karma of {} found for name {}'.format(karma, name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 148,
"char_start": 140,
"chars": "%(name)s"
},
{
"char_end": 177,
"char_start": 152,
"chars": ",\n "
},
{
"char_end": 184,
"char_start": 182,
"chars": ", "
}
],
"deleted": [
{
"char_end": 113,
"char_start": 100,
"chars": "\n "
},
{
"char_end": 157,
"char_start": 153,
"chars": "'{}'"
},
{
"char_end": 168,
"char_start": 161,
"chars": ".format"
}
]
},
"commit_link": "github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a",
"file_name": "KarmaBoi/dbopts.py",
"func_name": "karma_ask",
"line_changes": {
"added": [
{
"char_end": 154,
"char_start": 77,
"line": " cursor.execute(''' SELECT karma FROM people WHERE name=%(name)s ''',\n",
"line_no": 5
},
{
"char_end": 187,
"char_start": 154,
"line": " (name, ))\n",
"line_no": 6
}
],
"deleted": [
{
"char_end": 101,
"char_start": 77,
"line": " cursor.execute(\n",
"line_no": 5
},
{
"char_end": 176,
"char_start": 101,
"line": " ''' SELECT karma FROM people WHERE name='{}' '''.format(name))\n",
"line_no": 6
}
]
},
"vul_type": "cwe-089"
} | 304 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def post(self):\n \"\"\" Returns JWT upon login verification \"\"\"\n json_data = request.get_json()\n if not json_data['email']:\n return jsonify({\"msg\": \"Missing email\"}), 400",
" data = database_utilities.execute_query(",
" f\"\"\"select * from admins where email = '{json_data['email']}'\"\"\")",
" if data:\n email = data[0]['email']\n access_token = create_access_token(identity=email)\n refresh_token = create_refresh_token(identity=email)",
" resp = jsonify({\"login\": True})\n set_access_cookies(resp, access_token)\n set_refresh_cookies(resp, refresh_token)\n return resp\n else:\n return jsonify({\"msg\": \"User is not an admin\"})"
] | [
1,
1,
0,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 313,
"char_start": 305,
"chars": "%s\"\"\", ("
},
{
"char_end": 334,
"char_start": 331,
"chars": ", )"
}
],
"deleted": [
{
"char_end": 307,
"char_start": 305,
"chars": "'{"
},
{
"char_end": 330,
"char_start": 325,
"chars": "}'\"\"\""
}
]
},
"commit_link": "github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485",
"file_name": "apis/login.py",
"func_name": "post",
"line_changes": {
"added": [
{
"char_end": 336,
"char_start": 254,
"line": " f\"\"\"select * from admins where email = %s\"\"\", (json_data['email'], ))\n",
"line_no": 8
}
],
"deleted": [
{
"char_end": 332,
"char_start": 254,
"line": " f\"\"\"select * from admins where email = '{json_data['email']}'\"\"\")\n",
"line_no": 8
}
]
},
"vul_type": "cwe-089"
} | 305 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def post(self):\n \"\"\" Returns JWT upon login verification \"\"\"\n json_data = request.get_json()\n if not json_data['email']:\n return jsonify({\"msg\": \"Missing email\"}), 400",
" data = database_utilities.execute_query(",
" f\"\"\"select * from admins where email = %s\"\"\", (json_data['email'], ))",
" if data:\n email = data[0]['email']\n access_token = create_access_token(identity=email)\n refresh_token = create_refresh_token(identity=email)",
" resp = jsonify({\"login\": True})\n set_access_cookies(resp, access_token)\n set_refresh_cookies(resp, refresh_token)\n return resp\n else:\n return jsonify({\"msg\": \"User is not an admin\"})"
] | [
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 313,
"char_start": 305,
"chars": "%s\"\"\", ("
},
{
"char_end": 334,
"char_start": 331,
"chars": ", )"
}
],
"deleted": [
{
"char_end": 307,
"char_start": 305,
"chars": "'{"
},
{
"char_end": 330,
"char_start": 325,
"chars": "}'\"\"\""
}
]
},
"commit_link": "github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485",
"file_name": "apis/login.py",
"func_name": "post",
"line_changes": {
"added": [
{
"char_end": 336,
"char_start": 254,
"line": " f\"\"\"select * from admins where email = %s\"\"\", (json_data['email'], ))\n",
"line_no": 8
}
],
"deleted": [
{
"char_end": 332,
"char_start": 254,
"line": " f\"\"\"select * from admins where email = '{json_data['email']}'\"\"\")\n",
"line_no": 8
}
]
},
"vul_type": "cwe-089"
} | 305 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_day_data_row(self, ts, data, prev_etotal):",
" if data['power'] > 0:",
" inv_serial = data['source']['serial_id']\n query = '''\n INSERT INTO DayData (\n TimeStamp,\n Serial,\n Power,\n TotalYield\n ) VALUES (",
" %s,\n %s,\n %s,\n %s",
" );",
" ''' % (ts, inv_serial, data['power'], prev_etotal + data['energy'])\n self.c.execute(query)"
] | [
1,
1,
1,
0,
1,
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 360,
"char_start": 359,
"chars": "?"
},
{
"char_end": 382,
"char_start": 381,
"chars": "?"
},
{
"char_end": 404,
"char_start": 403,
"chars": "?"
},
{
"char_end": 426,
"char_start": 425,
"chars": "?"
},
{
"char_end": 468,
"char_start": 460,
"chars": "\n "
},
{
"char_end": 494,
"char_start": 469,
"chars": " self.c.execute(query,"
}
],
"deleted": [
{
"char_end": 361,
"char_start": 359,
"chars": "%s"
},
{
"char_end": 384,
"char_start": 382,
"chars": "%s"
},
{
"char_end": 407,
"char_start": 405,
"chars": "%s"
},
{
"char_end": 430,
"char_start": 428,
"chars": "%s"
},
{
"char_end": 466,
"char_start": 465,
"chars": "%"
},
{
"char_end": 562,
"char_start": 529,
"chars": "\n self.c.execute(query"
}
]
},
"commit_link": "github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65",
"file_name": "util/database.py",
"func_name": "add_day_data_row",
"line_changes": {
"added": [
{
"char_end": 362,
"char_start": 340,
"line": " ?,\n",
"line_no": 13
},
{
"char_end": 384,
"char_start": 362,
"line": " ?,\n",
"line_no": 14
},
{
"char_end": 406,
"char_start": 384,
"line": " ?,\n",
"line_no": 15
},
{
"char_end": 427,
"char_start": 406,
"line": " ?\n",
"line_no": 16
},
{
"char_end": 461,
"char_start": 445,
"line": " '''\n",
"line_no": 18
},
{
"char_end": 558,
"char_start": 461,
"line": " self.c.execute(query, (ts, inv_serial, data['power'], prev_etotal + data['energy']))\n",
"line_no": 19
}
],
"deleted": [
{
"char_end": 363,
"char_start": 340,
"line": " %s,\n",
"line_no": 13
},
{
"char_end": 386,
"char_start": 363,
"line": " %s,\n",
"line_no": 14
},
{
"char_end": 409,
"char_start": 386,
"line": " %s,\n",
"line_no": 15
},
{
"char_end": 431,
"char_start": 409,
"line": " %s\n",
"line_no": 16
},
{
"char_end": 530,
"char_start": 449,
"line": " ''' % (ts, inv_serial, data['power'], prev_etotal + data['energy'])\n",
"line_no": 18
},
{
"char_end": 563,
"char_start": 530,
"line": " self.c.execute(query)\n",
"line_no": 19
}
]
},
"vul_type": "cwe-089"
} | 306 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_day_data_row(self, ts, data, prev_etotal):",
" if data['power'] > 0:",
" inv_serial = data['source']['serial_id']\n query = '''\n INSERT INTO DayData (\n TimeStamp,\n Serial,\n Power,\n TotalYield\n ) VALUES (",
" ?,\n ?,\n ?,\n ?",
" );",
" '''\n self.c.execute(query, (ts, inv_serial, data['power'], prev_etotal + data['energy']))"
] | [
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 360,
"char_start": 359,
"chars": "?"
},
{
"char_end": 382,
"char_start": 381,
"chars": "?"
},
{
"char_end": 404,
"char_start": 403,
"chars": "?"
},
{
"char_end": 426,
"char_start": 425,
"chars": "?"
},
{
"char_end": 468,
"char_start": 460,
"chars": "\n "
},
{
"char_end": 494,
"char_start": 469,
"chars": " self.c.execute(query,"
}
],
"deleted": [
{
"char_end": 361,
"char_start": 359,
"chars": "%s"
},
{
"char_end": 384,
"char_start": 382,
"chars": "%s"
},
{
"char_end": 407,
"char_start": 405,
"chars": "%s"
},
{
"char_end": 430,
"char_start": 428,
"chars": "%s"
},
{
"char_end": 466,
"char_start": 465,
"chars": "%"
},
{
"char_end": 562,
"char_start": 529,
"chars": "\n self.c.execute(query"
}
]
},
"commit_link": "github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65",
"file_name": "util/database.py",
"func_name": "add_day_data_row",
"line_changes": {
"added": [
{
"char_end": 362,
"char_start": 340,
"line": " ?,\n",
"line_no": 13
},
{
"char_end": 384,
"char_start": 362,
"line": " ?,\n",
"line_no": 14
},
{
"char_end": 406,
"char_start": 384,
"line": " ?,\n",
"line_no": 15
},
{
"char_end": 427,
"char_start": 406,
"line": " ?\n",
"line_no": 16
},
{
"char_end": 461,
"char_start": 445,
"line": " '''\n",
"line_no": 18
},
{
"char_end": 558,
"char_start": 461,
"line": " self.c.execute(query, (ts, inv_serial, data['power'], prev_etotal + data['energy']))\n",
"line_no": 19
}
],
"deleted": [
{
"char_end": 363,
"char_start": 340,
"line": " %s,\n",
"line_no": 13
},
{
"char_end": 386,
"char_start": 363,
"line": " %s,\n",
"line_no": 14
},
{
"char_end": 409,
"char_start": 386,
"line": " %s,\n",
"line_no": 15
},
{
"char_end": 431,
"char_start": 409,
"line": " %s\n",
"line_no": 16
},
{
"char_end": 530,
"char_start": 449,
"line": " ''' % (ts, inv_serial, data['power'], prev_etotal + data['energy'])\n",
"line_no": 18
},
{
"char_end": 563,
"char_start": 530,
"line": " self.c.execute(query)\n",
"line_no": 19
}
]
},
"vul_type": "cwe-089"
} | 306 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def store_metadata(self, session, key, mType, value):\n if (self.idNormalizer is not None):\n id = self.idNormalizer.process_string(session, id)\n elif type(id) == unicode:\n id = id.encode('utf-8')\n else:\n id = str(id)\n self._openContainer(session)",
" query = (\"UPDATE %s SET %s = %r WHERE identifier = '%s';\" %\n (self.table, mType, value, id)",
" )",
"",
" try:",
" self._query(query)",
" except:\n return None\n return value"
] | [
1,
0,
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 350,
"char_start": 348,
"chars": "$1"
},
{
"char_end": 372,
"char_start": 370,
"chars": "$2"
},
{
"char_end": 468,
"char_start": 441,
"chars": "args = (value, id)\n "
},
{
"char_end": 509,
"char_start": 502,
"chars": ", *args"
}
],
"deleted": [
{
"char_end": 350,
"char_start": 348,
"chars": "%r"
},
{
"char_end": 374,
"char_start": 370,
"chars": "'%s'"
},
{
"char_end": 415,
"char_start": 414,
"chars": ","
},
{
"char_end": 422,
"char_start": 416,
"chars": "value,"
},
{
"char_end": 425,
"char_start": 423,
"chars": "id"
},
{
"char_end": 441,
"char_start": 435,
"chars": " "
}
]
},
"commit_link": "github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e",
"file_name": "cheshire3/sql/postgresStore.py",
"func_name": "store_metadata",
"line_changes": {
"added": [
{
"char_end": 377,
"char_start": 311,
"line": " query = (\"UPDATE %s SET %s = $1 WHERE identifier = $2;\" %\n",
"line_no": 9
},
{
"char_end": 414,
"char_start": 377,
"line": " (self.table, mType)\n",
"line_no": 10
},
{
"char_end": 460,
"char_start": 433,
"line": " args = (value, id)\n",
"line_no": 12
},
{
"char_end": 511,
"char_start": 473,
"line": " self._query(query, *args)\n",
"line_no": 14
}
],
"deleted": [
{
"char_end": 379,
"char_start": 311,
"line": " query = (\"UPDATE %s SET %s = %r WHERE identifier = '%s';\" %\n",
"line_no": 9
},
{
"char_end": 427,
"char_start": 379,
"line": " (self.table, mType, value, id)\n",
"line_no": 10
},
{
"char_end": 490,
"char_start": 459,
"line": " self._query(query)\n",
"line_no": 13
}
]
},
"vul_type": "cwe-089"
} | 307 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def store_metadata(self, session, key, mType, value):\n if (self.idNormalizer is not None):\n id = self.idNormalizer.process_string(session, id)\n elif type(id) == unicode:\n id = id.encode('utf-8')\n else:\n id = str(id)\n self._openContainer(session)",
" query = (\"UPDATE %s SET %s = $1 WHERE identifier = $2;\" %\n (self.table, mType)",
" )",
" args = (value, id)",
" try:",
" self._query(query, *args)",
" except:\n return None\n return value"
] | [
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 350,
"char_start": 348,
"chars": "$1"
},
{
"char_end": 372,
"char_start": 370,
"chars": "$2"
},
{
"char_end": 468,
"char_start": 441,
"chars": "args = (value, id)\n "
},
{
"char_end": 509,
"char_start": 502,
"chars": ", *args"
}
],
"deleted": [
{
"char_end": 350,
"char_start": 348,
"chars": "%r"
},
{
"char_end": 374,
"char_start": 370,
"chars": "'%s'"
},
{
"char_end": 415,
"char_start": 414,
"chars": ","
},
{
"char_end": 422,
"char_start": 416,
"chars": "value,"
},
{
"char_end": 425,
"char_start": 423,
"chars": "id"
},
{
"char_end": 441,
"char_start": 435,
"chars": " "
}
]
},
"commit_link": "github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e",
"file_name": "cheshire3/sql/postgresStore.py",
"func_name": "store_metadata",
"line_changes": {
"added": [
{
"char_end": 377,
"char_start": 311,
"line": " query = (\"UPDATE %s SET %s = $1 WHERE identifier = $2;\" %\n",
"line_no": 9
},
{
"char_end": 414,
"char_start": 377,
"line": " (self.table, mType)\n",
"line_no": 10
},
{
"char_end": 460,
"char_start": 433,
"line": " args = (value, id)\n",
"line_no": 12
},
{
"char_end": 511,
"char_start": 473,
"line": " self._query(query, *args)\n",
"line_no": 14
}
],
"deleted": [
{
"char_end": 379,
"char_start": 311,
"line": " query = (\"UPDATE %s SET %s = %r WHERE identifier = '%s';\" %\n",
"line_no": 9
},
{
"char_end": 427,
"char_start": 379,
"line": " (self.table, mType, value, id)\n",
"line_no": 10
},
{
"char_end": 490,
"char_start": 459,
"line": " self._query(query)\n",
"line_no": 13
}
]
},
"vul_type": "cwe-089"
} | 307 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get(self, space_id):\n \"\"\" Fetch data for space with the corresponding space_id \"\"\"\n return database_utilities.execute_query(",
" f\"\"\"select * from spaces where space_id = '{space_id}'\"\"\")"
] | [
1,
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 209,
"char_start": 201,
"chars": "%s\"\"\", ("
},
{
"char_end": 220,
"char_start": 217,
"chars": ", )"
}
],
"deleted": [
{
"char_end": 203,
"char_start": 201,
"chars": "'{"
},
{
"char_end": 216,
"char_start": 211,
"chars": "}'\"\"\""
}
]
},
"commit_link": "github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485",
"file_name": "apis/spaces.py",
"func_name": "get",
"line_changes": {
"added": [
{
"char_end": 221,
"char_start": 147,
"line": " f\"\"\"select * from spaces where space_id = %s\"\"\", (space_id, ))\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 217,
"char_start": 147,
"line": " f\"\"\"select * from spaces where space_id = '{space_id}'\"\"\")\n",
"line_no": 4
}
]
},
"vul_type": "cwe-089"
} | 308 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get(self, space_id):\n \"\"\" Fetch data for space with the corresponding space_id \"\"\"\n return database_utilities.execute_query(",
" f\"\"\"select * from spaces where space_id = %s\"\"\", (space_id, ))"
] | [
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 209,
"char_start": 201,
"chars": "%s\"\"\", ("
},
{
"char_end": 220,
"char_start": 217,
"chars": ", )"
}
],
"deleted": [
{
"char_end": 203,
"char_start": 201,
"chars": "'{"
},
{
"char_end": 216,
"char_start": 211,
"chars": "}'\"\"\""
}
]
},
"commit_link": "github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485",
"file_name": "apis/spaces.py",
"func_name": "get",
"line_changes": {
"added": [
{
"char_end": 221,
"char_start": 147,
"line": " f\"\"\"select * from spaces where space_id = %s\"\"\", (space_id, ))\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 217,
"char_start": 147,
"line": " f\"\"\"select * from spaces where space_id = '{space_id}'\"\"\")\n",
"line_no": 4
}
]
},
"vul_type": "cwe-089"
} | 308 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def check(current_num):\n try:",
" cursor.execute('SELECT * FROM comics WHERE num=\"%s\"' % current_num)",
" except sqlite3.OperationalError:\n cursor.execute('CREATE TABLE comics (num text)')\n return False\n else:\n return False if cursor.fetchone() is None else True"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 89,
"char_start": 88,
"chars": "?"
},
{
"char_end": 91,
"char_start": 90,
"chars": ","
},
{
"char_end": 93,
"char_start": 92,
"chars": "("
},
{
"char_end": 106,
"char_start": 104,
"chars": ",)"
}
],
"deleted": [
{
"char_end": 92,
"char_start": 88,
"chars": "\"%s\""
},
{
"char_end": 95,
"char_start": 93,
"chars": " %"
}
]
},
"commit_link": "github.com/lord63/a_bunch_of_code/commit/c0d67a1312306fd1257c354bfb5d6cac7643aa29",
"file_name": "comics/check_comics.py",
"func_name": "check",
"line_changes": {
"added": [
{
"char_end": 108,
"char_start": 33,
"line": " cursor.execute('SELECT * FROM comics WHERE num=?', (current_num,))\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 109,
"char_start": 33,
"line": " cursor.execute('SELECT * FROM comics WHERE num=\"%s\"' % current_num)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 309 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def check(current_num):\n try:",
" cursor.execute('SELECT * FROM comics WHERE num=?', (current_num,))",
" except sqlite3.OperationalError:\n cursor.execute('CREATE TABLE comics (num text)')\n return False\n else:\n return False if cursor.fetchone() is None else True"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 89,
"char_start": 88,
"chars": "?"
},
{
"char_end": 91,
"char_start": 90,
"chars": ","
},
{
"char_end": 93,
"char_start": 92,
"chars": "("
},
{
"char_end": 106,
"char_start": 104,
"chars": ",)"
}
],
"deleted": [
{
"char_end": 92,
"char_start": 88,
"chars": "\"%s\""
},
{
"char_end": 95,
"char_start": 93,
"chars": " %"
}
]
},
"commit_link": "github.com/lord63/a_bunch_of_code/commit/c0d67a1312306fd1257c354bfb5d6cac7643aa29",
"file_name": "comics/check_comics.py",
"func_name": "check",
"line_changes": {
"added": [
{
"char_end": 108,
"char_start": 33,
"line": " cursor.execute('SELECT * FROM comics WHERE num=?', (current_num,))\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 109,
"char_start": 33,
"line": " cursor.execute('SELECT * FROM comics WHERE num=\"%s\"' % current_num)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 309 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/delete_crawl', methods=['POST'])\n@is_logged_in\ndef delete_crawl():",
" # Get Form Fields\n cid = request.form['cid']",
" # Create cursor\n cur = mysql.connection.cursor()",
" # Get user by username",
" result = cur.execute(\"DELETE FROM Crawls WHERE cid = %s\" % cid)",
"\n # Commit to DB\n mysql.connection.commit()",
" # Close connection\n cur.close()",
" # FIXME check if successfull first, return message\n flash('Crawl successfully removed', 'success')",
" return redirect(url_for('dashboard'))"
] | [
1,
1,
1,
1,
0,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 270,
"char_start": 268,
"chars": "\"\""
},
{
"char_end": 306,
"char_start": 304,
"chars": "\"\""
},
{
"char_end": 308,
"char_start": 307,
"chars": "("
},
{
"char_end": 313,
"char_start": 311,
"chars": ",)"
}
],
"deleted": [
{
"char_end": 305,
"char_start": 303,
"chars": "% "
}
]
},
"commit_link": "github.com/yannvon/table-detection/commit/4bad3673debf0b9491b520f0e22e9186af78c375",
"file_name": "bar.py",
"func_name": "delete_crawl",
"line_changes": {
"added": [
{
"char_end": 315,
"char_start": 238,
"line": " result = cur.execute(\"\"\"DELETE FROM Crawls WHERE cid = %s\"\"\" (cid,))\n",
"line_no": 12
}
],
"deleted": [
{
"char_end": 310,
"char_start": 238,
"line": " result = cur.execute(\"DELETE FROM Crawls WHERE cid = %s\" % cid)\n",
"line_no": 12
}
]
},
"vul_type": "cwe-089"
} | 310 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/delete_crawl', methods=['POST'])\n@is_logged_in\ndef delete_crawl():",
" # Get Form Fields\n cid = request.form['cid']",
" # Create cursor\n cur = mysql.connection.cursor()",
" # Get user by username",
" result = cur.execute(\"\"\"DELETE FROM Crawls WHERE cid = %s\"\"\" (cid,))",
"\n # Commit to DB\n mysql.connection.commit()",
" # Close connection\n cur.close()",
" # FIXME check if successfull first, return message\n flash('Crawl successfully removed', 'success')",
" return redirect(url_for('dashboard'))"
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 270,
"char_start": 268,
"chars": "\"\""
},
{
"char_end": 306,
"char_start": 304,
"chars": "\"\""
},
{
"char_end": 308,
"char_start": 307,
"chars": "("
},
{
"char_end": 313,
"char_start": 311,
"chars": ",)"
}
],
"deleted": [
{
"char_end": 305,
"char_start": 303,
"chars": "% "
}
]
},
"commit_link": "github.com/yannvon/table-detection/commit/4bad3673debf0b9491b520f0e22e9186af78c375",
"file_name": "bar.py",
"func_name": "delete_crawl",
"line_changes": {
"added": [
{
"char_end": 315,
"char_start": 238,
"line": " result = cur.execute(\"\"\"DELETE FROM Crawls WHERE cid = %s\"\"\" (cid,))\n",
"line_no": 12
}
],
"deleted": [
{
"char_end": 310,
"char_start": 238,
"line": " result = cur.execute(\"DELETE FROM Crawls WHERE cid = %s\" % cid)\n",
"line_no": 12
}
]
},
"vul_type": "cwe-089"
} | 310 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/movies/add', methods=['GET', 'POST'])\ndef add_movie():\n form = MovieForm()\n if not form.validate_on_submit():\n return render_template('new_movie.html', title='Add New Movie', form=form)\n lang_id = add_language(form.data['language'])\n movie = {\n 'title': '',\n 'description': '',\n 'release_year': 0,\n 'rental_duration': 0,\n 'rental_rate': 0.00,\n 'length': 0,\n 'replacement_cost': 0.00\n }\n for k, v in movie.items():\n movie[k] = form.data[k]\n movie['language_id'] = movie.get('language_id', lang_id)\n cur.execute(\n \"\"\"\n INSERT INTO film (title, description, release_year, language_id, rental_duration, rental_rate, length, replacement_cost)",
" VALUES ('{}', '{}', {}, {}, {}, {}, {}, {})\n \"\"\".format(*[v for k, v in movie.items()])",
" )\n try:",
" cur.execute(f\"SELECT * FROM film where fulltext @@ to_tsquery('Dark Knight')\")",
" res = cur.fetchall()\n conn.commit()\n return redirect(url_for('movies'))\n except Exception as e:\n return redirect(url_for('index'))"
] | [
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 802,
"char_start": 800,
"chars": "%s"
},
{
"char_end": 806,
"char_start": 804,
"chars": "%s"
},
{
"char_end": 810,
"char_start": 808,
"chars": "%s"
},
{
"char_end": 814,
"char_start": 812,
"chars": "%s"
},
{
"char_end": 818,
"char_start": 816,
"chars": "%s"
},
{
"char_end": 822,
"char_start": 820,
"chars": "%s"
},
{
"char_end": 826,
"char_start": 824,
"chars": "%s"
},
{
"char_end": 830,
"char_start": 828,
"chars": "%s"
},
{
"char_end": 846,
"char_start": 843,
"chars": ", ["
},
{
"char_end": 851,
"char_start": 848,
"chars": ", )"
},
{
"char_end": 968,
"char_start": 963,
"chars": "%s)\","
},
{
"char_end": 978,
"char_start": 969,
"chars": "(movie['t"
},
{
"char_end": 982,
"char_start": 980,
"chars": "le"
},
{
"char_end": 986,
"char_start": 983,
"chars": "], "
}
],
"deleted": [
{
"char_end": 804,
"char_start": 800,
"chars": "'{}'"
},
{
"char_end": 810,
"char_start": 806,
"chars": "'{}'"
},
{
"char_end": 814,
"char_start": 812,
"chars": "{}"
},
{
"char_end": 818,
"char_start": 816,
"chars": "{}"
},
{
"char_end": 822,
"char_start": 820,
"chars": "{}"
},
{
"char_end": 826,
"char_start": 824,
"chars": "{}"
},
{
"char_end": 830,
"char_start": 828,
"chars": "{}"
},
{
"char_end": 834,
"char_start": 832,
"chars": "{}"
},
{
"char_end": 856,
"char_start": 847,
"chars": ".format(*"
},
{
"char_end": 886,
"char_start": 885,
"chars": ")"
},
{
"char_end": 923,
"char_start": 922,
"chars": "f"
},
{
"char_end": 980,
"char_start": 973,
"chars": "Dark Kn"
},
{
"char_end": 983,
"char_start": 981,
"chars": "gh"
},
{
"char_end": 987,
"char_start": 986,
"chars": "\""
}
]
},
"commit_link": "github.com/Elbertbiggs360/dvdrental/commit/ad144ae2a08a332498d0831bc255170d57ba754b",
"file_name": "app.py",
"func_name": "add_movie",
"line_changes": {
"added": [
{
"char_end": 832,
"char_start": 784,
"line": " VALUES (%s, %s, %s, %s, %s, %s, %s, %s)\n",
"line_no": 22
},
{
"char_end": 879,
"char_start": 832,
"line": " \"\"\", [(v, ) for k, v in movie.items()]\n",
"line_no": 23
},
{
"char_end": 989,
"char_start": 894,
"line": " cur.execute(\"SELECT * FROM film where fulltext @@ to_tsquery(%s)\", (movie['title'], ))\n",
"line_no": 26
}
],
"deleted": [
{
"char_end": 836,
"char_start": 784,
"line": " VALUES ('{}', '{}', {}, {}, {}, {}, {}, {})\n",
"line_no": 22
},
{
"char_end": 887,
"char_start": 836,
"line": " \"\"\".format(*[v for k, v in movie.items()])\n",
"line_no": 23
},
{
"char_end": 989,
"char_start": 902,
"line": " cur.execute(f\"SELECT * FROM film where fulltext @@ to_tsquery('Dark Knight')\")\n",
"line_no": 26
}
]
},
"vul_type": "cwe-089"
} | 311 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/movies/add', methods=['GET', 'POST'])\ndef add_movie():\n form = MovieForm()\n if not form.validate_on_submit():\n return render_template('new_movie.html', title='Add New Movie', form=form)\n lang_id = add_language(form.data['language'])\n movie = {\n 'title': '',\n 'description': '',\n 'release_year': 0,\n 'rental_duration': 0,\n 'rental_rate': 0.00,\n 'length': 0,\n 'replacement_cost': 0.00\n }\n for k, v in movie.items():\n movie[k] = form.data[k]\n movie['language_id'] = movie.get('language_id', lang_id)\n cur.execute(\n \"\"\"\n INSERT INTO film (title, description, release_year, language_id, rental_duration, rental_rate, length, replacement_cost)",
" VALUES (%s, %s, %s, %s, %s, %s, %s, %s)\n \"\"\", [(v, ) for k, v in movie.items()]",
" )\n try:",
" cur.execute(\"SELECT * FROM film where fulltext @@ to_tsquery(%s)\", (movie['title'], ))",
" res = cur.fetchall()\n conn.commit()\n return redirect(url_for('movies'))\n except Exception as e:\n return redirect(url_for('index'))"
] | [
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 802,
"char_start": 800,
"chars": "%s"
},
{
"char_end": 806,
"char_start": 804,
"chars": "%s"
},
{
"char_end": 810,
"char_start": 808,
"chars": "%s"
},
{
"char_end": 814,
"char_start": 812,
"chars": "%s"
},
{
"char_end": 818,
"char_start": 816,
"chars": "%s"
},
{
"char_end": 822,
"char_start": 820,
"chars": "%s"
},
{
"char_end": 826,
"char_start": 824,
"chars": "%s"
},
{
"char_end": 830,
"char_start": 828,
"chars": "%s"
},
{
"char_end": 846,
"char_start": 843,
"chars": ", ["
},
{
"char_end": 851,
"char_start": 848,
"chars": ", )"
},
{
"char_end": 968,
"char_start": 963,
"chars": "%s)\","
},
{
"char_end": 978,
"char_start": 969,
"chars": "(movie['t"
},
{
"char_end": 982,
"char_start": 980,
"chars": "le"
},
{
"char_end": 986,
"char_start": 983,
"chars": "], "
}
],
"deleted": [
{
"char_end": 804,
"char_start": 800,
"chars": "'{}'"
},
{
"char_end": 810,
"char_start": 806,
"chars": "'{}'"
},
{
"char_end": 814,
"char_start": 812,
"chars": "{}"
},
{
"char_end": 818,
"char_start": 816,
"chars": "{}"
},
{
"char_end": 822,
"char_start": 820,
"chars": "{}"
},
{
"char_end": 826,
"char_start": 824,
"chars": "{}"
},
{
"char_end": 830,
"char_start": 828,
"chars": "{}"
},
{
"char_end": 834,
"char_start": 832,
"chars": "{}"
},
{
"char_end": 856,
"char_start": 847,
"chars": ".format(*"
},
{
"char_end": 886,
"char_start": 885,
"chars": ")"
},
{
"char_end": 923,
"char_start": 922,
"chars": "f"
},
{
"char_end": 980,
"char_start": 973,
"chars": "Dark Kn"
},
{
"char_end": 983,
"char_start": 981,
"chars": "gh"
},
{
"char_end": 987,
"char_start": 986,
"chars": "\""
}
]
},
"commit_link": "github.com/Elbertbiggs360/dvdrental/commit/ad144ae2a08a332498d0831bc255170d57ba754b",
"file_name": "app.py",
"func_name": "add_movie",
"line_changes": {
"added": [
{
"char_end": 832,
"char_start": 784,
"line": " VALUES (%s, %s, %s, %s, %s, %s, %s, %s)\n",
"line_no": 22
},
{
"char_end": 879,
"char_start": 832,
"line": " \"\"\", [(v, ) for k, v in movie.items()]\n",
"line_no": 23
},
{
"char_end": 989,
"char_start": 894,
"line": " cur.execute(\"SELECT * FROM film where fulltext @@ to_tsquery(%s)\", (movie['title'], ))\n",
"line_no": 26
}
],
"deleted": [
{
"char_end": 836,
"char_start": 784,
"line": " VALUES ('{}', '{}', {}, {}, {}, {}, {}, {})\n",
"line_no": 22
},
{
"char_end": 887,
"char_start": 836,
"line": " \"\"\".format(*[v for k, v in movie.items()])\n",
"line_no": 23
},
{
"char_end": 989,
"char_start": 902,
"line": " cur.execute(f\"SELECT * FROM film where fulltext @@ to_tsquery('Dark Knight')\")\n",
"line_no": 26
}
]
},
"vul_type": "cwe-089"
} | 311 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def new_category(category_name):\n try:\n conn = check_heroku_db()\n cur = conn.cursor()",
" cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))",
" conn.commit()\n conn.close()",
" except psycopg2.DatabaseError as e:\n print('Error %s' % e)\n sys.exit(1)"
] | [
1,
0,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 104,
"char_start": 103,
"chars": "\n"
},
{
"char_end": 113,
"char_start": 112,
"chars": "q"
},
{
"char_end": 121,
"char_start": 115,
"chars": "ry = \""
},
{
"char_end": 183,
"char_start": 166,
"chars": ";\"\n data ="
},
{
"char_end": 232,
"char_start": 200,
"chars": "\n cur.execute(query, data"
},
{
"char_end": 234,
"char_start": 233,
"chars": "\n"
}
],
"deleted": [
{
"char_end": 112,
"char_start": 111,
"chars": "c"
},
{
"char_end": 126,
"char_start": 114,
"chars": ".execute('''"
},
{
"char_end": 175,
"char_start": 171,
"chars": "''',"
}
]
},
"commit_link": "github.com/leeorb321/expenses/commit/f93c0fa4d30787ef16420bfefc52565b98bc7fcf",
"file_name": "db.py",
"func_name": "new_category",
"line_changes": {
"added": [
{
"char_end": 104,
"char_start": 103,
"line": "\n",
"line_no": 5
},
{
"char_end": 169,
"char_start": 104,
"line": " query = \"INSERT INTO categories (cat_name) VALUES (%s);\"\n",
"line_no": 6
},
{
"char_end": 201,
"char_start": 169,
"line": " data = (category_name,)\n",
"line_no": 7
},
{
"char_end": 234,
"char_start": 201,
"line": " cur.execute(query, data)\n",
"line_no": 8
},
{
"char_end": 235,
"char_start": 234,
"line": "\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 194,
"char_start": 103,
"line": " cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 312 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def new_category(category_name):\n try:\n conn = check_heroku_db()\n cur = conn.cursor()",
"\n query = \"INSERT INTO categories (cat_name) VALUES (%s);\"\n data = (category_name,)\n cur.execute(query, data)\n",
" conn.commit()\n conn.close()",
" except psycopg2.DatabaseError as e:\n print('Error %s' % e)\n sys.exit(1)"
] | [
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 104,
"char_start": 103,
"chars": "\n"
},
{
"char_end": 113,
"char_start": 112,
"chars": "q"
},
{
"char_end": 121,
"char_start": 115,
"chars": "ry = \""
},
{
"char_end": 183,
"char_start": 166,
"chars": ";\"\n data ="
},
{
"char_end": 232,
"char_start": 200,
"chars": "\n cur.execute(query, data"
},
{
"char_end": 234,
"char_start": 233,
"chars": "\n"
}
],
"deleted": [
{
"char_end": 112,
"char_start": 111,
"chars": "c"
},
{
"char_end": 126,
"char_start": 114,
"chars": ".execute('''"
},
{
"char_end": 175,
"char_start": 171,
"chars": "''',"
}
]
},
"commit_link": "github.com/leeorb321/expenses/commit/f93c0fa4d30787ef16420bfefc52565b98bc7fcf",
"file_name": "db.py",
"func_name": "new_category",
"line_changes": {
"added": [
{
"char_end": 104,
"char_start": 103,
"line": "\n",
"line_no": 5
},
{
"char_end": 169,
"char_start": 104,
"line": " query = \"INSERT INTO categories (cat_name) VALUES (%s);\"\n",
"line_no": 6
},
{
"char_end": 201,
"char_start": 169,
"line": " data = (category_name,)\n",
"line_no": 7
},
{
"char_end": 234,
"char_start": 201,
"line": " cur.execute(query, data)\n",
"line_no": 8
},
{
"char_end": 235,
"char_start": 234,
"line": "\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 194,
"char_start": 103,
"line": " cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 312 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_first_month(db, scene):",
" sql = \"select date from matches where scene='{}' order by date limit 1;\".format(scene)\n res = db.exec(sql)",
" date = res[0][0]\n return date"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 87,
"char_start": 82,
"chars": "scene"
},
{
"char_end": 119,
"char_start": 113,
"chars": "\n a"
},
{
"char_end": 127,
"char_start": 120,
"chars": "gs = {'"
},
{
"char_end": 141,
"char_start": 132,
"chars": "': scene}"
},
{
"char_end": 169,
"char_start": 163,
"chars": ", args"
}
],
"deleted": [
{
"char_end": 111,
"char_start": 108,
"chars": ".fo"
},
{
"char_end": 116,
"char_start": 112,
"chars": "mat("
},
{
"char_end": 122,
"char_start": 121,
"chars": ")"
}
]
},
"commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63",
"file_name": "bracket_utils.py",
"func_name": "get_first_month",
"line_changes": {
"added": [
{
"char_end": 114,
"char_start": 32,
"line": " sql = \"select date from matches where scene='{scene}' order by date limit 1;\"\n",
"line_no": 2
},
{
"char_end": 142,
"char_start": 114,
"line": " args = {'scene': scene}\n",
"line_no": 3
},
{
"char_end": 171,
"char_start": 142,
"line": " res = db.exec(sql, args)\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 123,
"char_start": 32,
"line": " sql = \"select date from matches where scene='{}' order by date limit 1;\".format(scene)\n",
"line_no": 2
},
{
"char_end": 146,
"char_start": 123,
"line": " res = db.exec(sql)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 313 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_first_month(db, scene):",
" sql = \"select date from matches where scene='{scene}' order by date limit 1;\"\n args = {'scene': scene}\n res = db.exec(sql, args)",
" date = res[0][0]\n return date"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 87,
"char_start": 82,
"chars": "scene"
},
{
"char_end": 119,
"char_start": 113,
"chars": "\n a"
},
{
"char_end": 127,
"char_start": 120,
"chars": "gs = {'"
},
{
"char_end": 141,
"char_start": 132,
"chars": "': scene}"
},
{
"char_end": 169,
"char_start": 163,
"chars": ", args"
}
],
"deleted": [
{
"char_end": 111,
"char_start": 108,
"chars": ".fo"
},
{
"char_end": 116,
"char_start": 112,
"chars": "mat("
},
{
"char_end": 122,
"char_start": 121,
"chars": ")"
}
]
},
"commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63",
"file_name": "bracket_utils.py",
"func_name": "get_first_month",
"line_changes": {
"added": [
{
"char_end": 114,
"char_start": 32,
"line": " sql = \"select date from matches where scene='{scene}' order by date limit 1;\"\n",
"line_no": 2
},
{
"char_end": 142,
"char_start": 114,
"line": " args = {'scene': scene}\n",
"line_no": 3
},
{
"char_end": 171,
"char_start": 142,
"line": " res = db.exec(sql, args)\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 123,
"char_start": 32,
"line": " sql = \"select date from matches where scene='{}' order by date limit 1;\".format(scene)\n",
"line_no": 2
},
{
"char_end": 146,
"char_start": 123,
"line": " res = db.exec(sql)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 313 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def getOptions(poll_name):\n conn, c = connectDB()",
" options_str = queryOne(c, \"SELECT options FROM {} WHERE name='{}'\".format(CFG(\"poll_table_name\"), poll_name))",
" if options_str == None:\n return None\n options = options_str.split(\",\")\n closeDB(conn)\n return options"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 60,
"char_start": 58,
"chars": "eq"
},
{
"char_end": 99,
"char_start": 98,
"chars": "?"
},
{
"char_end": 160,
"char_start": 130,
"chars": ")\n options_str = queryOne(c"
},
{
"char_end": 168,
"char_start": 162,
"chars": "req, ("
},
{
"char_end": 178,
"char_start": 177,
"chars": ","
}
],
"deleted": [
{
"char_end": 67,
"char_start": 57,
"chars": "options_st"
},
{
"char_end": 83,
"char_start": 71,
"chars": "queryOne(c, "
},
{
"char_end": 122,
"char_start": 118,
"chars": "'{}'"
}
]
},
"commit_link": "github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109",
"file_name": "database.py",
"func_name": "getOptions",
"line_changes": {
"added": [
{
"char_end": 132,
"char_start": 53,
"line": " req = \"SELECT options FROM {} WHERE name=?\".format(CFG(\"poll_table_name\"))\n",
"line_no": 3
},
{
"char_end": 181,
"char_start": 132,
"line": " options_str = queryOne(c, req, (poll_name,))\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 167,
"char_start": 53,
"line": " options_str = queryOne(c, \"SELECT options FROM {} WHERE name='{}'\".format(CFG(\"poll_table_name\"), poll_name))\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 314 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def getOptions(poll_name):\n conn, c = connectDB()",
" req = \"SELECT options FROM {} WHERE name=?\".format(CFG(\"poll_table_name\"))\n options_str = queryOne(c, req, (poll_name,))",
" if options_str == None:\n return None\n options = options_str.split(\",\")\n closeDB(conn)\n return options"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 60,
"char_start": 58,
"chars": "eq"
},
{
"char_end": 99,
"char_start": 98,
"chars": "?"
},
{
"char_end": 160,
"char_start": 130,
"chars": ")\n options_str = queryOne(c"
},
{
"char_end": 168,
"char_start": 162,
"chars": "req, ("
},
{
"char_end": 178,
"char_start": 177,
"chars": ","
}
],
"deleted": [
{
"char_end": 67,
"char_start": 57,
"chars": "options_st"
},
{
"char_end": 83,
"char_start": 71,
"chars": "queryOne(c, "
},
{
"char_end": 122,
"char_start": 118,
"chars": "'{}'"
}
]
},
"commit_link": "github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109",
"file_name": "database.py",
"func_name": "getOptions",
"line_changes": {
"added": [
{
"char_end": 132,
"char_start": 53,
"line": " req = \"SELECT options FROM {} WHERE name=?\".format(CFG(\"poll_table_name\"))\n",
"line_no": 3
},
{
"char_end": 181,
"char_start": 132,
"line": " options_str = queryOne(c, req, (poll_name,))\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 167,
"char_start": 53,
"line": " options_str = queryOne(c, \"SELECT options FROM {} WHERE name='{}'\".format(CFG(\"poll_table_name\"), poll_name))\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 314 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def retrieve_last_video_position(playlist_id, db):",
" db.execute(\"SELECT max(position) as position from video WHERE playlist_id={playlist_id};\".format(\n playlist_id=playlist_id))",
" row = db.fetchone()\n return row['position']"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 75,
"char_start": 66,
"chars": "\n "
},
{
"char_end": 139,
"char_start": 138,
"chars": "%"
},
{
"char_end": 144,
"char_start": 142,
"chars": ", "
},
{
"char_end": 157,
"char_start": 156,
"chars": ","
}
],
"deleted": [
{
"char_end": 136,
"char_start": 129,
"chars": "{playli"
},
{
"char_end": 142,
"char_start": 137,
"chars": "t_id}"
},
{
"char_end": 158,
"char_start": 144,
"chars": ".format(\n "
},
{
"char_end": 173,
"char_start": 159,
"chars": " playlist_id="
}
]
},
"commit_link": "github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6",
"file_name": "video/video_repository.py",
"func_name": "retrieve_last_video_position",
"line_changes": {
"added": [
{
"char_end": 67,
"char_start": 51,
"line": " db.execute(\n",
"line_no": 2
},
{
"char_end": 160,
"char_start": 67,
"line": " \"SELECT max(position) as position from video WHERE playlist_id=%s;\", (playlist_id,))\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 153,
"char_start": 51,
"line": " db.execute(\"SELECT max(position) as position from video WHERE playlist_id={playlist_id};\".format(\n",
"line_no": 2
},
{
"char_end": 187,
"char_start": 153,
"line": " playlist_id=playlist_id))\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 315 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def retrieve_last_video_position(playlist_id, db):",
" db.execute(\n \"SELECT max(position) as position from video WHERE playlist_id=%s;\", (playlist_id,))",
" row = db.fetchone()\n return row['position']"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 75,
"char_start": 66,
"chars": "\n "
},
{
"char_end": 139,
"char_start": 138,
"chars": "%"
},
{
"char_end": 144,
"char_start": 142,
"chars": ", "
},
{
"char_end": 157,
"char_start": 156,
"chars": ","
}
],
"deleted": [
{
"char_end": 136,
"char_start": 129,
"chars": "{playli"
},
{
"char_end": 142,
"char_start": 137,
"chars": "t_id}"
},
{
"char_end": 158,
"char_start": 144,
"chars": ".format(\n "
},
{
"char_end": 173,
"char_start": 159,
"chars": " playlist_id="
}
]
},
"commit_link": "github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6",
"file_name": "video/video_repository.py",
"func_name": "retrieve_last_video_position",
"line_changes": {
"added": [
{
"char_end": 67,
"char_start": 51,
"line": " db.execute(\n",
"line_no": 2
},
{
"char_end": 160,
"char_start": 67,
"line": " \"SELECT max(position) as position from video WHERE playlist_id=%s;\", (playlist_id,))\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 153,
"char_start": 51,
"line": " db.execute(\"SELECT max(position) as position from video WHERE playlist_id={playlist_id};\".format(\n",
"line_no": 2
},
{
"char_end": 187,
"char_start": 153,
"line": " playlist_id=playlist_id))\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 315 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/<page_name>/history')\ndef 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(\n 'page_history.html',\n page_name = page_name,\n page_histories = page_histories\n )"
] | [
1,
0,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 222,
"char_start": 220,
"chars": "$1"
},
{
"char_end": 224,
"char_start": 223,
"chars": ","
}
],
"deleted": [
{
"char_end": 224,
"char_start": 220,
"chars": "'%s'"
},
{
"char_end": 227,
"char_start": 225,
"chars": " %"
}
]
},
"commit_link": "github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b",
"file_name": "server.py",
"func_name": "view_page_history",
"line_changes": {
"added": [
{
"char_end": 236,
"char_start": 69,
"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 = $1\", page_name)\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 239,
"char_start": 69,
"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",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 316 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/<page_name>/history')\ndef 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(\n 'page_history.html',\n page_name = page_name,\n page_histories = page_histories\n )"
] | [
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 222,
"char_start": 220,
"chars": "$1"
},
{
"char_end": 224,
"char_start": 223,
"chars": ","
}
],
"deleted": [
{
"char_end": 224,
"char_start": 220,
"chars": "'%s'"
},
{
"char_end": 227,
"char_start": 225,
"chars": " %"
}
]
},
"commit_link": "github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b",
"file_name": "server.py",
"func_name": "view_page_history",
"line_changes": {
"added": [
{
"char_end": 236,
"char_start": 69,
"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 = $1\", page_name)\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 239,
"char_start": 69,
"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",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 316 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_input(self, data):\n connection = self.connects()\n try:\n # The following introduces a deliberate security flaw. See section on SQL injecton below",
" query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(\n data)",
" with connection.cursor() as cursor:",
" cursor.execute(query)",
" connection.commit()\n finally:\n connection.close()"
] | [
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 246,
"char_start": 244,
"chars": "%s"
},
{
"char_end": 340,
"char_start": 334,
"chars": ", data"
}
],
"deleted": [
{
"char_end": 248,
"char_start": 244,
"chars": "'{}'"
},
{
"char_end": 281,
"char_start": 251,
"chars": ".format(\n data)"
}
]
},
"commit_link": "github.com/JeremiahO/crimemap/commit/c17537fcd7aa4e2a26f7ca5cefaeb356ff646858",
"file_name": "dbhelper.py",
"func_name": "add_input",
"line_changes": {
"added": [
{
"char_end": 250,
"char_start": 182,
"line": " query = \"INSERT INTO crimes (description) VALUES (%s);\"\n",
"line_no": 5
},
{
"char_end": 342,
"char_start": 298,
"line": " cursor.execute(query, data)\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 260,
"char_start": 182,
"line": " query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(\n",
"line_no": 5
},
{
"char_end": 282,
"char_start": 260,
"line": " data)\n",
"line_no": 6
},
{
"char_end": 368,
"char_start": 330,
"line": " cursor.execute(query)\n",
"line_no": 8
}
]
},
"vul_type": "cwe-089"
} | 317 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_input(self, data):\n connection = self.connects()\n try:\n # 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.execute(query, data)",
" connection.commit()\n finally:\n connection.close()"
] | [
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 246,
"char_start": 244,
"chars": "%s"
},
{
"char_end": 340,
"char_start": 334,
"chars": ", data"
}
],
"deleted": [
{
"char_end": 248,
"char_start": 244,
"chars": "'{}'"
},
{
"char_end": 281,
"char_start": 251,
"chars": ".format(\n data)"
}
]
},
"commit_link": "github.com/JeremiahO/crimemap/commit/c17537fcd7aa4e2a26f7ca5cefaeb356ff646858",
"file_name": "dbhelper.py",
"func_name": "add_input",
"line_changes": {
"added": [
{
"char_end": 250,
"char_start": 182,
"line": " query = \"INSERT INTO crimes (description) VALUES (%s);\"\n",
"line_no": 5
},
{
"char_end": 342,
"char_start": 298,
"line": " cursor.execute(query, data)\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 260,
"char_start": 182,
"line": " query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(\n",
"line_no": 5
},
{
"char_end": 282,
"char_start": 260,
"line": " data)\n",
"line_no": 6
},
{
"char_end": 368,
"char_start": 330,
"line": " cursor.execute(query)\n",
"line_no": 8
}
]
},
"vul_type": "cwe-089"
} | 317 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_top_author(top_num):\r\n \"\"\" query the top(top_num) popular author\r\n top_num => list of [author, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT authors.name,author_result.num\r\n FROM authors JOIN\r\n (SELECT SUM(article_result.num) as num,\r\n article_result.author\r\n from (SELECT articles.title, articles.author,\r\n SUM(log.views) AS num\r\n FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log ON log.path = '/article/'\r\n || articles.slug\r\n GROUP BY articles.title, articles.author)\r\n AS article_result\r\n GROUP BY article_result.author) as author_result\r\n ON authors.id = author_result.author\r",
" ORDER BY num DESC LIMIT {}\"\"\".format(top_num)\r\n return execute_query(cmd)"
] | [
1,
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 977,
"char_start": 975,
"chars": "%s"
},
{
"char_end": 987,
"char_start": 980,
"chars": "\r\n d"
},
{
"char_end": 994,
"char_start": 989,
"chars": "a = ["
},
{
"char_end": 1004,
"char_start": 1001,
"chars": ", ]"
},
{
"char_end": 1040,
"char_start": 1034,
"chars": ", data"
}
],
"deleted": [
{
"char_end": 977,
"char_start": 975,
"chars": "{}"
},
{
"char_end": 985,
"char_start": 980,
"chars": ".form"
},
{
"char_end": 988,
"char_start": 987,
"chars": "("
},
{
"char_end": 996,
"char_start": 995,
"chars": ")"
}
]
},
"commit_link": "github.com/thugasin/udacity-homework-logAnalyzer/commit/506f25f9a1caee7f17034adf7c75e0efbc88082b",
"file_name": "logAnalyzerDb.py",
"func_name": "get_top_author",
"line_changes": {
"added": [
{
"char_end": 982,
"char_start": 931,
"line": " ORDER BY num DESC LIMIT %s\"\"\"\r\n",
"line_no": 21
},
{
"char_end": 1006,
"char_start": 982,
"line": " data = [top_num, ]\r\n",
"line_no": 22
},
{
"char_end": 1041,
"char_start": 1006,
"line": " return execute_query(cmd, data)\r\n",
"line_no": 23
}
],
"deleted": [
{
"char_end": 998,
"char_start": 931,
"line": " ORDER BY num DESC LIMIT {}\"\"\".format(top_num)\r\n",
"line_no": 21
},
{
"char_end": 1027,
"char_start": 998,
"line": " return execute_query(cmd)\r\n",
"line_no": 22
}
]
},
"vul_type": "cwe-089"
} | 318 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_top_author(top_num):\r\n \"\"\" query the top(top_num) popular author\r\n top_num => list of [author, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT authors.name,author_result.num\r\n FROM authors JOIN\r\n (SELECT SUM(article_result.num) as num,\r\n article_result.author\r\n from (SELECT articles.title, articles.author,\r\n SUM(log.views) AS num\r\n FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log ON log.path = '/article/'\r\n || articles.slug\r\n GROUP BY articles.title, articles.author)\r\n AS article_result\r\n GROUP BY article_result.author) as author_result\r\n ON authors.id = author_result.author\r",
" ORDER BY num DESC LIMIT %s\"\"\"\r\n data = [top_num, ]\r\n return execute_query(cmd, data)"
] | [
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 977,
"char_start": 975,
"chars": "%s"
},
{
"char_end": 987,
"char_start": 980,
"chars": "\r\n d"
},
{
"char_end": 994,
"char_start": 989,
"chars": "a = ["
},
{
"char_end": 1004,
"char_start": 1001,
"chars": ", ]"
},
{
"char_end": 1040,
"char_start": 1034,
"chars": ", data"
}
],
"deleted": [
{
"char_end": 977,
"char_start": 975,
"chars": "{}"
},
{
"char_end": 985,
"char_start": 980,
"chars": ".form"
},
{
"char_end": 988,
"char_start": 987,
"chars": "("
},
{
"char_end": 996,
"char_start": 995,
"chars": ")"
}
]
},
"commit_link": "github.com/thugasin/udacity-homework-logAnalyzer/commit/506f25f9a1caee7f17034adf7c75e0efbc88082b",
"file_name": "logAnalyzerDb.py",
"func_name": "get_top_author",
"line_changes": {
"added": [
{
"char_end": 982,
"char_start": 931,
"line": " ORDER BY num DESC LIMIT %s\"\"\"\r\n",
"line_no": 21
},
{
"char_end": 1006,
"char_start": 982,
"line": " data = [top_num, ]\r\n",
"line_no": 22
},
{
"char_end": 1041,
"char_start": 1006,
"line": " return execute_query(cmd, data)\r\n",
"line_no": 23
}
],
"deleted": [
{
"char_end": 998,
"char_start": 931,
"line": " ORDER BY num DESC LIMIT {}\"\"\".format(top_num)\r\n",
"line_no": 21
},
{
"char_end": 1027,
"char_start": 998,
"line": " return execute_query(cmd)\r\n",
"line_no": 22
}
]
},
"vul_type": "cwe-089"
} | 318 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/get_all_referrers')\ndef get_all_referrers():\n account_id = request.args.get('account_id')",
" if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)",
" account_id = j_l[\"result\"][0][\"id\"]",
" con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n",
" query = \"select * from referrers where referrer='\"+account_id+\"'\"\n cur.execute(query)",
" results = cur.fetchall()",
" return jsonify(results)"
] | [
1,
1,
1,
1,
0,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 484,
"char_start": 482,
"chars": "%s"
},
{
"char_end": 522,
"char_start": 507,
"chars": ", (account_id,)"
}
],
"deleted": [
{
"char_end": 498,
"char_start": 482,
"chars": "'\"+account_id+\"'"
}
]
},
"commit_link": "github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60",
"file_name": "api.py",
"func_name": "get_all_referrers",
"line_changes": {
"added": [
{
"char_end": 486,
"char_start": 430,
"line": " query = \"select * from referrers where referrer=%s\"\n",
"line_no": 15
},
{
"char_end": 524,
"char_start": 486,
"line": " cur.execute(query, (account_id,))\n",
"line_no": 16
}
],
"deleted": [
{
"char_end": 500,
"char_start": 430,
"line": " query = \"select * from referrers where referrer='\"+account_id+\"'\"\n",
"line_no": 15
},
{
"char_end": 523,
"char_start": 500,
"line": " cur.execute(query)\n",
"line_no": 16
}
]
},
"vul_type": "cwe-089"
} | 319 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/get_all_referrers')\ndef get_all_referrers():\n account_id = request.args.get('account_id')",
" if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)",
" account_id = j_l[\"result\"][0][\"id\"]",
" con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n",
" query = \"select * from referrers where referrer=%s\"\n cur.execute(query, (account_id,))",
" results = cur.fetchall()",
" return jsonify(results)"
] | [
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 484,
"char_start": 482,
"chars": "%s"
},
{
"char_end": 522,
"char_start": 507,
"chars": ", (account_id,)"
}
],
"deleted": [
{
"char_end": 498,
"char_start": 482,
"chars": "'\"+account_id+\"'"
}
]
},
"commit_link": "github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60",
"file_name": "api.py",
"func_name": "get_all_referrers",
"line_changes": {
"added": [
{
"char_end": 486,
"char_start": 430,
"line": " query = \"select * from referrers where referrer=%s\"\n",
"line_no": 15
},
{
"char_end": 524,
"char_start": 486,
"line": " cur.execute(query, (account_id,))\n",
"line_no": 16
}
],
"deleted": [
{
"char_end": 500,
"char_start": 430,
"line": " query = \"select * from referrers where referrer='\"+account_id+\"'\"\n",
"line_no": 15
},
{
"char_end": 523,
"char_start": 500,
"line": " cur.execute(query)\n",
"line_no": 16
}
]
},
"vul_type": "cwe-089"
} | 319 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_translationname(self, trname):\n \"\"\"Add new translation by item name for an item.\"\"\"\n if self.connection:\n for item in self.find_item_name([trname[0], '0']):",
" self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (\"%s\", \"%s\", \"%s\")' % (item[0], trname[1], trname[2]))",
" self.connection.commit()"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 264,
"char_start": 210,
"chars": "t = (item[0], trname[1], trname[2], )\n "
},
{
"char_end": 360,
"char_start": 359,
"chars": "?"
},
{
"char_end": 363,
"char_start": 362,
"chars": "?"
},
{
"char_end": 366,
"char_start": 365,
"chars": "?"
}
],
"deleted": [
{
"char_end": 309,
"char_start": 305,
"chars": "\"%s\""
},
{
"char_end": 315,
"char_start": 311,
"chars": "\"%s\""
},
{
"char_end": 321,
"char_start": 317,
"chars": "\"%s\""
},
{
"char_end": 334,
"char_start": 323,
"chars": " % (item[0]"
},
{
"char_end": 357,
"char_start": 337,
"chars": "rname[1], trname[2])"
}
]
},
"commit_link": "github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a",
"file_name": "ecosldb/ecosldb.py",
"func_name": "add_translationname",
"line_changes": {
"added": [
{
"char_end": 248,
"char_start": 194,
"line": " t = (item[0], trname[1], trname[2], )\n",
"line_no": 5
},
{
"char_end": 373,
"char_start": 248,
"line": " self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (?, ?, ?)', t)\n",
"line_no": 6
},
{
"char_end": 409,
"char_start": 373,
"line": " self.connection.commit()\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 359,
"char_start": 194,
"line": " self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (\"%s\", \"%s\", \"%s\")' % (item[0], trname[1], trname[2]))\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 320 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_translationname(self, trname):\n \"\"\"Add new translation by item name for an item.\"\"\"\n if self.connection:\n for item in self.find_item_name([trname[0], '0']):",
" t = (item[0], trname[1], trname[2], )\n self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (?, ?, ?)', t)",
" self.connection.commit()"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 264,
"char_start": 210,
"chars": "t = (item[0], trname[1], trname[2], )\n "
},
{
"char_end": 360,
"char_start": 359,
"chars": "?"
},
{
"char_end": 363,
"char_start": 362,
"chars": "?"
},
{
"char_end": 366,
"char_start": 365,
"chars": "?"
}
],
"deleted": [
{
"char_end": 309,
"char_start": 305,
"chars": "\"%s\""
},
{
"char_end": 315,
"char_start": 311,
"chars": "\"%s\""
},
{
"char_end": 321,
"char_start": 317,
"chars": "\"%s\""
},
{
"char_end": 334,
"char_start": 323,
"chars": " % (item[0]"
},
{
"char_end": 357,
"char_start": 337,
"chars": "rname[1], trname[2])"
}
]
},
"commit_link": "github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a",
"file_name": "ecosldb/ecosldb.py",
"func_name": "add_translationname",
"line_changes": {
"added": [
{
"char_end": 248,
"char_start": 194,
"line": " t = (item[0], trname[1], trname[2], )\n",
"line_no": 5
},
{
"char_end": 373,
"char_start": 248,
"line": " self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (?, ?, ?)', t)\n",
"line_no": 6
},
{
"char_end": 409,
"char_start": 373,
"line": " self.connection.commit()\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 359,
"char_start": 194,
"line": " self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (\"%s\", \"%s\", \"%s\")' % (item[0], trname[1], trname[2]))\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 320 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@staticmethod\n def get_max_task_id_for_project(project_id: int):\n \"\"\"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)\n result = db.engine.execute(sql)",
" if result.rowcount == 0:\n raise NotFound()\n for row in result:\n return row[0]"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 213,
"char_start": 202,
"chars": ":project_id"
},
{
"char_end": 277,
"char_start": 272,
"chars": "text("
},
{
"char_end": 304,
"char_start": 280,
"chars": "), project_id=project_id"
}
],
"deleted": [
{
"char_end": 205,
"char_start": 202,
"chars": "{0}"
},
{
"char_end": 247,
"char_start": 228,
"chars": ".format(project_id)"
}
]
},
"commit_link": "github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a",
"file_name": "server/models/postgis/task.py",
"func_name": "get_max_task_id_for_project",
"line_changes": {
"added": [
{
"char_end": 237,
"char_start": 140,
"line": " sql = \"\"\"select max(id) from tasks where project_id = :project_id GROUP BY project_id\"\"\"\n",
"line_no": 4
},
{
"char_end": 306,
"char_start": 237,
"line": " result = db.engine.execute(text(sql), project_id=project_id)\n",
"line_no": 5
}
],
"deleted": [
{
"char_end": 248,
"char_start": 140,
"line": " sql = \"\"\"select max(id) from tasks where project_id = {0} GROUP BY project_id\"\"\".format(project_id)\n",
"line_no": 4
},
{
"char_end": 288,
"char_start": 248,
"line": " result = db.engine.execute(sql)\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 321 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@staticmethod\n def get_max_task_id_for_project(project_id: int):\n \"\"\"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\"\"\"\n result = db.engine.execute(text(sql), project_id=project_id)",
" if result.rowcount == 0:\n raise NotFound()\n for row in result:\n return row[0]"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 213,
"char_start": 202,
"chars": ":project_id"
},
{
"char_end": 277,
"char_start": 272,
"chars": "text("
},
{
"char_end": 304,
"char_start": 280,
"chars": "), project_id=project_id"
}
],
"deleted": [
{
"char_end": 205,
"char_start": 202,
"chars": "{0}"
},
{
"char_end": 247,
"char_start": 228,
"chars": ".format(project_id)"
}
]
},
"commit_link": "github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a",
"file_name": "server/models/postgis/task.py",
"func_name": "get_max_task_id_for_project",
"line_changes": {
"added": [
{
"char_end": 237,
"char_start": 140,
"line": " sql = \"\"\"select max(id) from tasks where project_id = :project_id GROUP BY project_id\"\"\"\n",
"line_no": 4
},
{
"char_end": 306,
"char_start": 237,
"line": " result = db.engine.execute(text(sql), project_id=project_id)\n",
"line_no": 5
}
],
"deleted": [
{
"char_end": 248,
"char_start": 140,
"line": " sql = \"\"\"select max(id) from tasks where project_id = {0} GROUP BY project_id\"\"\".format(project_id)\n",
"line_no": 4
},
{
"char_end": 288,
"char_start": 248,
"line": " result = db.engine.execute(sql)\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 321 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def findNPC(race, classe, sex,level):\n\tc, conn = getConnection()\n\tdate = now()\n\t#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;",
"\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;\")",
"\tconn.commit()\n\tout = c.fetchmany(5)\n\tconn.close()\n\treturn out"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 286,
"char_start": 283,
"chars": "(?)"
},
{
"char_end": 300,
"char_start": 297,
"chars": "(?)"
},
{
"char_end": 312,
"char_start": 309,
"chars": "(?)"
},
{
"char_end": 384,
"char_start": 366,
"chars": ",(race,classe,sex)"
}
],
"deleted": [
{
"char_end": 293,
"char_start": 283,
"chars": "'\"+race+\"'"
},
{
"char_end": 316,
"char_start": 304,
"chars": "'\"+classe+\"'"
},
{
"char_end": 334,
"char_start": 325,
"chars": "'\"+sex+\"'"
},
{
"char_end": 388,
"char_start": 387,
"chars": ";"
}
]
},
"commit_link": "github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0",
"file_name": "database.py",
"func_name": "findNPC",
"line_changes": {
"added": [
{
"char_end": 386,
"char_start": 221,
"line": "\tc.execute(\"select image, avg(legit) as l FROM npc WHERE race=(?) AND class=(?) AND sex=(?) GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC\",(race,classe,sex))\n",
"line_no": 5
}
],
"deleted": [
{
"char_end": 391,
"char_start": 221,
"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",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 322 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def findNPC(race, classe, sex,level):\n\tc, conn = getConnection()\n\tdate = now()\n\t#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;",
"\tc.execute(\"select image, avg(legit) as l FROM npc WHERE race=(?) AND class=(?) AND sex=(?) GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC\",(race,classe,sex))",
"\tconn.commit()\n\tout = c.fetchmany(5)\n\tconn.close()\n\treturn out"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 286,
"char_start": 283,
"chars": "(?)"
},
{
"char_end": 300,
"char_start": 297,
"chars": "(?)"
},
{
"char_end": 312,
"char_start": 309,
"chars": "(?)"
},
{
"char_end": 384,
"char_start": 366,
"chars": ",(race,classe,sex)"
}
],
"deleted": [
{
"char_end": 293,
"char_start": 283,
"chars": "'\"+race+\"'"
},
{
"char_end": 316,
"char_start": 304,
"chars": "'\"+classe+\"'"
},
{
"char_end": 334,
"char_start": 325,
"chars": "'\"+sex+\"'"
},
{
"char_end": 388,
"char_start": 387,
"chars": ";"
}
]
},
"commit_link": "github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0",
"file_name": "database.py",
"func_name": "findNPC",
"line_changes": {
"added": [
{
"char_end": 386,
"char_start": 221,
"line": "\tc.execute(\"select image, avg(legit) as l FROM npc WHERE race=(?) AND class=(?) AND sex=(?) GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC\",(race,classe,sex))\n",
"line_no": 5
}
],
"deleted": [
{
"char_end": 391,
"char_start": 221,
"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",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 322 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@mod.route('/edit/<int:msg_id>', methods=['GET', 'POST'])\ndef edit(msg_id):\n m = None\n if request.method == 'GET':",
" sql = \"SELECT * FROM message where msg_id = %d;\" % (msg_id)\n cursor.execute(sql)",
" m = cursor.fetchone()\n return render_template('message/edit.html', m=m, msg_id=msg_id)",
" if request.method == 'POST':\n content = request.form['content']",
" sql = \"UPDATE message SET content = '%s' where msg_id = '%d';\" \\\n % (content, msg_id)\n cursor.execute(sql)",
" conn.commit()\n flash('Edit Success!')\n return redirect(url_for('show_entries'))",
" return render_template('message/edit.html', m=m, msg_id=msg_id)"
] | [
1,
0,
1,
1,
0,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 132,
"char_start": 129,
"chars": "cur"
},
{
"char_end": 144,
"char_start": 133,
"chars": "or.execute("
},
{
"char_end": 184,
"char_start": 183,
"chars": "s"
},
{
"char_end": 187,
"char_start": 186,
"chars": ","
},
{
"char_end": 196,
"char_start": 195,
"chars": ","
},
{
"char_end": 388,
"char_start": 385,
"chars": "cur"
},
{
"char_end": 400,
"char_start": 389,
"chars": "or.execute("
},
{
"char_end": 450,
"char_start": 449,
"chars": "s"
},
{
"char_end": 453,
"char_start": 452,
"chars": ","
}
],
"deleted": [
{
"char_end": 135,
"char_start": 130,
"chars": "ql = "
},
{
"char_end": 175,
"char_start": 174,
"chars": "d"
},
{
"char_end": 179,
"char_start": 177,
"chars": " %"
},
{
"char_end": 215,
"char_start": 188,
"chars": "\n cursor.execute(sql"
},
{
"char_end": 409,
"char_start": 404,
"chars": "ql = "
},
{
"char_end": 440,
"char_start": 439,
"chars": "'"
},
{
"char_end": 443,
"char_start": 442,
"chars": "'"
},
{
"char_end": 460,
"char_start": 459,
"chars": "'"
},
{
"char_end": 463,
"char_start": 461,
"chars": "d'"
},
{
"char_end": 481,
"char_start": 465,
"chars": " \\\n %"
},
{
"char_end": 526,
"char_start": 499,
"chars": "\n cursor.execute(sql"
}
]
},
"commit_link": "github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9",
"file_name": "flaskr/flaskr/views/message.py",
"func_name": "edit",
"line_changes": {
"added": [
{
"char_end": 199,
"char_start": 121,
"line": " cursor.execute(\"SELECT * FROM message where msg_id = %s;\", (msg_id,))\n",
"line_no": 5
},
{
"char_end": 473,
"char_start": 377,
"line": " cursor.execute(\"UPDATE message SET content = %s where msg_id = %s;\", (content, msg_id))\n",
"line_no": 11
}
],
"deleted": [
{
"char_end": 189,
"char_start": 121,
"line": " sql = \"SELECT * FROM message where msg_id = %d;\" % (msg_id)\n",
"line_no": 5
},
{
"char_end": 217,
"char_start": 189,
"line": " cursor.execute(sql)\n",
"line_no": 6
},
{
"char_end": 468,
"char_start": 395,
"line": " sql = \"UPDATE message SET content = '%s' where msg_id = '%d';\" \\\n",
"line_no": 12
},
{
"char_end": 500,
"char_start": 468,
"line": " % (content, msg_id)\n",
"line_no": 13
},
{
"char_end": 528,
"char_start": 500,
"line": " cursor.execute(sql)\n",
"line_no": 14
}
]
},
"vul_type": "cwe-089"
} | 323 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@mod.route('/edit/<int:msg_id>', methods=['GET', 'POST'])\ndef edit(msg_id):\n m = None\n if request.method == 'GET':",
" cursor.execute(\"SELECT * FROM message where msg_id = %s;\", (msg_id,))",
" m = cursor.fetchone()\n return render_template('message/edit.html', m=m, msg_id=msg_id)",
" if request.method == 'POST':\n content = request.form['content']",
" cursor.execute(\"UPDATE message SET content = %s where msg_id = %s;\", (content, msg_id))",
" conn.commit()\n flash('Edit Success!')\n return redirect(url_for('show_entries'))",
" return render_template('message/edit.html', m=m, msg_id=msg_id)"
] | [
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 132,
"char_start": 129,
"chars": "cur"
},
{
"char_end": 144,
"char_start": 133,
"chars": "or.execute("
},
{
"char_end": 184,
"char_start": 183,
"chars": "s"
},
{
"char_end": 187,
"char_start": 186,
"chars": ","
},
{
"char_end": 196,
"char_start": 195,
"chars": ","
},
{
"char_end": 388,
"char_start": 385,
"chars": "cur"
},
{
"char_end": 400,
"char_start": 389,
"chars": "or.execute("
},
{
"char_end": 450,
"char_start": 449,
"chars": "s"
},
{
"char_end": 453,
"char_start": 452,
"chars": ","
}
],
"deleted": [
{
"char_end": 135,
"char_start": 130,
"chars": "ql = "
},
{
"char_end": 175,
"char_start": 174,
"chars": "d"
},
{
"char_end": 179,
"char_start": 177,
"chars": " %"
},
{
"char_end": 215,
"char_start": 188,
"chars": "\n cursor.execute(sql"
},
{
"char_end": 409,
"char_start": 404,
"chars": "ql = "
},
{
"char_end": 440,
"char_start": 439,
"chars": "'"
},
{
"char_end": 443,
"char_start": 442,
"chars": "'"
},
{
"char_end": 460,
"char_start": 459,
"chars": "'"
},
{
"char_end": 463,
"char_start": 461,
"chars": "d'"
},
{
"char_end": 481,
"char_start": 465,
"chars": " \\\n %"
},
{
"char_end": 526,
"char_start": 499,
"chars": "\n cursor.execute(sql"
}
]
},
"commit_link": "github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9",
"file_name": "flaskr/flaskr/views/message.py",
"func_name": "edit",
"line_changes": {
"added": [
{
"char_end": 199,
"char_start": 121,
"line": " cursor.execute(\"SELECT * FROM message where msg_id = %s;\", (msg_id,))\n",
"line_no": 5
},
{
"char_end": 473,
"char_start": 377,
"line": " cursor.execute(\"UPDATE message SET content = %s where msg_id = %s;\", (content, msg_id))\n",
"line_no": 11
}
],
"deleted": [
{
"char_end": 189,
"char_start": 121,
"line": " sql = \"SELECT * FROM message where msg_id = %d;\" % (msg_id)\n",
"line_no": 5
},
{
"char_end": 217,
"char_start": 189,
"line": " cursor.execute(sql)\n",
"line_no": 6
},
{
"char_end": 468,
"char_start": 395,
"line": " sql = \"UPDATE message SET content = '%s' where msg_id = '%d';\" \\\n",
"line_no": 12
},
{
"char_end": 500,
"char_start": 468,
"line": " % (content, msg_id)\n",
"line_no": 13
},
{
"char_end": 528,
"char_start": 500,
"line": " cursor.execute(sql)\n",
"line_no": 14
}
]
},
"vul_type": "cwe-089"
} | 323 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_input(self,data):\n connection = self.connect()",
" try:",
" query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)",
" with connection.cursor() as cursor:",
" cursor.execute(query)",
" connection.commit()\n finally:\n connection.close()"
] | [
1,
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 144,
"char_start": 142,
"chars": "%s"
},
{
"char_end": 237,
"char_start": 232,
"chars": ",data"
}
],
"deleted": [
{
"char_end": 146,
"char_start": 142,
"chars": "'{}'"
},
{
"char_end": 162,
"char_start": 149,
"chars": ".format(data)"
}
]
},
"commit_link": "github.com/sgnab/crime-map-app/commit/209b23bad13594c9cdf18d8788fcba7c8f68d37b",
"file_name": "dbhelper.py",
"func_name": "add_input",
"line_changes": {
"added": [
{
"char_end": 148,
"char_start": 80,
"line": " query = \"INSERT INTO crimes (description) VALUES (%s);\"\n",
"line_no": 5
},
{
"char_end": 239,
"char_start": 196,
"line": " cursor.execute(query,data)\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 163,
"char_start": 80,
"line": " query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n",
"line_no": 5
},
{
"char_end": 249,
"char_start": 211,
"line": " cursor.execute(query)\n",
"line_no": 7
}
]
},
"vul_type": "cwe-089"
} | 324 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def add_input(self,data):\n connection = self.connect()",
" try:",
" query = \"INSERT INTO crimes (description) VALUES (%s);\"",
" with connection.cursor() as cursor:",
" cursor.execute(query,data)",
" connection.commit()\n finally:\n connection.close()"
] | [
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 144,
"char_start": 142,
"chars": "%s"
},
{
"char_end": 237,
"char_start": 232,
"chars": ",data"
}
],
"deleted": [
{
"char_end": 146,
"char_start": 142,
"chars": "'{}'"
},
{
"char_end": 162,
"char_start": 149,
"chars": ".format(data)"
}
]
},
"commit_link": "github.com/sgnab/crime-map-app/commit/209b23bad13594c9cdf18d8788fcba7c8f68d37b",
"file_name": "dbhelper.py",
"func_name": "add_input",
"line_changes": {
"added": [
{
"char_end": 148,
"char_start": 80,
"line": " query = \"INSERT INTO crimes (description) VALUES (%s);\"\n",
"line_no": 5
},
{
"char_end": 239,
"char_start": 196,
"line": " cursor.execute(query,data)\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 163,
"char_start": 80,
"line": " query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n",
"line_no": 5
},
{
"char_end": 249,
"char_start": 211,
"line": " cursor.execute(query)\n",
"line_no": 7
}
]
},
"vul_type": "cwe-089"
} | 324 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def fetch_resultSet(self, session, id):\n self._openContainer(session)",
" sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)",
" query = (\"SELECT class, data FROM %s WHERE identifier = '%s';\" %\n (self.table, sid)",
" )",
" res = self._query(query)",
" try:\n rdict = res.dictresult()[0]\n except IndexError:\n raise ObjectDoesNotExistException('%s/%s' % (self.id, sid))",
" data = rdict['data']\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # Insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")",
" ndata = ndata.replace('\\\\000', '\\x00')\n ndata = ndata.replace('\\\\012', '\\n')\n # data is res.dictresult()\n cl = rdict['class']\n rset = dynamic.buildObject(session, cl, [[]])\n rset.deserialize(session, ndata)\n rset.id = id",
" # Update expires\n now = time.time()\n nowStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(now))\n expires = now + self.get_default(session, 'expires', 600)\n rset.timeExpires = expires\n expiresStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(expires))\n",
" query = (\"UPDATE %s SET timeAccessed = '%s', expires = '%s' \"\n \"WHERE identifier = '%s';\" %\n (self.table, nowStr, expiresStr, sid)",
" )",
" self._query(query)",
" return rset"
] | [
1,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 279,
"char_start": 277,
"chars": "$1"
},
{
"char_end": 369,
"char_start": 364,
"chars": ", sid"
},
{
"char_end": 1338,
"char_start": 1336,
"chars": "$1"
},
{
"char_end": 1352,
"char_start": 1350,
"chars": "$2"
},
{
"char_end": 1394,
"char_start": 1392,
"chars": "$3"
},
{
"char_end": 1481,
"char_start": 1456,
"chars": ", nowStr, expiresStr, sid"
}
],
"deleted": [
{
"char_end": 281,
"char_start": 277,
"chars": "'%s'"
},
{
"char_end": 319,
"char_start": 314,
"chars": ", sid"
},
{
"char_end": 1342,
"char_start": 1338,
"chars": "'%s'"
},
{
"char_end": 1358,
"char_start": 1354,
"chars": "'%s'"
},
{
"char_end": 1402,
"char_start": 1398,
"chars": "'%s'"
},
{
"char_end": 1423,
"char_start": 1406,
"chars": "\n "
},
{
"char_end": 1460,
"char_start": 1435,
"chars": ", nowStr, expiresStr, sid"
}
]
},
"commit_link": "github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e",
"file_name": "cheshire3/sql/resultSetStore.py",
"func_name": "fetch_resultSet",
"line_changes": {
"added": [
{
"char_end": 284,
"char_start": 213,
"line": " query = (\"SELECT class, data FROM %s WHERE identifier = $1;\" %\n",
"line_no": 7
},
{
"char_end": 314,
"char_start": 284,
"line": " (self.table)\n",
"line_no": 8
},
{
"char_end": 371,
"char_start": 333,
"line": " res = self._query(query, sid)\n",
"line_no": 10
},
{
"char_end": 1355,
"char_start": 1289,
"line": " query = (\"UPDATE %s SET timeAccessed = $1, expires = $2 \"\n",
"line_no": 38
},
{
"char_end": 1412,
"char_start": 1355,
"line": " \"WHERE identifier = $3;\" % (self.table)\n",
"line_no": 39
},
{
"char_end": 1483,
"char_start": 1431,
"line": " self._query(query, nowStr, expiresStr, sid)\n",
"line_no": 41
}
],
"deleted": [
{
"char_end": 286,
"char_start": 213,
"line": " query = (\"SELECT class, data FROM %s WHERE identifier = '%s';\" %\n",
"line_no": 7
},
{
"char_end": 321,
"char_start": 286,
"line": " (self.table, sid)\n",
"line_no": 8
},
{
"char_end": 373,
"char_start": 340,
"line": " res = self._query(query)\n",
"line_no": 10
},
{
"char_end": 1361,
"char_start": 1291,
"line": " query = (\"UPDATE %s SET timeAccessed = '%s', expires = '%s' \"\n",
"line_no": 38
},
{
"char_end": 1407,
"char_start": 1361,
"line": " \"WHERE identifier = '%s';\" %\n",
"line_no": 39
},
{
"char_end": 1462,
"char_start": 1407,
"line": " (self.table, nowStr, expiresStr, sid)\n",
"line_no": 40
},
{
"char_end": 1508,
"char_start": 1481,
"line": " self._query(query)\n",
"line_no": 42
}
]
},
"vul_type": "cwe-089"
} | 325 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def fetch_resultSet(self, session, id):\n self._openContainer(session)",
" sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)",
" query = (\"SELECT class, data FROM %s WHERE identifier = $1;\" %\n (self.table)",
" )",
" res = self._query(query, sid)",
" try:\n rdict = res.dictresult()[0]\n except IndexError:\n raise ObjectDoesNotExistException('%s/%s' % (self.id, sid))",
" data = rdict['data']\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # Insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")",
" ndata = ndata.replace('\\\\000', '\\x00')\n ndata = ndata.replace('\\\\012', '\\n')\n # data is res.dictresult()\n cl = rdict['class']\n rset = dynamic.buildObject(session, cl, [[]])\n rset.deserialize(session, ndata)\n rset.id = id",
" # Update expires\n now = time.time()\n nowStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(now))\n expires = now + self.get_default(session, 'expires', 600)\n rset.timeExpires = expires\n expiresStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(expires))\n",
" query = (\"UPDATE %s SET timeAccessed = $1, expires = $2 \"\n \"WHERE identifier = $3;\" % (self.table)",
" )",
" self._query(query, nowStr, expiresStr, sid)",
" return rset"
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 279,
"char_start": 277,
"chars": "$1"
},
{
"char_end": 369,
"char_start": 364,
"chars": ", sid"
},
{
"char_end": 1338,
"char_start": 1336,
"chars": "$1"
},
{
"char_end": 1352,
"char_start": 1350,
"chars": "$2"
},
{
"char_end": 1394,
"char_start": 1392,
"chars": "$3"
},
{
"char_end": 1481,
"char_start": 1456,
"chars": ", nowStr, expiresStr, sid"
}
],
"deleted": [
{
"char_end": 281,
"char_start": 277,
"chars": "'%s'"
},
{
"char_end": 319,
"char_start": 314,
"chars": ", sid"
},
{
"char_end": 1342,
"char_start": 1338,
"chars": "'%s'"
},
{
"char_end": 1358,
"char_start": 1354,
"chars": "'%s'"
},
{
"char_end": 1402,
"char_start": 1398,
"chars": "'%s'"
},
{
"char_end": 1423,
"char_start": 1406,
"chars": "\n "
},
{
"char_end": 1460,
"char_start": 1435,
"chars": ", nowStr, expiresStr, sid"
}
]
},
"commit_link": "github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e",
"file_name": "cheshire3/sql/resultSetStore.py",
"func_name": "fetch_resultSet",
"line_changes": {
"added": [
{
"char_end": 284,
"char_start": 213,
"line": " query = (\"SELECT class, data FROM %s WHERE identifier = $1;\" %\n",
"line_no": 7
},
{
"char_end": 314,
"char_start": 284,
"line": " (self.table)\n",
"line_no": 8
},
{
"char_end": 371,
"char_start": 333,
"line": " res = self._query(query, sid)\n",
"line_no": 10
},
{
"char_end": 1355,
"char_start": 1289,
"line": " query = (\"UPDATE %s SET timeAccessed = $1, expires = $2 \"\n",
"line_no": 38
},
{
"char_end": 1412,
"char_start": 1355,
"line": " \"WHERE identifier = $3;\" % (self.table)\n",
"line_no": 39
},
{
"char_end": 1483,
"char_start": 1431,
"line": " self._query(query, nowStr, expiresStr, sid)\n",
"line_no": 41
}
],
"deleted": [
{
"char_end": 286,
"char_start": 213,
"line": " query = (\"SELECT class, data FROM %s WHERE identifier = '%s';\" %\n",
"line_no": 7
},
{
"char_end": 321,
"char_start": 286,
"line": " (self.table, sid)\n",
"line_no": 8
},
{
"char_end": 373,
"char_start": 340,
"line": " res = self._query(query)\n",
"line_no": 10
},
{
"char_end": 1361,
"char_start": 1291,
"line": " query = (\"UPDATE %s SET timeAccessed = '%s', expires = '%s' \"\n",
"line_no": 38
},
{
"char_end": 1407,
"char_start": 1361,
"line": " \"WHERE identifier = '%s';\" %\n",
"line_no": 39
},
{
"char_end": 1462,
"char_start": 1407,
"line": " (self.table, nowStr, expiresStr, sid)\n",
"line_no": 40
},
{
"char_end": 1508,
"char_start": 1481,
"line": " self._query(query)\n",
"line_no": 42
}
]
},
"vul_type": "cwe-089"
} | 325 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def init_user(username, chat_id):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor.execute(\"CREATE TABLE result (problem INTEGER, diff STRING, verdict STRING)\")\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n x = cursor2.fetchone()",
" url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")",
" for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))",
"\n old = \"\"",
" r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try = soup.find(attrs={\"class\":\"status-small\"})\n if not last_try == None:\n last_try = str(last_try).split()\n last_try = str(last_try[2]) + str(last_try[3])",
" for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1",
" cursor.execute(\"select * from result where problem = '\" + s[3] + \"'and diff = '\" + s[4] + \"'\")",
" x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:",
" cursor.execute(\"update result set verdict = '\" + s2[1] + \"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")",
" if x != None and x[2] != 'OK':",
" cursor.execute(\"update result set verdict = '\" + s2[1] +\"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")\n",
" conn.commit()\n conn.close()\n conn2.close()",
"",
" settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from last_update_problemset\")\n last_problem = conn.fetchone()",
" conn.execute(\"select * from users where chat_id = '\" + str(chat_id) + \"'\")",
" x = conn.fetchone()\n if x == None:\n conn.execute(\"insert into users values (?, ?, ?, ?, ?)\", (chat_id, username, str(last_try), str(last_problem[0]), 1))\n else:",
" conn.execute(\"update users set username = '\" + str(username) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_update = '\" + str(last_try) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_problem = '\" + str(last_problem[0]) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set state = '\" + str(1) + \"' where chat_id = '\" + str(chat_id) + \"'\")",
" settings.commit()\n settings.close()"
] | [
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1859,
"char_start": 1858,
"chars": "?"
},
{
"char_end": 1872,
"char_start": 1871,
"chars": "?"
},
{
"char_end": 1874,
"char_start": 1873,
"chars": ","
},
{
"char_end": 1881,
"char_start": 1875,
"chars": "(s[3],"
},
{
"char_end": 1887,
"char_start": 1886,
"chars": ")"
},
{
"char_end": 2052,
"char_start": 2051,
"chars": "?"
},
{
"char_end": 2070,
"char_start": 2069,
"chars": "?"
},
{
"char_end": 2083,
"char_start": 2082,
"chars": "?"
},
{
"char_end": 2085,
"char_start": 2084,
"chars": ","
},
{
"char_end": 2087,
"char_start": 2086,
"chars": "("
},
{
"char_end": 2089,
"char_start": 2088,
"chars": "2"
},
{
"char_end": 2091,
"char_start": 2090,
"chars": "1"
},
{
"char_end": 2093,
"char_start": 2092,
"chars": ","
},
{
"char_end": 2099,
"char_start": 2094,
"chars": "s[3],"
},
{
"char_end": 2105,
"char_start": 2100,
"chars": "s[4])"
},
{
"char_end": 2227,
"char_start": 2226,
"chars": "?"
},
{
"char_end": 2245,
"char_start": 2244,
"chars": "?"
},
{
"char_end": 2258,
"char_start": 2257,
"chars": "?"
},
{
"char_end": 2260,
"char_start": 2259,
"chars": ","
},
{
"char_end": 2262,
"char_start": 2261,
"chars": "("
},
{
"char_end": 2264,
"char_start": 2263,
"chars": "2"
},
{
"char_end": 2266,
"char_start": 2265,
"chars": "1"
},
{
"char_end": 2268,
"char_start": 2267,
"chars": ","
},
{
"char_end": 2274,
"char_start": 2269,
"chars": "s[3],"
},
{
"char_end": 2279,
"char_start": 2275,
"chars": "s[4]"
},
{
"char_end": 2281,
"char_start": 2280,
"chars": ")"
},
{
"char_end": 2604,
"char_start": 2603,
"chars": "?"
},
{
"char_end": 2606,
"char_start": 2605,
"chars": ","
},
{
"char_end": 2608,
"char_start": 2607,
"chars": "("
},
{
"char_end": 2622,
"char_start": 2620,
"chars": ",)"
},
{
"char_end": 2853,
"char_start": 2852,
"chars": "?"
},
{
"char_end": 2871,
"char_start": 2870,
"chars": "?"
},
{
"char_end": 2873,
"char_start": 2872,
"chars": ","
},
{
"char_end": 2889,
"char_start": 2874,
"chars": "(str(username),"
},
{
"char_end": 2903,
"char_start": 2902,
"chars": ")"
},
{
"char_end": 2959,
"char_start": 2958,
"chars": "?"
},
{
"char_end": 2977,
"char_start": 2976,
"chars": "?"
},
{
"char_end": 2979,
"char_start": 2978,
"chars": ","
},
{
"char_end": 2995,
"char_start": 2980,
"chars": "(str(last_try),"
},
{
"char_end": 3009,
"char_start": 3008,
"chars": ")"
},
{
"char_end": 3084,
"char_start": 3065,
"chars": "? where chat_id = ?"
},
{
"char_end": 3086,
"char_start": 3085,
"chars": ","
},
{
"char_end": 3088,
"char_start": 3087,
"chars": "("
},
{
"char_end": 3109,
"char_start": 3108,
"chars": ","
},
{
"char_end": 3123,
"char_start": 3122,
"chars": ")"
},
{
"char_end": 3173,
"char_start": 3172,
"chars": "?"
},
{
"char_end": 3191,
"char_start": 3190,
"chars": "?"
},
{
"char_end": 3193,
"char_start": 3192,
"chars": ","
},
{
"char_end": 3202,
"char_start": 3194,
"chars": "(str(1),"
},
{
"char_end": 3216,
"char_start": 3215,
"chars": ")"
}
],
"deleted": [
{
"char_end": 907,
"char_start": 893,
"chars": "\n old = \"\"\n"
},
{
"char_end": 1883,
"char_start": 1872,
"chars": "'\" + s[3] +"
},
{
"char_end": 1886,
"char_start": 1884,
"chars": "\"'"
},
{
"char_end": 1898,
"char_start": 1897,
"chars": "'"
},
{
"char_end": 1901,
"char_start": 1900,
"chars": "+"
},
{
"char_end": 1912,
"char_start": 1906,
"chars": " + \"'\""
},
{
"char_end": 2091,
"char_start": 2076,
"chars": "'\" + s2[1] + \"'"
},
{
"char_end": 2122,
"char_start": 2108,
"chars": "'\" + s[3] + \"'"
},
{
"char_end": 2135,
"char_start": 2134,
"chars": "'"
},
{
"char_end": 2138,
"char_start": 2137,
"chars": "+"
},
{
"char_end": 2149,
"char_start": 2143,
"chars": " + \"'\""
},
{
"char_end": 2284,
"char_start": 2270,
"chars": "'\" + s2[1] +\"'"
},
{
"char_end": 2315,
"char_start": 2301,
"chars": "'\" + s[3] + \"'"
},
{
"char_end": 2328,
"char_start": 2327,
"chars": "'"
},
{
"char_end": 2331,
"char_start": 2330,
"chars": "+"
},
{
"char_end": 2342,
"char_start": 2336,
"chars": " + \"'\""
},
{
"char_end": 2344,
"char_start": 2343,
"chars": "\n"
},
{
"char_end": 2399,
"char_start": 2398,
"chars": "\n"
},
{
"char_end": 2668,
"char_start": 2667,
"chars": "'"
},
{
"char_end": 2671,
"char_start": 2669,
"chars": " +"
},
{
"char_end": 2690,
"char_start": 2684,
"chars": " + \"'\""
},
{
"char_end": 2943,
"char_start": 2920,
"chars": "'\" + str(username) + \"'"
},
{
"char_end": 2961,
"char_start": 2960,
"chars": "'"
},
{
"char_end": 2964,
"char_start": 2963,
"chars": "+"
},
{
"char_end": 2983,
"char_start": 2977,
"chars": " + \"'\""
},
{
"char_end": 3061,
"char_start": 3038,
"chars": "'\" + str(last_try) + \"'"
},
{
"char_end": 3079,
"char_start": 3078,
"chars": "'"
},
{
"char_end": 3082,
"char_start": 3081,
"chars": "+"
},
{
"char_end": 3101,
"char_start": 3095,
"chars": " + \"'\""
},
{
"char_end": 3158,
"char_start": 3157,
"chars": "'"
},
{
"char_end": 3161,
"char_start": 3159,
"chars": " +"
},
{
"char_end": 3208,
"char_start": 3182,
"chars": " + \"' where chat_id = '\" +"
},
{
"char_end": 3227,
"char_start": 3221,
"chars": " + \"'\""
},
{
"char_end": 3292,
"char_start": 3276,
"chars": "'\" + str(1) + \"'"
},
{
"char_end": 3310,
"char_start": 3309,
"chars": "'"
},
{
"char_end": 3313,
"char_start": 3312,
"chars": "+"
},
{
"char_end": 3332,
"char_start": 3326,
"chars": " + \"'\""
}
]
},
"commit_link": "github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90",
"file_name": "bases/createuserbase.py",
"func_name": "init_user",
"line_changes": {
"added": [
{
"char_end": 1889,
"char_start": 1785,
"line": " cursor.execute(\"select * from result where problem = ? and diff = ?\", (s[3], s[4]))\n",
"line_no": 42
},
{
"char_end": 2107,
"char_start": 1983,
"line": " cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n",
"line_no": 45
},
{
"char_end": 2282,
"char_start": 2158,
"line": " cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n",
"line_no": 47
},
{
"char_end": 2624,
"char_start": 2549,
"line": " conn.execute(\"select * from users where chat_id = ?\", (str(chat_id),))\n",
"line_no": 55
},
{
"char_end": 2905,
"char_start": 2802,
"line": " conn.execute(\"update users set username = ? where chat_id = ?\", (str(username), str(chat_id)))\n",
"line_no": 60
},
{
"char_end": 3011,
"char_start": 2905,
"line": " conn.execute(\"update users set last_update = ? where chat_id = ?\", (str(last_try), str(chat_id)))\n",
"line_no": 61
},
{
"char_end": 3125,
"char_start": 3011,
"line": " conn.execute(\"update users set last_problem = ? where chat_id = ?\", (str(last_problem[0]), str(chat_id)))\n",
"line_no": 62
},
{
"char_end": 3218,
"char_start": 3125,
"line": " conn.execute(\"update users set state = ? where chat_id = ?\", (str(1), str(chat_id)))\n",
"line_no": 63
}
],
"deleted": [
{
"char_end": 894,
"char_start": 893,
"line": "\n",
"line_no": 22
},
{
"char_end": 907,
"char_start": 894,
"line": " old = \"\"\n",
"line_no": 23
},
{
"char_end": 1914,
"char_start": 1799,
"line": " cursor.execute(\"select * from result where problem = '\" + s[3] + \"'and diff = '\" + s[4] + \"'\")\n",
"line_no": 44
},
{
"char_end": 2151,
"char_start": 2008,
"line": " cursor.execute(\"update result set verdict = '\" + s2[1] + \"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")\n",
"line_no": 47
},
{
"char_end": 2344,
"char_start": 2202,
"line": " cursor.execute(\"update result set verdict = '\" + s2[1] +\"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")\n",
"line_no": 49
},
{
"char_end": 2345,
"char_start": 2344,
"line": "\n",
"line_no": 50
},
{
"char_end": 2399,
"char_start": 2398,
"line": "\n",
"line_no": 54
},
{
"char_end": 2692,
"char_start": 2613,
"line": " conn.execute(\"select * from users where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 59
},
{
"char_end": 2985,
"char_start": 2870,
"line": " conn.execute(\"update users set username = '\" + str(username) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 64
},
{
"char_end": 3103,
"char_start": 2985,
"line": " conn.execute(\"update users set last_update = '\" + str(last_try) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 65
},
{
"char_end": 3229,
"char_start": 3103,
"line": " conn.execute(\"update users set last_problem = '\" + str(last_problem[0]) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 66
},
{
"char_end": 3334,
"char_start": 3229,
"line": " conn.execute(\"update users set state = '\" + str(1) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 67
}
]
},
"vul_type": "cwe-089"
} | 326 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def init_user(username, chat_id):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor.execute(\"CREATE TABLE result (problem INTEGER, diff STRING, verdict STRING)\")\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n x = cursor2.fetchone()",
" url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")",
" for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))",
"",
" r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try = soup.find(attrs={\"class\":\"status-small\"})\n if not last_try == None:\n last_try = str(last_try).split()\n last_try = str(last_try[2]) + str(last_try[3])",
" for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1",
" cursor.execute(\"select * from result where problem = ? and diff = ?\", (s[3], s[4]))",
" x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:",
" cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))",
" if x != None and x[2] != 'OK':",
" cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))",
" conn.commit()\n conn.close()\n conn2.close()",
"",
" settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from last_update_problemset\")\n last_problem = conn.fetchone()",
" conn.execute(\"select * from users where chat_id = ?\", (str(chat_id),))",
" x = conn.fetchone()\n if x == None:\n conn.execute(\"insert into users values (?, ?, ?, ?, ?)\", (chat_id, username, str(last_try), str(last_problem[0]), 1))\n else:",
" conn.execute(\"update users set username = ? where chat_id = ?\", (str(username), str(chat_id)))\n conn.execute(\"update users set last_update = ? where chat_id = ?\", (str(last_try), str(chat_id)))\n conn.execute(\"update users set last_problem = ? where chat_id = ?\", (str(last_problem[0]), str(chat_id)))\n conn.execute(\"update users set state = ? where chat_id = ?\", (str(1), str(chat_id)))",
" settings.commit()\n settings.close()"
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1859,
"char_start": 1858,
"chars": "?"
},
{
"char_end": 1872,
"char_start": 1871,
"chars": "?"
},
{
"char_end": 1874,
"char_start": 1873,
"chars": ","
},
{
"char_end": 1881,
"char_start": 1875,
"chars": "(s[3],"
},
{
"char_end": 1887,
"char_start": 1886,
"chars": ")"
},
{
"char_end": 2052,
"char_start": 2051,
"chars": "?"
},
{
"char_end": 2070,
"char_start": 2069,
"chars": "?"
},
{
"char_end": 2083,
"char_start": 2082,
"chars": "?"
},
{
"char_end": 2085,
"char_start": 2084,
"chars": ","
},
{
"char_end": 2087,
"char_start": 2086,
"chars": "("
},
{
"char_end": 2089,
"char_start": 2088,
"chars": "2"
},
{
"char_end": 2091,
"char_start": 2090,
"chars": "1"
},
{
"char_end": 2093,
"char_start": 2092,
"chars": ","
},
{
"char_end": 2099,
"char_start": 2094,
"chars": "s[3],"
},
{
"char_end": 2105,
"char_start": 2100,
"chars": "s[4])"
},
{
"char_end": 2227,
"char_start": 2226,
"chars": "?"
},
{
"char_end": 2245,
"char_start": 2244,
"chars": "?"
},
{
"char_end": 2258,
"char_start": 2257,
"chars": "?"
},
{
"char_end": 2260,
"char_start": 2259,
"chars": ","
},
{
"char_end": 2262,
"char_start": 2261,
"chars": "("
},
{
"char_end": 2264,
"char_start": 2263,
"chars": "2"
},
{
"char_end": 2266,
"char_start": 2265,
"chars": "1"
},
{
"char_end": 2268,
"char_start": 2267,
"chars": ","
},
{
"char_end": 2274,
"char_start": 2269,
"chars": "s[3],"
},
{
"char_end": 2279,
"char_start": 2275,
"chars": "s[4]"
},
{
"char_end": 2281,
"char_start": 2280,
"chars": ")"
},
{
"char_end": 2604,
"char_start": 2603,
"chars": "?"
},
{
"char_end": 2606,
"char_start": 2605,
"chars": ","
},
{
"char_end": 2608,
"char_start": 2607,
"chars": "("
},
{
"char_end": 2622,
"char_start": 2620,
"chars": ",)"
},
{
"char_end": 2853,
"char_start": 2852,
"chars": "?"
},
{
"char_end": 2871,
"char_start": 2870,
"chars": "?"
},
{
"char_end": 2873,
"char_start": 2872,
"chars": ","
},
{
"char_end": 2889,
"char_start": 2874,
"chars": "(str(username),"
},
{
"char_end": 2903,
"char_start": 2902,
"chars": ")"
},
{
"char_end": 2959,
"char_start": 2958,
"chars": "?"
},
{
"char_end": 2977,
"char_start": 2976,
"chars": "?"
},
{
"char_end": 2979,
"char_start": 2978,
"chars": ","
},
{
"char_end": 2995,
"char_start": 2980,
"chars": "(str(last_try),"
},
{
"char_end": 3009,
"char_start": 3008,
"chars": ")"
},
{
"char_end": 3084,
"char_start": 3065,
"chars": "? where chat_id = ?"
},
{
"char_end": 3086,
"char_start": 3085,
"chars": ","
},
{
"char_end": 3088,
"char_start": 3087,
"chars": "("
},
{
"char_end": 3109,
"char_start": 3108,
"chars": ","
},
{
"char_end": 3123,
"char_start": 3122,
"chars": ")"
},
{
"char_end": 3173,
"char_start": 3172,
"chars": "?"
},
{
"char_end": 3191,
"char_start": 3190,
"chars": "?"
},
{
"char_end": 3193,
"char_start": 3192,
"chars": ","
},
{
"char_end": 3202,
"char_start": 3194,
"chars": "(str(1),"
},
{
"char_end": 3216,
"char_start": 3215,
"chars": ")"
}
],
"deleted": [
{
"char_end": 907,
"char_start": 893,
"chars": "\n old = \"\"\n"
},
{
"char_end": 1883,
"char_start": 1872,
"chars": "'\" + s[3] +"
},
{
"char_end": 1886,
"char_start": 1884,
"chars": "\"'"
},
{
"char_end": 1898,
"char_start": 1897,
"chars": "'"
},
{
"char_end": 1901,
"char_start": 1900,
"chars": "+"
},
{
"char_end": 1912,
"char_start": 1906,
"chars": " + \"'\""
},
{
"char_end": 2091,
"char_start": 2076,
"chars": "'\" + s2[1] + \"'"
},
{
"char_end": 2122,
"char_start": 2108,
"chars": "'\" + s[3] + \"'"
},
{
"char_end": 2135,
"char_start": 2134,
"chars": "'"
},
{
"char_end": 2138,
"char_start": 2137,
"chars": "+"
},
{
"char_end": 2149,
"char_start": 2143,
"chars": " + \"'\""
},
{
"char_end": 2284,
"char_start": 2270,
"chars": "'\" + s2[1] +\"'"
},
{
"char_end": 2315,
"char_start": 2301,
"chars": "'\" + s[3] + \"'"
},
{
"char_end": 2328,
"char_start": 2327,
"chars": "'"
},
{
"char_end": 2331,
"char_start": 2330,
"chars": "+"
},
{
"char_end": 2342,
"char_start": 2336,
"chars": " + \"'\""
},
{
"char_end": 2344,
"char_start": 2343,
"chars": "\n"
},
{
"char_end": 2399,
"char_start": 2398,
"chars": "\n"
},
{
"char_end": 2668,
"char_start": 2667,
"chars": "'"
},
{
"char_end": 2671,
"char_start": 2669,
"chars": " +"
},
{
"char_end": 2690,
"char_start": 2684,
"chars": " + \"'\""
},
{
"char_end": 2943,
"char_start": 2920,
"chars": "'\" + str(username) + \"'"
},
{
"char_end": 2961,
"char_start": 2960,
"chars": "'"
},
{
"char_end": 2964,
"char_start": 2963,
"chars": "+"
},
{
"char_end": 2983,
"char_start": 2977,
"chars": " + \"'\""
},
{
"char_end": 3061,
"char_start": 3038,
"chars": "'\" + str(last_try) + \"'"
},
{
"char_end": 3079,
"char_start": 3078,
"chars": "'"
},
{
"char_end": 3082,
"char_start": 3081,
"chars": "+"
},
{
"char_end": 3101,
"char_start": 3095,
"chars": " + \"'\""
},
{
"char_end": 3158,
"char_start": 3157,
"chars": "'"
},
{
"char_end": 3161,
"char_start": 3159,
"chars": " +"
},
{
"char_end": 3208,
"char_start": 3182,
"chars": " + \"' where chat_id = '\" +"
},
{
"char_end": 3227,
"char_start": 3221,
"chars": " + \"'\""
},
{
"char_end": 3292,
"char_start": 3276,
"chars": "'\" + str(1) + \"'"
},
{
"char_end": 3310,
"char_start": 3309,
"chars": "'"
},
{
"char_end": 3313,
"char_start": 3312,
"chars": "+"
},
{
"char_end": 3332,
"char_start": 3326,
"chars": " + \"'\""
}
]
},
"commit_link": "github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90",
"file_name": "bases/createuserbase.py",
"func_name": "init_user",
"line_changes": {
"added": [
{
"char_end": 1889,
"char_start": 1785,
"line": " cursor.execute(\"select * from result where problem = ? and diff = ?\", (s[3], s[4]))\n",
"line_no": 42
},
{
"char_end": 2107,
"char_start": 1983,
"line": " cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n",
"line_no": 45
},
{
"char_end": 2282,
"char_start": 2158,
"line": " cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n",
"line_no": 47
},
{
"char_end": 2624,
"char_start": 2549,
"line": " conn.execute(\"select * from users where chat_id = ?\", (str(chat_id),))\n",
"line_no": 55
},
{
"char_end": 2905,
"char_start": 2802,
"line": " conn.execute(\"update users set username = ? where chat_id = ?\", (str(username), str(chat_id)))\n",
"line_no": 60
},
{
"char_end": 3011,
"char_start": 2905,
"line": " conn.execute(\"update users set last_update = ? where chat_id = ?\", (str(last_try), str(chat_id)))\n",
"line_no": 61
},
{
"char_end": 3125,
"char_start": 3011,
"line": " conn.execute(\"update users set last_problem = ? where chat_id = ?\", (str(last_problem[0]), str(chat_id)))\n",
"line_no": 62
},
{
"char_end": 3218,
"char_start": 3125,
"line": " conn.execute(\"update users set state = ? where chat_id = ?\", (str(1), str(chat_id)))\n",
"line_no": 63
}
],
"deleted": [
{
"char_end": 894,
"char_start": 893,
"line": "\n",
"line_no": 22
},
{
"char_end": 907,
"char_start": 894,
"line": " old = \"\"\n",
"line_no": 23
},
{
"char_end": 1914,
"char_start": 1799,
"line": " cursor.execute(\"select * from result where problem = '\" + s[3] + \"'and diff = '\" + s[4] + \"'\")\n",
"line_no": 44
},
{
"char_end": 2151,
"char_start": 2008,
"line": " cursor.execute(\"update result set verdict = '\" + s2[1] + \"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")\n",
"line_no": 47
},
{
"char_end": 2344,
"char_start": 2202,
"line": " cursor.execute(\"update result set verdict = '\" + s2[1] +\"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")\n",
"line_no": 49
},
{
"char_end": 2345,
"char_start": 2344,
"line": "\n",
"line_no": 50
},
{
"char_end": 2399,
"char_start": 2398,
"line": "\n",
"line_no": 54
},
{
"char_end": 2692,
"char_start": 2613,
"line": " conn.execute(\"select * from users where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 59
},
{
"char_end": 2985,
"char_start": 2870,
"line": " conn.execute(\"update users set username = '\" + str(username) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 64
},
{
"char_end": 3103,
"char_start": 2985,
"line": " conn.execute(\"update users set last_update = '\" + str(last_try) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 65
},
{
"char_end": 3229,
"char_start": 3103,
"line": " conn.execute(\"update users set last_problem = '\" + str(last_problem[0]) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 66
},
{
"char_end": 3334,
"char_start": 3229,
"line": " conn.execute(\"update users set state = '\" + str(1) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n",
"line_no": 67
}
]
},
"vul_type": "cwe-089"
} | 326 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def process_vote(target,action,chan,mask,db,notice,conn):\n if ' ' in target: \n notice('Invalid nick')\n return",
" try: votes2kick = database.get(db,'channels','votekick','chan',chan)\n except: votes2kick = 10\n try: votes2ban = database.get(db,'channels','voteban','chan',chan)\n except: votes2ban = 10",
" if len(target) is 0:\n if action is 'kick': notice('Votes required to kick: {}'.format(votes2kick))\n elif action is 'ban': notice('Votes required to ban: {}'.format(votes2ban))\n return",
" votefinished = False\n global db_ready\n if not db_ready: db_init(db)\n chan = chan.lower()\n target = target.lower()\n voter = user.format_hostmask(mask)",
" voters = db.execute(\"SELECT voters FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target)).fetchone()",
"\n if conn.nick.lower() in target: return \"I dont think so Tim.\"",
" if voters: \n voters = voters[0]\n if voter in voters: \n notice(\"You have already voted.\")\n return\n else:\n voters = '{} {}'.format(voters,voter).strip()\n notice(\"Thank you for your vote!\")\n else: \n voters = voter",
" votecount = len(voters.split(' '))",
" if 'kick' in action: \n votemax = int(votes2kick)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"KICK {} {} :{}\".format(chan, target, \"You have been voted off the island.\"))\n if 'ban' in action:\n votemax = int(votes2ban)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"MODE {} +b {}\".format(chan, user.get_hostmask(target,db)))\n conn.send(\"KICK {} {} :\".format(chan, target, \"You have been voted off the island.\"))\n ",
" if votefinished: db.execute(\"DELETE FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target))",
" else: db.execute(\"insert or replace into votes(chan, action, target, voters, time) values(?,?,?,?,?)\", (chan, action, target, voters, time.time()))\n \n db.commit()\n return (\"Votes to {} {}: {}/{}\".format(action, target, votecount,votemax))"
] | [
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 769,
"char_start": 768,
"chars": "?"
},
{
"char_end": 782,
"char_start": 781,
"chars": "?"
},
{
"char_end": 800,
"char_start": 799,
"chars": "?"
},
{
"char_end": 803,
"char_start": 801,
"chars": ", "
},
{
"char_end": 809,
"char_start": 808,
"chars": " "
},
{
"char_end": 817,
"char_start": 816,
"chars": " "
},
{
"char_end": 1830,
"char_start": 1829,
"chars": "?"
},
{
"char_end": 1843,
"char_start": 1842,
"chars": "?"
},
{
"char_end": 1861,
"char_start": 1860,
"chars": "?"
},
{
"char_end": 1864,
"char_start": 1862,
"chars": ", "
},
{
"char_end": 1870,
"char_start": 1869,
"chars": " "
},
{
"char_end": 1878,
"char_start": 1877,
"chars": " "
}
],
"deleted": [
{
"char_end": 772,
"char_start": 768,
"chars": "'{}'"
},
{
"char_end": 788,
"char_start": 784,
"chars": "'{}'"
},
{
"char_end": 809,
"char_start": 805,
"chars": "'{}'"
},
{
"char_end": 818,
"char_start": 810,
"chars": ".format("
},
{
"char_end": 837,
"char_start": 836,
"chars": ")"
},
{
"char_end": 1847,
"char_start": 1843,
"chars": "'{}'"
},
{
"char_end": 1863,
"char_start": 1859,
"chars": "'{}'"
},
{
"char_end": 1884,
"char_start": 1880,
"chars": "'{}'"
},
{
"char_end": 1893,
"char_start": 1885,
"chars": ".format("
},
{
"char_end": 1912,
"char_start": 1911,
"chars": ")"
}
]
},
"commit_link": "github.com/gstack/uguubot/commit/700ff40be84be88964e61f8ae780564e5862460d",
"file_name": "plugins/vote.py",
"func_name": "process_vote",
"line_changes": {
"added": [
{
"char_end": 836,
"char_start": 707,
"line": " voters = db.execute(\"SELECT voters FROM votes where chan=? and action=? and target like ?\", chan, action, target).fetchone()\n",
"line_no": 22
},
{
"char_end": 1886,
"char_start": 1767,
"line": " if votefinished: db.execute(\"DELETE FROM votes where chan=? and action=? and target like ?\", chan, action, target)\n",
"line_no": 51
}
],
"deleted": [
{
"char_end": 850,
"char_start": 707,
"line": " voters = db.execute(\"SELECT voters FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target)).fetchone()\n",
"line_no": 22
},
{
"char_end": 1914,
"char_start": 1781,
"line": " if votefinished: db.execute(\"DELETE FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target))\n",
"line_no": 51
}
]
},
"vul_type": "cwe-089"
} | 327 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def process_vote(target,action,chan,mask,db,notice,conn):\n if ' ' in target: \n notice('Invalid nick')\n return",
" try: votes2kick = database.get(db,'channels','votekick','chan',chan)\n except: votes2kick = 10\n try: votes2ban = database.get(db,'channels','voteban','chan',chan)\n except: votes2ban = 10",
" if len(target) is 0:\n if action is 'kick': notice('Votes required to kick: {}'.format(votes2kick))\n elif action is 'ban': notice('Votes required to ban: {}'.format(votes2ban))\n return",
" votefinished = False\n global db_ready\n if not db_ready: db_init(db)\n chan = chan.lower()\n target = target.lower()\n voter = user.format_hostmask(mask)",
" voters = db.execute(\"SELECT voters FROM votes where chan=? and action=? and target like ?\", chan, action, target).fetchone()",
"\n if conn.nick.lower() in target: return \"I dont think so Tim.\"",
" if voters: \n voters = voters[0]\n if voter in voters: \n notice(\"You have already voted.\")\n return\n else:\n voters = '{} {}'.format(voters,voter).strip()\n notice(\"Thank you for your vote!\")\n else: \n voters = voter",
" votecount = len(voters.split(' '))",
" if 'kick' in action: \n votemax = int(votes2kick)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"KICK {} {} :{}\".format(chan, target, \"You have been voted off the island.\"))\n if 'ban' in action:\n votemax = int(votes2ban)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"MODE {} +b {}\".format(chan, user.get_hostmask(target,db)))\n conn.send(\"KICK {} {} :\".format(chan, target, \"You have been voted off the island.\"))\n ",
" if votefinished: db.execute(\"DELETE FROM votes where chan=? and action=? and target like ?\", chan, action, target)",
" else: db.execute(\"insert or replace into votes(chan, action, target, voters, time) values(?,?,?,?,?)\", (chan, action, target, voters, time.time()))\n \n db.commit()\n return (\"Votes to {} {}: {}/{}\".format(action, target, votecount,votemax))"
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 769,
"char_start": 768,
"chars": "?"
},
{
"char_end": 782,
"char_start": 781,
"chars": "?"
},
{
"char_end": 800,
"char_start": 799,
"chars": "?"
},
{
"char_end": 803,
"char_start": 801,
"chars": ", "
},
{
"char_end": 809,
"char_start": 808,
"chars": " "
},
{
"char_end": 817,
"char_start": 816,
"chars": " "
},
{
"char_end": 1830,
"char_start": 1829,
"chars": "?"
},
{
"char_end": 1843,
"char_start": 1842,
"chars": "?"
},
{
"char_end": 1861,
"char_start": 1860,
"chars": "?"
},
{
"char_end": 1864,
"char_start": 1862,
"chars": ", "
},
{
"char_end": 1870,
"char_start": 1869,
"chars": " "
},
{
"char_end": 1878,
"char_start": 1877,
"chars": " "
}
],
"deleted": [
{
"char_end": 772,
"char_start": 768,
"chars": "'{}'"
},
{
"char_end": 788,
"char_start": 784,
"chars": "'{}'"
},
{
"char_end": 809,
"char_start": 805,
"chars": "'{}'"
},
{
"char_end": 818,
"char_start": 810,
"chars": ".format("
},
{
"char_end": 837,
"char_start": 836,
"chars": ")"
},
{
"char_end": 1847,
"char_start": 1843,
"chars": "'{}'"
},
{
"char_end": 1863,
"char_start": 1859,
"chars": "'{}'"
},
{
"char_end": 1884,
"char_start": 1880,
"chars": "'{}'"
},
{
"char_end": 1893,
"char_start": 1885,
"chars": ".format("
},
{
"char_end": 1912,
"char_start": 1911,
"chars": ")"
}
]
},
"commit_link": "github.com/gstack/uguubot/commit/700ff40be84be88964e61f8ae780564e5862460d",
"file_name": "plugins/vote.py",
"func_name": "process_vote",
"line_changes": {
"added": [
{
"char_end": 836,
"char_start": 707,
"line": " voters = db.execute(\"SELECT voters FROM votes where chan=? and action=? and target like ?\", chan, action, target).fetchone()\n",
"line_no": 22
},
{
"char_end": 1886,
"char_start": 1767,
"line": " if votefinished: db.execute(\"DELETE FROM votes where chan=? and action=? and target like ?\", chan, action, target)\n",
"line_no": 51
}
],
"deleted": [
{
"char_end": 850,
"char_start": 707,
"line": " voters = db.execute(\"SELECT voters FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target)).fetchone()\n",
"line_no": 22
},
{
"char_end": 1914,
"char_start": 1781,
"line": " if votefinished: db.execute(\"DELETE FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target))\n",
"line_no": 51
}
]
},
"vul_type": "cwe-089"
} | 327 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@mod.route('/like/<int:msg_id>', methods=['GET', 'POST'])\ndef like(msg_id):\n if request.method == 'GET':\n user_id = session['logged_id']\n c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')",
" sql = \"INSERT INTO like_msg(msg_id, user_id,c_time) \" + \\\n \"VALUES(%d,'%s','%s');\" % (msg_id, user_id, c_time)\n cursor.execute(sql)",
" conn.commit()\n return redirect(url_for('show_entries'))"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 220,
"char_start": 217,
"chars": "cur"
},
{
"char_end": 232,
"char_start": 221,
"chars": "or.execute("
},
{
"char_end": 287,
"char_start": 286,
"chars": "s"
},
{
"char_end": 297,
"char_start": 296,
"chars": ","
}
],
"deleted": [
{
"char_end": 223,
"char_start": 218,
"chars": "ql = "
},
{
"char_end": 292,
"char_start": 269,
"chars": "\" + \\\n \""
},
{
"char_end": 301,
"char_start": 300,
"chars": "d"
},
{
"char_end": 303,
"char_start": 302,
"chars": "'"
},
{
"char_end": 306,
"char_start": 305,
"chars": "'"
},
{
"char_end": 308,
"char_start": 307,
"chars": "'"
},
{
"char_end": 311,
"char_start": 310,
"chars": "'"
},
{
"char_end": 316,
"char_start": 314,
"chars": " %"
},
{
"char_end": 369,
"char_start": 342,
"chars": "\n cursor.execute(sql"
}
]
},
"commit_link": "github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9",
"file_name": "flaskr/flaskr/views/like_msg.py",
"func_name": "like",
"line_changes": {
"added": [
{
"char_end": 325,
"char_start": 209,
"line": " cursor.execute(\"INSERT INTO like_msg(msg_id, user_id,c_time) VALUES(%s,%s,%s);\", (msg_id, user_id, c_time))\n",
"line_no": 6
}
],
"deleted": [
{
"char_end": 275,
"char_start": 209,
"line": " sql = \"INSERT INTO like_msg(msg_id, user_id,c_time) \" + \\\n",
"line_no": 6
},
{
"char_end": 343,
"char_start": 275,
"line": " \"VALUES(%d,'%s','%s');\" % (msg_id, user_id, c_time)\n",
"line_no": 7
},
{
"char_end": 371,
"char_start": 343,
"line": " cursor.execute(sql)\n",
"line_no": 8
}
]
},
"vul_type": "cwe-089"
} | 328 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@mod.route('/like/<int:msg_id>', methods=['GET', 'POST'])\ndef like(msg_id):\n if request.method == 'GET':\n user_id = session['logged_id']\n 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_time))",
" conn.commit()\n return redirect(url_for('show_entries'))"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 220,
"char_start": 217,
"chars": "cur"
},
{
"char_end": 232,
"char_start": 221,
"chars": "or.execute("
},
{
"char_end": 287,
"char_start": 286,
"chars": "s"
},
{
"char_end": 297,
"char_start": 296,
"chars": ","
}
],
"deleted": [
{
"char_end": 223,
"char_start": 218,
"chars": "ql = "
},
{
"char_end": 292,
"char_start": 269,
"chars": "\" + \\\n \""
},
{
"char_end": 301,
"char_start": 300,
"chars": "d"
},
{
"char_end": 303,
"char_start": 302,
"chars": "'"
},
{
"char_end": 306,
"char_start": 305,
"chars": "'"
},
{
"char_end": 308,
"char_start": 307,
"chars": "'"
},
{
"char_end": 311,
"char_start": 310,
"chars": "'"
},
{
"char_end": 316,
"char_start": 314,
"chars": " %"
},
{
"char_end": 369,
"char_start": 342,
"chars": "\n cursor.execute(sql"
}
]
},
"commit_link": "github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9",
"file_name": "flaskr/flaskr/views/like_msg.py",
"func_name": "like",
"line_changes": {
"added": [
{
"char_end": 325,
"char_start": 209,
"line": " cursor.execute(\"INSERT INTO like_msg(msg_id, user_id,c_time) VALUES(%s,%s,%s);\", (msg_id, user_id, c_time))\n",
"line_no": 6
}
],
"deleted": [
{
"char_end": 275,
"char_start": 209,
"line": " sql = \"INSERT INTO like_msg(msg_id, user_id,c_time) \" + \\\n",
"line_no": 6
},
{
"char_end": 343,
"char_start": 275,
"line": " \"VALUES(%d,'%s','%s');\" % (msg_id, user_id, c_time)\n",
"line_no": 7
},
{
"char_end": 371,
"char_start": 343,
"line": " cursor.execute(sql)\n",
"line_no": 8
}
]
},
"vul_type": "cwe-089"
} | 328 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def tag_to_tag_num(self, tag):\n ''' Returns tag_num given tag. '''\n",
" q = \"SELECT rowid FROM tags WHERE tag = '\" + tag + \"'\"\n self.query(q)",
" return self.c.fetchone()[0]"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 128,
"char_start": 127,
"chars": "?"
},
{
"char_end": 155,
"char_start": 150,
"chars": ", tag"
}
],
"deleted": [
{
"char_end": 140,
"char_start": 127,
"chars": "'\" + tag + \"'"
}
]
},
"commit_link": "github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b",
"file_name": "modules/query_lastfm.py",
"func_name": "tag_to_tag_num",
"line_changes": {
"added": [
{
"char_end": 130,
"char_start": 79,
"line": " q = \"SELECT rowid FROM tags WHERE tag = ?\"\n",
"line_no": 4
},
{
"char_end": 157,
"char_start": 130,
"line": " self.query(q, tag)\n",
"line_no": 5
}
],
"deleted": [
{
"char_end": 142,
"char_start": 79,
"line": " q = \"SELECT rowid FROM tags WHERE tag = '\" + tag + \"'\"\n",
"line_no": 4
},
{
"char_end": 164,
"char_start": 142,
"line": " self.query(q)\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 329 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def tag_to_tag_num(self, tag):\n ''' Returns tag_num given tag. '''\n",
" q = \"SELECT rowid FROM tags WHERE tag = ?\"\n self.query(q, tag)",
" return self.c.fetchone()[0]"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 128,
"char_start": 127,
"chars": "?"
},
{
"char_end": 155,
"char_start": 150,
"chars": ", tag"
}
],
"deleted": [
{
"char_end": 140,
"char_start": 127,
"chars": "'\" + tag + \"'"
}
]
},
"commit_link": "github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b",
"file_name": "modules/query_lastfm.py",
"func_name": "tag_to_tag_num",
"line_changes": {
"added": [
{
"char_end": 130,
"char_start": 79,
"line": " q = \"SELECT rowid FROM tags WHERE tag = ?\"\n",
"line_no": 4
},
{
"char_end": 157,
"char_start": 130,
"line": " self.query(q, tag)\n",
"line_no": 5
}
],
"deleted": [
{
"char_end": 142,
"char_start": 79,
"line": " q = \"SELECT rowid FROM tags WHERE tag = '\" + tag + \"'\"\n",
"line_no": 4
},
{
"char_end": 164,
"char_start": 142,
"line": " self.query(q)\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 329 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):\n \"\"\"\n Get all current sources and title numbers from Solr and log them into database.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_sourcebyinstitutions = get_all_old_sourcebyinstitutions(conn, sqlite)\n current_sourcebyinstitutions = []",
" for source in current_sources:",
" for institution in current_institutions:",
" if not institution or institution == \" \" or '\"' in institution:\n continue",
" sourcebyinstitution = \"SID \" + str(source) + \" (\" + institution + \")\"\n current_sourcebyinstitutions.append(sourcebyinstitution)",
" params = {\n \"q\": 'source_id:%s AND institution:\"%s\"' % (source, institution),\n \"rows\": 0,\n \"wt\": \"json\"\n }",
" # check k10plus\n result = get_solr_result(k10plus, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:",
" sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n sqlite.execute(sql)",
" conn.commit()\n else:\n # check ai\n result = get_solr_result(ai, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n # TODO: escape via sqlite",
" sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n sqlite.execute(sql)",
" conn.commit()",
" if sourcebyinstitution not in old_sourcebyinstitutions:\n logging.info(\"The %s is now connected to SID %s.\", institution, source)",
" sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES ('%s')\" % sourcebyinstitution\n sqlite.execute(sql)",
" conn.commit()",
" if number != 0:\n old_sourcebyinstitution_number = get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution)\n if number < old_sourcebyinstitution_number:\n message = \"Die Anzahl der Titel hat sich bei %s gegenueber einem frueheren Import verringert.\" % (sourcebyinstitution)\n send_message(message)",
" # requests.exceptions.ConnectionError: HTTPConnectionPool(XXXXXX): Max retries exceeded\n time.sleep(0.25)",
" for old_sourcebyinstitution in old_sourcebyinstitutions:\n if old_sourcebyinstitution not in current_sourcebyinstitutions:\n message = \"Die %s ist nicht laenger für die SID %s angesigelt.\" % (institution, source)\n send_message(message)"
] | [
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1176,
"char_start": 1175,
"chars": "?"
},
{
"char_end": 1179,
"char_start": 1178,
"chars": "?"
},
{
"char_end": 1247,
"char_start": 1216,
"chars": ", (sourcebyinstitution, number)"
},
{
"char_end": 1597,
"char_start": 1596,
"chars": "?"
},
{
"char_end": 1600,
"char_start": 1599,
"chars": "?"
},
{
"char_end": 1672,
"char_start": 1641,
"chars": ", (sourcebyinstitution, number)"
},
{
"char_end": 1951,
"char_start": 1950,
"chars": "?"
},
{
"char_end": 2011,
"char_start": 1988,
"chars": ", (sourcebyinstitution)"
}
],
"deleted": [
{
"char_end": 1179,
"char_start": 1175,
"chars": "\"%s\""
},
{
"char_end": 1183,
"char_start": 1181,
"chars": "%s"
},
{
"char_end": 1217,
"char_start": 1185,
"chars": " % (sourcebyinstitution, number)"
},
{
"char_end": 1605,
"char_start": 1601,
"chars": "\"%s\""
},
{
"char_end": 1609,
"char_start": 1607,
"chars": "%s"
},
{
"char_end": 1643,
"char_start": 1611,
"chars": " % (sourcebyinstitution, number)"
},
{
"char_end": 1964,
"char_start": 1960,
"chars": "'%s'"
},
{
"char_end": 1988,
"char_start": 1966,
"chars": " % sourcebyinstitution"
}
]
},
"commit_link": "github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a",
"file_name": "bin/solrcheckup.py",
"func_name": "update_history_and_sourcebyinstitution",
"line_changes": {
"added": [
{
"char_end": 1182,
"char_start": 1094,
"line": " sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n",
"line_no": 30
},
{
"char_end": 1249,
"char_start": 1182,
"line": " sqlite.execute(sql, (sourcebyinstitution, number))\n",
"line_no": 31
},
{
"char_end": 1603,
"char_start": 1511,
"line": " sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n",
"line_no": 39
},
{
"char_end": 1674,
"char_start": 1603,
"line": " sqlite.execute(sql, (sourcebyinstitution, number))\n",
"line_no": 40
},
{
"char_end": 1954,
"char_start": 1865,
"line": " sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES (?)\"\n",
"line_no": 45
},
{
"char_end": 2013,
"char_start": 1954,
"line": " sqlite.execute(sql, (sourcebyinstitution))\n",
"line_no": 46
}
],
"deleted": [
{
"char_end": 1218,
"char_start": 1094,
"line": " sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n",
"line_no": 30
},
{
"char_end": 1254,
"char_start": 1218,
"line": " sqlite.execute(sql)\n",
"line_no": 31
},
{
"char_end": 1644,
"char_start": 1516,
"line": " sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n",
"line_no": 39
},
{
"char_end": 1684,
"char_start": 1644,
"line": " sqlite.execute(sql)\n",
"line_no": 40
},
{
"char_end": 1989,
"char_start": 1875,
"line": " sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES ('%s')\" % sourcebyinstitution\n",
"line_no": 45
},
{
"char_end": 2025,
"char_start": 1989,
"line": " sqlite.execute(sql)\n",
"line_no": 46
}
]
},
"vul_type": "cwe-089"
} | 330 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):\n \"\"\"\n Get all current sources and title numbers from Solr and log them into database.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_sourcebyinstitutions = get_all_old_sourcebyinstitutions(conn, sqlite)\n current_sourcebyinstitutions = []",
" for source in current_sources:",
" for institution in current_institutions:",
" if not institution or institution == \" \" or '\"' in institution:\n continue",
" sourcebyinstitution = \"SID \" + str(source) + \" (\" + institution + \")\"\n current_sourcebyinstitutions.append(sourcebyinstitution)",
" params = {\n \"q\": 'source_id:%s AND institution:\"%s\"' % (source, institution),\n \"rows\": 0,\n \"wt\": \"json\"\n }",
" # check k10plus\n result = get_solr_result(k10plus, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:",
" sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n sqlite.execute(sql, (sourcebyinstitution, number))",
" conn.commit()\n else:\n # check ai\n result = get_solr_result(ai, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n # TODO: escape via sqlite",
" sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n sqlite.execute(sql, (sourcebyinstitution, number))",
" conn.commit()",
" if sourcebyinstitution not in old_sourcebyinstitutions:\n logging.info(\"The %s is now connected to SID %s.\", institution, source)",
" sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES (?)\"\n sqlite.execute(sql, (sourcebyinstitution))",
" conn.commit()",
" if number != 0:\n old_sourcebyinstitution_number = get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution)\n if number < old_sourcebyinstitution_number:\n message = \"Die Anzahl der Titel hat sich bei %s gegenueber einem frueheren Import verringert.\" % (sourcebyinstitution)\n send_message(message)",
" # requests.exceptions.ConnectionError: HTTPConnectionPool(XXXXXX): Max retries exceeded\n time.sleep(0.25)",
" for old_sourcebyinstitution in old_sourcebyinstitutions:\n if old_sourcebyinstitution not in current_sourcebyinstitutions:\n message = \"Die %s ist nicht laenger für die SID %s angesigelt.\" % (institution, source)\n send_message(message)"
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1176,
"char_start": 1175,
"chars": "?"
},
{
"char_end": 1179,
"char_start": 1178,
"chars": "?"
},
{
"char_end": 1247,
"char_start": 1216,
"chars": ", (sourcebyinstitution, number)"
},
{
"char_end": 1597,
"char_start": 1596,
"chars": "?"
},
{
"char_end": 1600,
"char_start": 1599,
"chars": "?"
},
{
"char_end": 1672,
"char_start": 1641,
"chars": ", (sourcebyinstitution, number)"
},
{
"char_end": 1951,
"char_start": 1950,
"chars": "?"
},
{
"char_end": 2011,
"char_start": 1988,
"chars": ", (sourcebyinstitution)"
}
],
"deleted": [
{
"char_end": 1179,
"char_start": 1175,
"chars": "\"%s\""
},
{
"char_end": 1183,
"char_start": 1181,
"chars": "%s"
},
{
"char_end": 1217,
"char_start": 1185,
"chars": " % (sourcebyinstitution, number)"
},
{
"char_end": 1605,
"char_start": 1601,
"chars": "\"%s\""
},
{
"char_end": 1609,
"char_start": 1607,
"chars": "%s"
},
{
"char_end": 1643,
"char_start": 1611,
"chars": " % (sourcebyinstitution, number)"
},
{
"char_end": 1964,
"char_start": 1960,
"chars": "'%s'"
},
{
"char_end": 1988,
"char_start": 1966,
"chars": " % sourcebyinstitution"
}
]
},
"commit_link": "github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a",
"file_name": "bin/solrcheckup.py",
"func_name": "update_history_and_sourcebyinstitution",
"line_changes": {
"added": [
{
"char_end": 1182,
"char_start": 1094,
"line": " sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n",
"line_no": 30
},
{
"char_end": 1249,
"char_start": 1182,
"line": " sqlite.execute(sql, (sourcebyinstitution, number))\n",
"line_no": 31
},
{
"char_end": 1603,
"char_start": 1511,
"line": " sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n",
"line_no": 39
},
{
"char_end": 1674,
"char_start": 1603,
"line": " sqlite.execute(sql, (sourcebyinstitution, number))\n",
"line_no": 40
},
{
"char_end": 1954,
"char_start": 1865,
"line": " sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES (?)\"\n",
"line_no": 45
},
{
"char_end": 2013,
"char_start": 1954,
"line": " sqlite.execute(sql, (sourcebyinstitution))\n",
"line_no": 46
}
],
"deleted": [
{
"char_end": 1218,
"char_start": 1094,
"line": " sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n",
"line_no": 30
},
{
"char_end": 1254,
"char_start": 1218,
"line": " sqlite.execute(sql)\n",
"line_no": 31
},
{
"char_end": 1644,
"char_start": 1516,
"line": " sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n",
"line_no": 39
},
{
"char_end": 1684,
"char_start": 1644,
"line": " sqlite.execute(sql)\n",
"line_no": 40
},
{
"char_end": 1989,
"char_start": 1875,
"line": " sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES ('%s')\" % sourcebyinstitution\n",
"line_no": 45
},
{
"char_end": 2025,
"char_start": 1989,
"line": " sqlite.execute(sql)\n",
"line_no": 46
}
]
},
"vul_type": "cwe-089"
} | 330 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def change_message(self, new_message, logged_user):\n update_sql = \"\"\"\n UPDATE Clients",
" SET message = '{}'\n WHERE client_id = '{}'\n \"\"\".format(new_message, logged_user.get_client_id())",
"\n cursor = self.__conn.cursor()\n",
" cursor.execute(update_sql)",
" self.__conn.commit()\n logged_user.set_message(new_message)"
] | [
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 135,
"char_start": 134,
"chars": "?"
},
{
"char_end": 167,
"char_start": 166,
"chars": "?"
},
{
"char_end": 297,
"char_start": 253,
"chars": ", (new_message, logged_user.get_client_id())"
}
],
"deleted": [
{
"char_end": 138,
"char_start": 134,
"chars": "'{}'"
},
{
"char_end": 173,
"char_start": 169,
"chars": "'{}'"
},
{
"char_end": 234,
"char_start": 185,
"chars": ".format(new_message, logged_user.get_client_id())"
}
]
},
"commit_link": "github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3",
"file_name": "Week_9/sql_manager.py",
"func_name": "change_message",
"line_changes": {
"added": [
{
"char_end": 136,
"char_start": 108,
"line": " SET message = ?\n",
"line_no": 4
},
{
"char_end": 168,
"char_start": 136,
"line": " WHERE client_id = ?\n",
"line_no": 5
},
{
"char_end": 180,
"char_start": 168,
"line": " \"\"\"\n",
"line_no": 6
},
{
"char_end": 299,
"char_start": 220,
"line": " cursor.execute(update_sql, (new_message, logged_user.get_client_id()))\n",
"line_no": 10
}
],
"deleted": [
{
"char_end": 139,
"char_start": 108,
"line": " SET message = '{}'\n",
"line_no": 4
},
{
"char_end": 174,
"char_start": 139,
"line": " WHERE client_id = '{}'\n",
"line_no": 5
},
{
"char_end": 235,
"char_start": 174,
"line": " \"\"\".format(new_message, logged_user.get_client_id())\n",
"line_no": 6
},
{
"char_end": 310,
"char_start": 275,
"line": " cursor.execute(update_sql)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-089"
} | 331 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def change_message(self, new_message, logged_user):\n update_sql = \"\"\"\n UPDATE Clients",
" SET message = ?\n WHERE client_id = ?\n \"\"\"",
"\n cursor = self.__conn.cursor()\n",
" cursor.execute(update_sql, (new_message, logged_user.get_client_id()))",
" self.__conn.commit()\n logged_user.set_message(new_message)"
] | [
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 135,
"char_start": 134,
"chars": "?"
},
{
"char_end": 167,
"char_start": 166,
"chars": "?"
},
{
"char_end": 297,
"char_start": 253,
"chars": ", (new_message, logged_user.get_client_id())"
}
],
"deleted": [
{
"char_end": 138,
"char_start": 134,
"chars": "'{}'"
},
{
"char_end": 173,
"char_start": 169,
"chars": "'{}'"
},
{
"char_end": 234,
"char_start": 185,
"chars": ".format(new_message, logged_user.get_client_id())"
}
]
},
"commit_link": "github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3",
"file_name": "Week_9/sql_manager.py",
"func_name": "change_message",
"line_changes": {
"added": [
{
"char_end": 136,
"char_start": 108,
"line": " SET message = ?\n",
"line_no": 4
},
{
"char_end": 168,
"char_start": 136,
"line": " WHERE client_id = ?\n",
"line_no": 5
},
{
"char_end": 180,
"char_start": 168,
"line": " \"\"\"\n",
"line_no": 6
},
{
"char_end": 299,
"char_start": 220,
"line": " cursor.execute(update_sql, (new_message, logged_user.get_client_id()))\n",
"line_no": 10
}
],
"deleted": [
{
"char_end": 139,
"char_start": 108,
"line": " SET message = '{}'\n",
"line_no": 4
},
{
"char_end": 174,
"char_start": 139,
"line": " WHERE client_id = '{}'\n",
"line_no": 5
},
{
"char_end": 235,
"char_start": 174,
"line": " \"\"\".format(new_message, logged_user.get_client_id())\n",
"line_no": 6
},
{
"char_end": 310,
"char_start": 275,
"line": " cursor.execute(update_sql)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-089"
} | 331 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def create_event(self, title, start_time, time_zone, server_id, description):",
" sql = \"\"\"INSERT INTO events (title, start_time, time_zone, server_id, description)\n VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')\n \"\"\".format(title, start_time, time_zone, server_id, description)\n self.cur.execute(sql)",
" self.conn.commit()"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 114,
"char_start": 99,
"chars": "\n "
},
{
"char_end": 212,
"char_start": 210,
"chars": "%s"
},
{
"char_end": 216,
"char_start": 214,
"chars": "%s"
},
{
"char_end": 220,
"char_start": 218,
"chars": "%s"
},
{
"char_end": 224,
"char_start": 222,
"chars": "%s"
},
{
"char_end": 228,
"char_start": 226,
"chars": "%s"
},
{
"char_end": 259,
"char_start": 247,
"chars": "\n sel"
},
{
"char_end": 263,
"char_start": 260,
"chars": ".cu"
},
{
"char_end": 270,
"char_start": 264,
"chars": ".execu"
},
{
"char_end": 278,
"char_start": 271,
"chars": "e(sql, "
}
],
"deleted": [
{
"char_end": 190,
"char_start": 187,
"chars": " "
},
{
"char_end": 203,
"char_start": 198,
"chars": "'{0}'"
},
{
"char_end": 210,
"char_start": 205,
"chars": "'{1}'"
},
{
"char_end": 217,
"char_start": 212,
"chars": "'{2}'"
},
{
"char_end": 224,
"char_start": 219,
"chars": "'{3}'"
},
{
"char_end": 231,
"char_start": 226,
"chars": "'{4}'"
},
{
"char_end": 253,
"char_start": 250,
"chars": "\"\"\""
},
{
"char_end": 256,
"char_start": 254,
"chars": "fo"
},
{
"char_end": 259,
"char_start": 257,
"chars": "ma"
},
{
"char_end": 343,
"char_start": 314,
"chars": "\n self.cur.execute(sql"
}
]
},
"commit_link": "github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799",
"file_name": "db/dbase.py",
"func_name": "create_event",
"line_changes": {
"added": [
{
"char_end": 100,
"char_start": 82,
"line": " sql = \"\"\"\n",
"line_no": 2
},
{
"char_end": 188,
"char_start": 100,
"line": " INSERT INTO events (title, start_time, time_zone, server_id, description)\n",
"line_no": 3
},
{
"char_end": 230,
"char_start": 188,
"line": " VALUES (%s, %s, %s, %s, %s)\n",
"line_no": 4
},
{
"char_end": 248,
"char_start": 230,
"line": " \"\"\"\n",
"line_no": 5
},
{
"char_end": 334,
"char_start": 248,
"line": " self.cur.execute(sql, (title, start_time, time_zone, server_id, description))\n",
"line_no": 6
}
],
"deleted": [
{
"char_end": 173,
"char_start": 82,
"line": " sql = \"\"\"INSERT INTO events (title, start_time, time_zone, server_id, description)\n",
"line_no": 2
},
{
"char_end": 233,
"char_start": 173,
"line": " VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')\n",
"line_no": 3
},
{
"char_end": 315,
"char_start": 233,
"line": " \"\"\".format(title, start_time, time_zone, server_id, description)\n",
"line_no": 4
},
{
"char_end": 345,
"char_start": 315,
"line": " self.cur.execute(sql)\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 332 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def create_event(self, title, start_time, time_zone, server_id, description):",
" sql = \"\"\"\n INSERT INTO events (title, start_time, time_zone, server_id, description)\n VALUES (%s, %s, %s, %s, %s)\n \"\"\"\n self.cur.execute(sql, (title, start_time, time_zone, server_id, description))",
" self.conn.commit()"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 114,
"char_start": 99,
"chars": "\n "
},
{
"char_end": 212,
"char_start": 210,
"chars": "%s"
},
{
"char_end": 216,
"char_start": 214,
"chars": "%s"
},
{
"char_end": 220,
"char_start": 218,
"chars": "%s"
},
{
"char_end": 224,
"char_start": 222,
"chars": "%s"
},
{
"char_end": 228,
"char_start": 226,
"chars": "%s"
},
{
"char_end": 259,
"char_start": 247,
"chars": "\n sel"
},
{
"char_end": 263,
"char_start": 260,
"chars": ".cu"
},
{
"char_end": 270,
"char_start": 264,
"chars": ".execu"
},
{
"char_end": 278,
"char_start": 271,
"chars": "e(sql, "
}
],
"deleted": [
{
"char_end": 190,
"char_start": 187,
"chars": " "
},
{
"char_end": 203,
"char_start": 198,
"chars": "'{0}'"
},
{
"char_end": 210,
"char_start": 205,
"chars": "'{1}'"
},
{
"char_end": 217,
"char_start": 212,
"chars": "'{2}'"
},
{
"char_end": 224,
"char_start": 219,
"chars": "'{3}'"
},
{
"char_end": 231,
"char_start": 226,
"chars": "'{4}'"
},
{
"char_end": 253,
"char_start": 250,
"chars": "\"\"\""
},
{
"char_end": 256,
"char_start": 254,
"chars": "fo"
},
{
"char_end": 259,
"char_start": 257,
"chars": "ma"
},
{
"char_end": 343,
"char_start": 314,
"chars": "\n self.cur.execute(sql"
}
]
},
"commit_link": "github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799",
"file_name": "db/dbase.py",
"func_name": "create_event",
"line_changes": {
"added": [
{
"char_end": 100,
"char_start": 82,
"line": " sql = \"\"\"\n",
"line_no": 2
},
{
"char_end": 188,
"char_start": 100,
"line": " INSERT INTO events (title, start_time, time_zone, server_id, description)\n",
"line_no": 3
},
{
"char_end": 230,
"char_start": 188,
"line": " VALUES (%s, %s, %s, %s, %s)\n",
"line_no": 4
},
{
"char_end": 248,
"char_start": 230,
"line": " \"\"\"\n",
"line_no": 5
},
{
"char_end": 334,
"char_start": 248,
"line": " self.cur.execute(sql, (title, start_time, time_zone, server_id, description))\n",
"line_no": 6
}
],
"deleted": [
{
"char_end": 173,
"char_start": 82,
"line": " sql = \"\"\"INSERT INTO events (title, start_time, time_zone, server_id, description)\n",
"line_no": 2
},
{
"char_end": 233,
"char_start": 173,
"line": " VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')\n",
"line_no": 3
},
{
"char_end": 315,
"char_start": 233,
"line": " \"\"\".format(title, start_time, time_zone, server_id, description)\n",
"line_no": 4
},
{
"char_end": 345,
"char_start": 315,
"line": " self.cur.execute(sql)\n",
"line_no": 5
}
]
},
"vul_type": "cwe-089"
} | 332 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)\ndef get_login2(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n if bases.createuserbase.check_username(message.text):\n bot.send_message(message.chat.id, \"Invalid handle.\")\n set_state(message.chat.id, config.States.S_START.value)\n return 0",
"\n conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")",
" name = conn.fetchone()\n settings.close()\n bases.update.cf_update()\n bases.createuserbase.clean_base(name[1])\n bases.createuserbase.clean_base(message.text)\n bot.send_message(message.chat.id, \"Creating base...\")\n bases.createuserbase.init_user(message.text, message.chat.id)\n bot.send_message(message.chat.id, \"Done!\")\n set_state(message.chat.id, config.States.S_START.value)"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 520,
"char_start": 519,
"chars": "?"
},
{
"char_end": 522,
"char_start": 521,
"chars": ","
},
{
"char_end": 524,
"char_start": 523,
"chars": "("
},
{
"char_end": 546,
"char_start": 544,
"chars": ",)"
}
],
"deleted": [
{
"char_end": 466,
"char_start": 465,
"chars": "\n"
},
{
"char_end": 521,
"char_start": 520,
"chars": "'"
},
{
"char_end": 524,
"char_start": 522,
"chars": " +"
},
{
"char_end": 551,
"char_start": 545,
"chars": " + \"'\""
}
]
},
"commit_link": "github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90",
"file_name": "bot.py",
"func_name": "get_login2",
"line_changes": {
"added": [
{
"char_end": 548,
"char_start": 465,
"line": " conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 466,
"char_start": 465,
"line": "\n",
"line_no": 9
},
{
"char_end": 553,
"char_start": 466,
"line": " conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n",
"line_no": 10
}
]
},
"vul_type": "cwe-089"
} | 333 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)\ndef get_login2(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n if bases.createuserbase.check_username(message.text):\n bot.send_message(message.chat.id, \"Invalid handle.\")\n set_state(message.chat.id, config.States.S_START.value)\n return 0",
" conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))",
" name = conn.fetchone()\n settings.close()\n bases.update.cf_update()\n bases.createuserbase.clean_base(name[1])\n bases.createuserbase.clean_base(message.text)\n bot.send_message(message.chat.id, \"Creating base...\")\n bases.createuserbase.init_user(message.text, message.chat.id)\n bot.send_message(message.chat.id, \"Done!\")\n set_state(message.chat.id, config.States.S_START.value)"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 520,
"char_start": 519,
"chars": "?"
},
{
"char_end": 522,
"char_start": 521,
"chars": ","
},
{
"char_end": 524,
"char_start": 523,
"chars": "("
},
{
"char_end": 546,
"char_start": 544,
"chars": ",)"
}
],
"deleted": [
{
"char_end": 466,
"char_start": 465,
"chars": "\n"
},
{
"char_end": 521,
"char_start": 520,
"chars": "'"
},
{
"char_end": 524,
"char_start": 522,
"chars": " +"
},
{
"char_end": 551,
"char_start": 545,
"chars": " + \"'\""
}
]
},
"commit_link": "github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90",
"file_name": "bot.py",
"func_name": "get_login2",
"line_changes": {
"added": [
{
"char_end": 548,
"char_start": 465,
"line": " conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 466,
"char_start": 465,
"line": "\n",
"line_no": 9
},
{
"char_end": 553,
"char_start": 466,
"line": " conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n",
"line_no": 10
}
]
},
"vul_type": "cwe-089"
} | 333 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_bracket_graph_data(db, tag):\n # First, we have to find out which scenes this player has brackets in",
" sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{}'\".format(tag)\n scenes = db.exec(sql)",
" scenes = [s[0] for s in scenes]",
" bracket_placings_by_scene = {s: get_bracket_placings_in_scene(db, s, tag) for s in scenes}",
" return bracket_placings_by_scene"
] | [
1,
0,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 173,
"char_start": 170,
"chars": "tag"
},
{
"char_end": 182,
"char_start": 176,
"chars": "\n a"
},
{
"char_end": 190,
"char_start": 183,
"chars": "gs = {'"
},
{
"char_end": 196,
"char_start": 191,
"chars": "ag': "
},
{
"char_end": 200,
"char_start": 199,
"chars": "}"
},
{
"char_end": 231,
"char_start": 225,
"chars": ", args"
}
],
"deleted": [
{
"char_end": 176,
"char_start": 173,
"chars": ".fo"
},
{
"char_end": 178,
"char_start": 177,
"chars": "m"
},
{
"char_end": 181,
"char_start": 179,
"chars": "t("
},
{
"char_end": 185,
"char_start": 184,
"chars": ")"
}
]
},
"commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63",
"file_name": "bracket_utils.py",
"func_name": "get_bracket_graph_data",
"line_changes": {
"added": [
{
"char_end": 177,
"char_start": 111,
"line": " sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{tag}'\"\n",
"line_no": 3
},
{
"char_end": 201,
"char_start": 177,
"line": " args = {'tag': tag}\n",
"line_no": 4
},
{
"char_end": 233,
"char_start": 201,
"line": " scenes = db.exec(sql, args)\n",
"line_no": 5
}
],
"deleted": [
{
"char_end": 186,
"char_start": 111,
"line": " sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{}'\".format(tag)\n",
"line_no": 3
},
{
"char_end": 212,
"char_start": 186,
"line": " scenes = db.exec(sql)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-089"
} | 334 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_bracket_graph_data(db, tag):\n # First, we have to find out which scenes this player has brackets in",
" sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{tag}'\"\n args = {'tag': tag}\n scenes = db.exec(sql, args)",
" scenes = [s[0] for s in scenes]",
" bracket_placings_by_scene = {s: get_bracket_placings_in_scene(db, s, tag) for s in scenes}",
" return bracket_placings_by_scene"
] | [
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 173,
"char_start": 170,
"chars": "tag"
},
{
"char_end": 182,
"char_start": 176,
"chars": "\n a"
},
{
"char_end": 190,
"char_start": 183,
"chars": "gs = {'"
},
{
"char_end": 196,
"char_start": 191,
"chars": "ag': "
},
{
"char_end": 200,
"char_start": 199,
"chars": "}"
},
{
"char_end": 231,
"char_start": 225,
"chars": ", args"
}
],
"deleted": [
{
"char_end": 176,
"char_start": 173,
"chars": ".fo"
},
{
"char_end": 178,
"char_start": 177,
"chars": "m"
},
{
"char_end": 181,
"char_start": 179,
"chars": "t("
},
{
"char_end": 185,
"char_start": 184,
"chars": ")"
}
]
},
"commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63",
"file_name": "bracket_utils.py",
"func_name": "get_bracket_graph_data",
"line_changes": {
"added": [
{
"char_end": 177,
"char_start": 111,
"line": " sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{tag}'\"\n",
"line_no": 3
},
{
"char_end": 201,
"char_start": 177,
"line": " args = {'tag': tag}\n",
"line_no": 4
},
{
"char_end": 233,
"char_start": 201,
"line": " scenes = db.exec(sql, args)\n",
"line_no": 5
}
],
"deleted": [
{
"char_end": 186,
"char_start": 111,
"line": " sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{}'\".format(tag)\n",
"line_no": 3
},
{
"char_end": 212,
"char_start": 186,
"line": " scenes = db.exec(sql)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-089"
} | 334 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get(self, email):\n \"\"\" Fetch data for admin with the corresponding email \"\"\"",
" return database_utilities.execute_query(f\"\"\"select * from admins where email = '{email}'\"\"\")"
] | [
1,
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 187,
"char_start": 179,
"chars": "%s\"\"\", ("
},
{
"char_end": 195,
"char_start": 192,
"chars": ", )"
}
],
"deleted": [
{
"char_end": 181,
"char_start": 179,
"chars": "'{"
},
{
"char_end": 191,
"char_start": 186,
"chars": "}'\"\"\""
}
]
},
"commit_link": "github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485",
"file_name": "apis/admins.py",
"func_name": "get",
"line_changes": {
"added": [
{
"char_end": 196,
"char_start": 92,
"line": " return database_utilities.execute_query(f\"\"\"select * from admins where email = %s\"\"\", (email, ))\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 192,
"char_start": 92,
"line": " return database_utilities.execute_query(f\"\"\"select * from admins where email = '{email}'\"\"\")\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 335 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get(self, email):\n \"\"\" Fetch data for admin with the corresponding email \"\"\"",
" return database_utilities.execute_query(f\"\"\"select * from admins where email = %s\"\"\", (email, ))"
] | [
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 187,
"char_start": 179,
"chars": "%s\"\"\", ("
},
{
"char_end": 195,
"char_start": 192,
"chars": ", )"
}
],
"deleted": [
{
"char_end": 181,
"char_start": 179,
"chars": "'{"
},
{
"char_end": 191,
"char_start": 186,
"chars": "}'\"\"\""
}
]
},
"commit_link": "github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485",
"file_name": "apis/admins.py",
"func_name": "get",
"line_changes": {
"added": [
{
"char_end": 196,
"char_start": 92,
"line": " return database_utilities.execute_query(f\"\"\"select * from admins where email = %s\"\"\", (email, ))\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 192,
"char_start": 92,
"line": " return database_utilities.execute_query(f\"\"\"select * from admins where email = '{email}'\"\"\")\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 335 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def insertUsage(user, command):\n\tc, conn = getConnection()\n\tdate = now()",
"\tc.execute(\"INSERT INTO usage (date,user,command) VALUES ('\"+date+\"','\"+str(user)+\"','\"+command+\"')\")",
"\tconn.commit()\n\tconn.close()"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 137,
"char_start": 131,
"chars": "?,?,?)"
},
{
"char_end": 140,
"char_start": 138,
"chars": ",("
}
],
"deleted": [
{
"char_end": 132,
"char_start": 131,
"chars": "'"
},
{
"char_end": 134,
"char_start": 133,
"chars": "+"
},
{
"char_end": 141,
"char_start": 138,
"chars": "+\"'"
},
{
"char_end": 145,
"char_start": 142,
"chars": "'\"+"
},
{
"char_end": 157,
"char_start": 154,
"chars": "+\"'"
},
{
"char_end": 161,
"char_start": 158,
"chars": "'\"+"
},
{
"char_end": 171,
"char_start": 168,
"chars": "+\"'"
},
{
"char_end": 173,
"char_start": 172,
"chars": "\""
}
]
},
"commit_link": "github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0",
"file_name": "database.py",
"func_name": "insertUsage",
"line_changes": {
"added": [
{
"char_end": 165,
"char_start": 73,
"line": "\tc.execute(\"INSERT INTO usage (date,user,command) VALUES (?,?,?)\",(date,str(user),command))\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 175,
"char_start": 73,
"line": "\tc.execute(\"INSERT INTO usage (date,user,command) VALUES ('\"+date+\"','\"+str(user)+\"','\"+command+\"')\")\n",
"line_no": 4
}
]
},
"vul_type": "cwe-089"
} | 336 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def insertUsage(user, command):\n\tc, conn = getConnection()\n\tdate = now()",
"\tc.execute(\"INSERT INTO usage (date,user,command) VALUES (?,?,?)\",(date,str(user),command))",
"\tconn.commit()\n\tconn.close()"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 137,
"char_start": 131,
"chars": "?,?,?)"
},
{
"char_end": 140,
"char_start": 138,
"chars": ",("
}
],
"deleted": [
{
"char_end": 132,
"char_start": 131,
"chars": "'"
},
{
"char_end": 134,
"char_start": 133,
"chars": "+"
},
{
"char_end": 141,
"char_start": 138,
"chars": "+\"'"
},
{
"char_end": 145,
"char_start": 142,
"chars": "'\"+"
},
{
"char_end": 157,
"char_start": 154,
"chars": "+\"'"
},
{
"char_end": 161,
"char_start": 158,
"chars": "'\"+"
},
{
"char_end": 171,
"char_start": 168,
"chars": "+\"'"
},
{
"char_end": 173,
"char_start": 172,
"chars": "\""
}
]
},
"commit_link": "github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0",
"file_name": "database.py",
"func_name": "insertUsage",
"line_changes": {
"added": [
{
"char_end": 165,
"char_start": 73,
"line": "\tc.execute(\"INSERT INTO usage (date,user,command) VALUES (?,?,?)\",(date,str(user),command))\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 175,
"char_start": 73,
"line": "\tc.execute(\"INSERT INTO usage (date,user,command) VALUES ('\"+date+\"','\"+str(user)+\"','\"+command+\"')\")\n",
"line_no": 4
}
]
},
"vul_type": "cwe-089"
} | 336 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def verify_email(self, member):",
" query = \"SELECT COUNT(email) FROM members WHERE email = '{email}'\".format(email = member)\n self.cursor.execute(query)",
" result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 60,
"char_start": 44,
"chars": "self.cursor.exec"
},
{
"char_end": 62,
"char_start": 61,
"chars": "t"
},
{
"char_end": 64,
"char_start": 63,
"chars": "("
},
{
"char_end": 114,
"char_start": 113,
"chars": ":"
},
{
"char_end": 125,
"char_start": 121,
"chars": ", {'"
},
{
"char_end": 132,
"char_start": 130,
"chars": "':"
},
{
"char_end": 139,
"char_start": 138,
"chars": "}"
}
],
"deleted": [
{
"char_end": 46,
"char_start": 44,
"chars": "qu"
},
{
"char_end": 52,
"char_start": 48,
"chars": "y = "
},
{
"char_end": 102,
"char_start": 101,
"chars": "{"
},
{
"char_end": 108,
"char_start": 107,
"chars": "}"
},
{
"char_end": 118,
"char_start": 110,
"chars": ".format("
},
{
"char_end": 126,
"char_start": 123,
"chars": " = "
},
{
"char_end": 167,
"char_start": 132,
"chars": ")\n self.cursor.execute(query"
}
]
},
"commit_link": "github.com/kenboo98/291-Mini-Project-I/commit/3080ccb687c79c83954ce703faee8fcceec8c9eb",
"file_name": "book_rides/book_rides.py",
"func_name": "verify_email",
"line_changes": {
"added": [
{
"char_end": 141,
"char_start": 36,
"line": " self.cursor.execute(\"SELECT COUNT(email) FROM members WHERE email = ':email'\", {'email':member})\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 134,
"char_start": 36,
"line": " query = \"SELECT COUNT(email) FROM members WHERE email = '{email}'\".format(email = member)\n",
"line_no": 2
},
{
"char_end": 169,
"char_start": 134,
"line": " self.cursor.execute(query)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 337 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def verify_email(self, member):",
" self.cursor.execute(\"SELECT COUNT(email) FROM members WHERE email = ':email'\", {'email':member})",
" result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 60,
"char_start": 44,
"chars": "self.cursor.exec"
},
{
"char_end": 62,
"char_start": 61,
"chars": "t"
},
{
"char_end": 64,
"char_start": 63,
"chars": "("
},
{
"char_end": 114,
"char_start": 113,
"chars": ":"
},
{
"char_end": 125,
"char_start": 121,
"chars": ", {'"
},
{
"char_end": 132,
"char_start": 130,
"chars": "':"
},
{
"char_end": 139,
"char_start": 138,
"chars": "}"
}
],
"deleted": [
{
"char_end": 46,
"char_start": 44,
"chars": "qu"
},
{
"char_end": 52,
"char_start": 48,
"chars": "y = "
},
{
"char_end": 102,
"char_start": 101,
"chars": "{"
},
{
"char_end": 108,
"char_start": 107,
"chars": "}"
},
{
"char_end": 118,
"char_start": 110,
"chars": ".format("
},
{
"char_end": 126,
"char_start": 123,
"chars": " = "
},
{
"char_end": 167,
"char_start": 132,
"chars": ")\n self.cursor.execute(query"
}
]
},
"commit_link": "github.com/kenboo98/291-Mini-Project-I/commit/3080ccb687c79c83954ce703faee8fcceec8c9eb",
"file_name": "book_rides/book_rides.py",
"func_name": "verify_email",
"line_changes": {
"added": [
{
"char_end": 141,
"char_start": 36,
"line": " self.cursor.execute(\"SELECT COUNT(email) FROM members WHERE email = ':email'\", {'email':member})\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 134,
"char_start": 36,
"line": " query = \"SELECT COUNT(email) FROM members WHERE email = '{email}'\".format(email = member)\n",
"line_no": 2
},
{
"char_end": 169,
"char_start": 134,
"line": " self.cursor.execute(query)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 337 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_previous_yields(self, inverter_serial):\n query = '''\n SELECT TimeStamp, EToday, ETotal\n FROM Inverters",
" WHERE Serial = '%s'\n ''' % (inverter_serial)\n self.c.execute(query)",
" data = self.c.fetchone()\n return data[0], data[1], data[2]"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 167,
"char_start": 166,
"chars": "?"
},
{
"char_end": 228,
"char_start": 208,
"chars": ", (inverter_serial,)"
}
],
"deleted": [
{
"char_end": 166,
"char_start": 165,
"chars": " "
},
{
"char_end": 172,
"char_start": 167,
"chars": " '%s'"
},
{
"char_end": 204,
"char_start": 184,
"chars": " % (inverter_serial)"
}
]
},
"commit_link": "github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65",
"file_name": "util/database.py",
"func_name": "get_previous_yields",
"line_changes": {
"added": [
{
"char_end": 168,
"char_start": 142,
"line": " WHERE Serial=?\n",
"line_no": 5
},
{
"char_end": 180,
"char_start": 168,
"line": " '''\n",
"line_no": 6
},
{
"char_end": 230,
"char_start": 180,
"line": " self.c.execute(query, (inverter_serial,))\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 173,
"char_start": 142,
"line": " WHERE Serial = '%s'\n",
"line_no": 5
},
{
"char_end": 205,
"char_start": 173,
"line": " ''' % (inverter_serial)\n",
"line_no": 6
},
{
"char_end": 235,
"char_start": 205,
"line": " self.c.execute(query)\n",
"line_no": 7
}
]
},
"vul_type": "cwe-089"
} | 338 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_previous_yields(self, inverter_serial):\n query = '''\n SELECT TimeStamp, EToday, ETotal\n FROM Inverters",
" WHERE Serial=?\n '''\n self.c.execute(query, (inverter_serial,))",
" data = self.c.fetchone()\n return data[0], data[1], data[2]"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 167,
"char_start": 166,
"chars": "?"
},
{
"char_end": 228,
"char_start": 208,
"chars": ", (inverter_serial,)"
}
],
"deleted": [
{
"char_end": 166,
"char_start": 165,
"chars": " "
},
{
"char_end": 172,
"char_start": 167,
"chars": " '%s'"
},
{
"char_end": 204,
"char_start": 184,
"chars": " % (inverter_serial)"
}
]
},
"commit_link": "github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65",
"file_name": "util/database.py",
"func_name": "get_previous_yields",
"line_changes": {
"added": [
{
"char_end": 168,
"char_start": 142,
"line": " WHERE Serial=?\n",
"line_no": 5
},
{
"char_end": 180,
"char_start": 168,
"line": " '''\n",
"line_no": 6
},
{
"char_end": 230,
"char_start": 180,
"line": " self.c.execute(query, (inverter_serial,))\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 173,
"char_start": 142,
"line": " WHERE Serial = '%s'\n",
"line_no": 5
},
{
"char_end": 205,
"char_start": 173,
"line": " ''' % (inverter_serial)\n",
"line_no": 6
},
{
"char_end": 235,
"char_start": 205,
"line": " self.c.execute(query)\n",
"line_no": 7
}
]
},
"vul_type": "cwe-089"
} | 338 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/referrer_count')\ndef referrer_count():\n account_id = request.args.get('account_id')",
" if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)",
" account_id = j_l[\"result\"][0][\"id\"]",
" con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n",
" query = \"select count(*) from referrers where referrer='\"+account_id+\"'\"\n cur.execute(query)",
" results = cur.fetchone()",
" return jsonify(results)"
] | [
1,
1,
1,
1,
0,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 485,
"char_start": 483,
"chars": "%s"
},
{
"char_end": 523,
"char_start": 508,
"chars": ", (account_id,)"
}
],
"deleted": [
{
"char_end": 499,
"char_start": 483,
"chars": "'\"+account_id+\"'"
}
]
},
"commit_link": "github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60",
"file_name": "api.py",
"func_name": "referrer_count",
"line_changes": {
"added": [
{
"char_end": 487,
"char_start": 424,
"line": " query = \"select count(*) from referrers where referrer=%s\"\n",
"line_no": 15
},
{
"char_end": 525,
"char_start": 487,
"line": " cur.execute(query, (account_id,))\n",
"line_no": 16
}
],
"deleted": [
{
"char_end": 501,
"char_start": 424,
"line": " query = \"select count(*) from referrers where referrer='\"+account_id+\"'\"\n",
"line_no": 15
},
{
"char_end": 524,
"char_start": 501,
"line": " cur.execute(query)\n",
"line_no": 16
}
]
},
"vul_type": "cwe-089"
} | 339 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@app.route('/referrer_count')\ndef referrer_count():\n account_id = request.args.get('account_id')",
" if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)",
" account_id = j_l[\"result\"][0][\"id\"]",
" con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n",
" query = \"select count(*) from referrers where referrer=%s\"\n cur.execute(query, (account_id,))",
" results = cur.fetchone()",
" return jsonify(results)"
] | [
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 485,
"char_start": 483,
"chars": "%s"
},
{
"char_end": 523,
"char_start": 508,
"chars": ", (account_id,)"
}
],
"deleted": [
{
"char_end": 499,
"char_start": 483,
"chars": "'\"+account_id+\"'"
}
]
},
"commit_link": "github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60",
"file_name": "api.py",
"func_name": "referrer_count",
"line_changes": {
"added": [
{
"char_end": 487,
"char_start": 424,
"line": " query = \"select count(*) from referrers where referrer=%s\"\n",
"line_no": 15
},
{
"char_end": 525,
"char_start": 487,
"line": " cur.execute(query, (account_id,))\n",
"line_no": 16
}
],
"deleted": [
{
"char_end": 501,
"char_start": 424,
"line": " query = \"select count(*) from referrers where referrer='\"+account_id+\"'\"\n",
"line_no": 15
},
{
"char_end": 524,
"char_start": 501,
"line": " cur.execute(query)\n",
"line_no": 16
}
]
},
"vul_type": "cwe-089"
} | 339 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def analyze_scene(self, scene):\n base_urls = scene.get_base_urls()\n users = scene.get_users()\n name = scene.get_name()\n 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 account\n for user in users:\n # Have we analyzed this user before?",
" sql = \"SELECT * FROM user_analyzed WHERE user='{}';\".format(user)\n results = self.db.exec(sql)",
"\n # Did we have any matches in the database?\n if len(results) > 0:\n # We have analyzed this user before. Just grab one page of brackets to see if there have been any new tournaments\n # eg, just look at /users/christmasmike?page=1 instead of all the pages that exist\n most_recent_page = bracket_utils.get_brackets_from_user(user, pages=1)\n for bracket in most_recent_page:\n LOG.info('here are the brackets from the most recent page of user {}: {}'.format(user, most_recent_page))\n # This user has already been analyzed, there's a good chance this bracket has been analyzed also",
" sql = \"SELECT * FROM user_analyzed WHERE url='{}' AND user='{}';\".format(bracket, user)\n results = self.db.exec(sql)",
"\n if len(results) == 0:\n # This is a new bracket that must have been published in the last hour or so\n LOG.info('found this url from a user: {} {}'.format(bracket, user))\n display_name = bracket_utils.get_display_base(bracket)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue",
" self.data_processor.process(bracket, name, display_name)",
" # mark this bracket as analyzed",
" sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(bracket, user, name)\n self.db.exec(sql)",
"\n # Tweet that we found a new bracket\n msg = \"Found new {} bracket: {}\".format(name, bracket)\n tweet(msg)\n else:\n LOG.info('url {} is not new for user {}'.format(bracket, user))\n else:\n # This is a new user, analyze all brackets\n user_urls = bracket_utils.get_brackets_from_user(user)\n for url in user_urls:\n LOG.info('found this url from a user: {} {}'.format(url, user))\n display_name = bracket_utils.get_display_base(url)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue",
" self.data_processor.process(url, name, display_name)",
" # mark this bracket as analyzed",
" sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(url, user, name)\n self.db.exec(sql)",
"\n LOG.info('done with user {}'.format(user))",
"\n # This scene might always call their brackets the same thing, eg weekly1, weekly2, weekly3 etc\n for base_url in base_urls:\n # attempt to load this data from the database\n LOG.info('About to start this analysis thread for scene {}'.format(scene.get_name()))",
" sql = \"SELECT first,last FROM valids WHERE base_url = '\" + str(base_url) + \"';\"\n result = self.db.exec(sql)",
" has_results = len(result) > 0 ",
" # Did we find a match in the database?\n if has_results:\n LOG.info(\"validURLs found values in the database\" + str(result))\n first = result[0][0]\n last = result[0][1]",
" # Check for a new valid URL\n new_last = bracket_utils._get_last_valid_url(base_url, last-1)",
" if not new_last == last:\n if new_last - last > 5:\n with open(\"DEBUGOUTPUT.txt\", 'a') as f:\n f.write(\"[validURLs.py:55]: found a SHIT TON of new tournaments for bracket: {}\".format(base_url))",
" else:\n bracket = base_url.replace('###', str(new_last))\n LOG.info('Found new bracket: {}'.format(bracket))\n msg = \"Found new bracket: {}\".format(bracket)\n tweet(msg)",
" # If there's been a new last, update the database",
" sql = \"UPDATE valids SET last=\" + str(new_last) + \" where base_url = '\"+str(base_url)+\"';\"\n self.db.exec(sql)",
"",
" # Analyze each of these new brackets\n for i in range(last+1, new_last+1):\n # Since this URL is new, we have to process the data\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue",
" self.data_processor.process(bracket, name, display_name, new_bracket=True)",
" else:\n # We need to create first and last from scratch\n first = bracket_utils._get_first_valid_url(base_url)\n last = bracket_utils._get_last_valid_url(base_url, first)",
" # This is new data, we need to put it into the db",
" sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES (\"\n sql += \"'\"+str(base_url)+\"', \"+str(first)+ \", \"+str(last)+\", '\"+str(name)+\"');\"\n self.db.exec(sql)",
"\n for i in range(first, last+1):\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue",
" self.data_processor.process(bracket, name, display_name)",
" # Calculate ranks after each tournament so we can see how players are progressing\n if not analyzed_scenes and should_tweet:\n tweet('About to start ranking for scene {}'.format(name))\n self.data_processor.check_and_update_ranks(name)"
] | [
1,
1,
0,
1,
0,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 466,
"char_start": 462,
"chars": "user"
},
{
"char_end": 483,
"char_start": 470,
"chars": "\n "
},
{
"char_end": 492,
"char_start": 484,
"chars": "rgs = {'"
},
{
"char_end": 504,
"char_start": 496,
"chars": "': user}"
},
{
"char_end": 549,
"char_start": 543,
"chars": ", args"
},
{
"char_end": 1322,
"char_start": 1315,
"chars": "bracket"
},
{
"char_end": 1340,
"char_start": 1336,
"chars": "user"
},
{
"char_end": 1366,
"char_start": 1344,
"chars": "\n a"
},
{
"char_end": 1376,
"char_start": 1367,
"chars": "gs = {'br"
},
{
"char_end": 1380,
"char_start": 1377,
"chars": "cke"
},
{
"char_end": 1384,
"char_start": 1381,
"chars": "': "
},
{
"char_end": 1394,
"char_start": 1393,
"chars": "'"
},
{
"char_end": 1406,
"char_start": 1398,
"chars": "': user}"
},
{
"char_end": 1459,
"char_start": 1453,
"chars": ", args"
},
{
"char_end": 2337,
"char_start": 2330,
"chars": "bracket"
},
{
"char_end": 2347,
"char_start": 2343,
"chars": "user"
},
{
"char_end": 2357,
"char_start": 2353,
"chars": "name"
},
{
"char_end": 2388,
"char_start": 2362,
"chars": "\n a"
},
{
"char_end": 2398,
"char_start": 2389,
"chars": "gs = {'br"
},
{
"char_end": 2402,
"char_start": 2399,
"chars": "cke"
},
{
"char_end": 2406,
"char_start": 2403,
"chars": "': "
},
{
"char_end": 2422,
"char_start": 2415,
"chars": "'user':"
},
{
"char_end": 2429,
"char_start": 2428,
"chars": "'"
},
{
"char_end": 2440,
"char_start": 2433,
"chars": "':name}"
},
{
"char_end": 2487,
"char_start": 2481,
"chars": ", args"
},
{
"char_end": 3644,
"char_start": 3641,
"chars": "url"
},
{
"char_end": 3654,
"char_start": 3650,
"chars": "user"
},
{
"char_end": 3664,
"char_start": 3660,
"chars": "name"
},
{
"char_end": 3690,
"char_start": 3669,
"chars": "\n "
},
{
"char_end": 3705,
"char_start": 3691,
"chars": "rgs = {'url': "
},
{
"char_end": 3717,
"char_start": 3710,
"chars": "'user':"
},
{
"char_end": 3724,
"char_start": 3723,
"chars": "'"
},
{
"char_end": 3735,
"char_start": 3728,
"chars": "':name}"
},
{
"char_end": 3778,
"char_start": 3772,
"chars": ", args"
},
{
"char_end": 4215,
"char_start": 4203,
"chars": "{base_url}';"
},
{
"char_end": 4219,
"char_start": 4216,
"chars": "\n "
},
{
"char_end": 4225,
"char_start": 4220,
"chars": " "
},
{
"char_end": 4230,
"char_start": 4226,
"chars": " a"
},
{
"char_end": 4238,
"char_start": 4231,
"chars": "gs = {'"
},
{
"char_end": 4258,
"char_start": 4247,
"chars": ": base_url}"
},
{
"char_end": 4302,
"char_start": 4296,
"chars": ", args"
},
{
"char_end": 5383,
"char_start": 5382,
"chars": "{"
},
{
"char_end": 5392,
"char_start": 5391,
"chars": "}"
},
{
"char_end": 5447,
"char_start": 5407,
"chars": "='{base_url}';\"\n args"
},
{
"char_end": 5451,
"char_start": 5450,
"chars": "{"
},
{
"char_end": 5469,
"char_start": 5452,
"chars": "new_last': new_la"
},
{
"char_end": 5474,
"char_start": 5471,
"chars": ", '"
},
{
"char_end": 5494,
"char_start": 5483,
"chars": ": base_url}"
},
{
"char_end": 5537,
"char_start": 5531,
"chars": ", args"
},
{
"char_end": 6864,
"char_start": 6819,
"chars": "'{base_url}', '{first}', '{last}', '{name}');"
},
{
"char_end": 6885,
"char_start": 6882,
"chars": "arg"
},
{
"char_end": 6890,
"char_start": 6889,
"chars": "{"
},
{
"char_end": 6893,
"char_start": 6891,
"chars": "ba"
},
{
"char_end": 6897,
"char_start": 6894,
"chars": "e_u"
},
{
"char_end": 6902,
"char_start": 6898,
"chars": "l': "
},
{
"char_end": 6916,
"char_start": 6912,
"chars": "'fir"
},
{
"char_end": 6921,
"char_start": 6918,
"chars": "': "
},
{
"char_end": 6931,
"char_start": 6928,
"chars": "'la"
},
{
"char_end": 6936,
"char_start": 6933,
"chars": "': "
},
{
"char_end": 6955,
"char_start": 6948,
"chars": ": name}"
},
{
"char_end": 6994,
"char_start": 6988,
"chars": ", args"
}
],
"deleted": [
{
"char_end": 469,
"char_start": 466,
"chars": ".fo"
},
{
"char_end": 474,
"char_start": 470,
"chars": "mat("
},
{
"char_end": 479,
"char_start": 478,
"chars": ")"
},
{
"char_end": 1305,
"char_start": 1302,
"chars": ".fo"
},
{
"char_end": 1307,
"char_start": 1306,
"chars": "m"
},
{
"char_end": 1310,
"char_start": 1309,
"chars": "("
},
{
"char_end": 1324,
"char_start": 1323,
"chars": ")"
},
{
"char_end": 2262,
"char_start": 2259,
"chars": ".fo"
},
{
"char_end": 2264,
"char_start": 2263,
"chars": "m"
},
{
"char_end": 2267,
"char_start": 2266,
"chars": "("
},
{
"char_end": 2287,
"char_start": 2286,
"chars": ")"
},
{
"char_end": 3502,
"char_start": 3499,
"chars": ".fo"
},
{
"char_end": 3507,
"char_start": 3503,
"chars": "mat("
},
{
"char_end": 3523,
"char_start": 3522,
"chars": ")"
},
{
"char_end": 3988,
"char_start": 3987,
"chars": "+"
},
{
"char_end": 3991,
"char_start": 3990,
"chars": "t"
},
{
"char_end": 3993,
"char_start": 3992,
"chars": "("
},
{
"char_end": 4009,
"char_start": 4001,
"chars": ") + \"';\""
},
{
"char_end": 5135,
"char_start": 5127,
"chars": "\" + str("
},
{
"char_end": 5148,
"char_start": 5143,
"chars": ") + \""
},
{
"char_end": 5169,
"char_start": 5167,
"chars": "\"+"
},
{
"char_end": 5173,
"char_start": 5172,
"chars": "("
},
{
"char_end": 5187,
"char_start": 5181,
"chars": ")+\"';\""
},
{
"char_end": 6527,
"char_start": 6525,
"chars": "ql"
},
{
"char_end": 6529,
"char_start": 6528,
"chars": "+"
},
{
"char_end": 6532,
"char_start": 6531,
"chars": "\""
},
{
"char_end": 6535,
"char_start": 6533,
"chars": "\"+"
},
{
"char_end": 6537,
"char_start": 6536,
"chars": "t"
},
{
"char_end": 6539,
"char_start": 6538,
"chars": "("
},
{
"char_end": 6551,
"char_start": 6547,
"chars": ")+\"'"
},
{
"char_end": 6555,
"char_start": 6553,
"chars": "\"+"
},
{
"char_end": 6559,
"char_start": 6557,
"chars": "r("
},
{
"char_end": 6568,
"char_start": 6564,
"chars": ")+ \""
},
{
"char_end": 6572,
"char_start": 6570,
"chars": "\"+"
},
{
"char_end": 6576,
"char_start": 6574,
"chars": "r("
},
{
"char_end": 6583,
"char_start": 6580,
"chars": ")+\""
},
{
"char_end": 6592,
"char_start": 6586,
"chars": "\"+str("
},
{
"char_end": 6599,
"char_start": 6596,
"chars": ")+\""
},
{
"char_end": 6603,
"char_start": 6600,
"chars": ");\""
}
]
},
"commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63",
"file_name": "validURLs.py",
"func_name": "analyze_scene",
"line_changes": {
"added": [
{
"char_end": 471,
"char_start": 402,
"line": " sql = \"SELECT * FROM user_analyzed WHERE user='{user}';\"\n",
"line_no": 10
},
{
"char_end": 505,
"char_start": 471,
"line": " args = {'user': user}\n",
"line_no": 11
},
{
"char_end": 551,
"char_start": 505,
"line": " results = self.db.exec(sql, args)\n",
"line_no": 12
},
{
"char_end": 1345,
"char_start": 1248,
"line": " sql = \"SELECT * FROM user_analyzed WHERE url='{bracket}' AND user='{user}';\"\n",
"line_no": 22
},
{
"char_end": 1407,
"char_start": 1345,
"line": " args = {'bracket': bracket, 'user': user}\n",
"line_no": 23
},
{
"char_end": 1461,
"char_start": 1407,
"line": " results = self.db.exec(sql, args)\n",
"line_no": 24
},
{
"char_end": 2363,
"char_start": 2244,
"line": " sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{bracket}', '{user}', '{name}');\"\n",
"line_no": 38
},
{
"char_end": 2441,
"char_start": 2363,
"line": " args = {'bracket': bracket, 'user':user, 'name':name}\n",
"line_no": 39
},
{
"char_end": 2489,
"char_start": 2441,
"line": " self.db.exec(sql, args)\n",
"line_no": 40
},
{
"char_end": 3670,
"char_start": 3559,
"line": " sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{url}', '{user}', '{name}');\"\n",
"line_no": 61
},
{
"char_end": 3736,
"char_start": 3670,
"line": " args = {'url': url, 'user':user, 'name':name}\n",
"line_no": 62
},
{
"char_end": 3780,
"char_start": 3736,
"line": " self.db.exec(sql, args)\n",
"line_no": 63
},
{
"char_end": 4217,
"char_start": 4136,
"line": " sql = \"SELECT first,last FROM valids WHERE base_url = '{base_url}';\"\n",
"line_no": 72
},
{
"char_end": 4259,
"char_start": 4217,
"line": " args = {'base_url': base_url}\n",
"line_no": 73
},
{
"char_end": 4304,
"char_start": 4259,
"line": " result = self.db.exec(sql, args)\n",
"line_no": 74
},
{
"char_end": 5423,
"char_start": 5332,
"line": " sql = \"UPDATE valids SET last={new_last} where base_url='{base_url}';\"\n",
"line_no": 98
},
{
"char_end": 5495,
"char_start": 5423,
"line": " args = {'new_last': new_last, 'base_url': base_url}\n",
"line_no": 99
},
{
"char_end": 5539,
"char_start": 5495,
"line": " self.db.exec(sql, args)\n",
"line_no": 100
},
{
"char_end": 6866,
"char_start": 6738,
"line": " sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES ('{base_url}', '{first}', '{last}', '{name}');\"\n",
"line_no": 123
},
{
"char_end": 6956,
"char_start": 6866,
"line": " args = {'base_url': base_url, 'first': first, 'last': last, 'name': name}\n",
"line_no": 124
},
{
"char_end": 6996,
"char_start": 6956,
"line": " self.db.exec(sql, args)\n",
"line_no": 125
}
],
"deleted": [
{
"char_end": 480,
"char_start": 402,
"line": " sql = \"SELECT * FROM user_analyzed WHERE user='{}';\".format(user)\n",
"line_no": 10
},
{
"char_end": 520,
"char_start": 480,
"line": " results = self.db.exec(sql)\n",
"line_no": 11
},
{
"char_end": 1325,
"char_start": 1217,
"line": " sql = \"SELECT * FROM user_analyzed WHERE url='{}' AND user='{}';\".format(bracket, user)\n",
"line_no": 21
},
{
"char_end": 1373,
"char_start": 1325,
"line": " results = self.db.exec(sql)\n",
"line_no": 22
},
{
"char_end": 2288,
"char_start": 2156,
"line": " sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(bracket, user, name)\n",
"line_no": 36
},
{
"char_end": 2330,
"char_start": 2288,
"line": " self.db.exec(sql)\n",
"line_no": 37
},
{
"char_end": 3524,
"char_start": 3400,
"line": " sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(url, user, name)\n",
"line_no": 58
},
{
"char_end": 3562,
"char_start": 3524,
"line": " self.db.exec(sql)\n",
"line_no": 59
},
{
"char_end": 4010,
"char_start": 3918,
"line": " sql = \"SELECT first,last FROM valids WHERE base_url = '\" + str(base_url) + \"';\"\n",
"line_no": 68
},
{
"char_end": 4049,
"char_start": 4010,
"line": " result = self.db.exec(sql)\n",
"line_no": 69
},
{
"char_end": 5188,
"char_start": 5077,
"line": " sql = \"UPDATE valids SET last=\" + str(new_last) + \" where base_url = '\"+str(base_url)+\"';\"\n",
"line_no": 93
},
{
"char_end": 5226,
"char_start": 5188,
"line": " self.db.exec(sql)\n",
"line_no": 94
},
{
"char_end": 6508,
"char_start": 6425,
"line": " sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES (\"\n",
"line_no": 117
},
{
"char_end": 6604,
"char_start": 6508,
"line": " sql += \"'\"+str(base_url)+\"', \"+str(first)+ \", \"+str(last)+\", '\"+str(name)+\"');\"\n",
"line_no": 118
},
{
"char_end": 6638,
"char_start": 6604,
"line": " self.db.exec(sql)\n",
"line_no": 119
}
]
},
"vul_type": "cwe-089"
} | 340 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def analyze_scene(self, scene):\n base_urls = scene.get_base_urls()\n users = scene.get_users()\n name = scene.get_name()\n 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 account\n for user in users:\n # Have we analyzed this user before?",
" sql = \"SELECT * FROM user_analyzed WHERE user='{user}';\"\n args = {'user': user}\n results = self.db.exec(sql, args)",
"\n # Did we have any matches in the database?\n if len(results) > 0:\n # We have analyzed this user before. Just grab one page of brackets to see if there have been any new tournaments\n # eg, just look at /users/christmasmike?page=1 instead of all the pages that exist\n most_recent_page = bracket_utils.get_brackets_from_user(user, pages=1)\n for bracket in most_recent_page:\n LOG.info('here are the brackets from the most recent page of user {}: {}'.format(user, most_recent_page))\n # This user has already been analyzed, there's a good chance this bracket has been analyzed also",
" sql = \"SELECT * FROM user_analyzed WHERE url='{bracket}' AND user='{user}';\"\n args = {'bracket': bracket, 'user': user}\n results = self.db.exec(sql, args)",
"\n if len(results) == 0:\n # This is a new bracket that must have been published in the last hour or so\n LOG.info('found this url from a user: {} {}'.format(bracket, user))\n display_name = bracket_utils.get_display_base(bracket)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue",
" self.data_processor.process(bracket, name, display_name)",
" # mark this bracket as analyzed",
" sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{bracket}', '{user}', '{name}');\"\n args = {'bracket': bracket, 'user':user, 'name':name}\n self.db.exec(sql, args)",
"\n # Tweet that we found a new bracket\n msg = \"Found new {} bracket: {}\".format(name, bracket)\n tweet(msg)\n else:\n LOG.info('url {} is not new for user {}'.format(bracket, user))\n else:\n # This is a new user, analyze all brackets\n user_urls = bracket_utils.get_brackets_from_user(user)\n for url in user_urls:\n LOG.info('found this url from a user: {} {}'.format(url, user))\n display_name = bracket_utils.get_display_base(url)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue",
" self.data_processor.process(url, name, display_name)",
" # mark this bracket as analyzed",
" sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{url}', '{user}', '{name}');\"\n args = {'url': url, 'user':user, 'name':name}\n self.db.exec(sql, args)",
"\n LOG.info('done with user {}'.format(user))",
"\n # This scene might always call their brackets the same thing, eg weekly1, weekly2, weekly3 etc\n for base_url in base_urls:\n # attempt to load this data from the database\n LOG.info('About to start this analysis thread for scene {}'.format(scene.get_name()))",
" sql = \"SELECT first,last FROM valids WHERE base_url = '{base_url}';\"\n args = {'base_url': base_url}\n result = self.db.exec(sql, args)",
" has_results = len(result) > 0 ",
" # Did we find a match in the database?\n if has_results:\n LOG.info(\"validURLs found values in the database\" + str(result))\n first = result[0][0]\n last = result[0][1]",
" # Check for a new valid URL\n new_last = bracket_utils._get_last_valid_url(base_url, last-1)",
" if not new_last == last:\n if new_last - last > 5:\n with open(\"DEBUGOUTPUT.txt\", 'a') as f:\n f.write(\"[validURLs.py:55]: found a SHIT TON of new tournaments for bracket: {}\".format(base_url))",
" else:\n bracket = base_url.replace('###', str(new_last))\n LOG.info('Found new bracket: {}'.format(bracket))\n msg = \"Found new bracket: {}\".format(bracket)\n tweet(msg)",
" # If there's been a new last, update the database",
" sql = \"UPDATE valids SET last={new_last} where base_url='{base_url}';\"\n args = {'new_last': new_last, 'base_url': base_url}\n self.db.exec(sql, args)",
"",
" # Analyze each of these new brackets\n for i in range(last+1, new_last+1):\n # Since this URL is new, we have to process the data\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue",
" self.data_processor.process(bracket, name, display_name, new_bracket=True)",
" else:\n # We need to create first and last from scratch\n first = bracket_utils._get_first_valid_url(base_url)\n last = bracket_utils._get_last_valid_url(base_url, first)",
" # This is new data, we need to put it into the db",
" sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES ('{base_url}', '{first}', '{last}', '{name}');\"\n args = {'base_url': base_url, 'first': first, 'last': last, 'name': name}\n self.db.exec(sql, args)",
"\n for i in range(first, last+1):\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue",
" self.data_processor.process(bracket, name, display_name)",
" # Calculate ranks after each tournament so we can see how players are progressing\n if not analyzed_scenes and should_tweet:\n tweet('About to start ranking for scene {}'.format(name))\n self.data_processor.check_and_update_ranks(name)"
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 466,
"char_start": 462,
"chars": "user"
},
{
"char_end": 483,
"char_start": 470,
"chars": "\n "
},
{
"char_end": 492,
"char_start": 484,
"chars": "rgs = {'"
},
{
"char_end": 504,
"char_start": 496,
"chars": "': user}"
},
{
"char_end": 549,
"char_start": 543,
"chars": ", args"
},
{
"char_end": 1322,
"char_start": 1315,
"chars": "bracket"
},
{
"char_end": 1340,
"char_start": 1336,
"chars": "user"
},
{
"char_end": 1366,
"char_start": 1344,
"chars": "\n a"
},
{
"char_end": 1376,
"char_start": 1367,
"chars": "gs = {'br"
},
{
"char_end": 1380,
"char_start": 1377,
"chars": "cke"
},
{
"char_end": 1384,
"char_start": 1381,
"chars": "': "
},
{
"char_end": 1394,
"char_start": 1393,
"chars": "'"
},
{
"char_end": 1406,
"char_start": 1398,
"chars": "': user}"
},
{
"char_end": 1459,
"char_start": 1453,
"chars": ", args"
},
{
"char_end": 2337,
"char_start": 2330,
"chars": "bracket"
},
{
"char_end": 2347,
"char_start": 2343,
"chars": "user"
},
{
"char_end": 2357,
"char_start": 2353,
"chars": "name"
},
{
"char_end": 2388,
"char_start": 2362,
"chars": "\n a"
},
{
"char_end": 2398,
"char_start": 2389,
"chars": "gs = {'br"
},
{
"char_end": 2402,
"char_start": 2399,
"chars": "cke"
},
{
"char_end": 2406,
"char_start": 2403,
"chars": "': "
},
{
"char_end": 2422,
"char_start": 2415,
"chars": "'user':"
},
{
"char_end": 2429,
"char_start": 2428,
"chars": "'"
},
{
"char_end": 2440,
"char_start": 2433,
"chars": "':name}"
},
{
"char_end": 2487,
"char_start": 2481,
"chars": ", args"
},
{
"char_end": 3644,
"char_start": 3641,
"chars": "url"
},
{
"char_end": 3654,
"char_start": 3650,
"chars": "user"
},
{
"char_end": 3664,
"char_start": 3660,
"chars": "name"
},
{
"char_end": 3690,
"char_start": 3669,
"chars": "\n "
},
{
"char_end": 3705,
"char_start": 3691,
"chars": "rgs = {'url': "
},
{
"char_end": 3717,
"char_start": 3710,
"chars": "'user':"
},
{
"char_end": 3724,
"char_start": 3723,
"chars": "'"
},
{
"char_end": 3735,
"char_start": 3728,
"chars": "':name}"
},
{
"char_end": 3778,
"char_start": 3772,
"chars": ", args"
},
{
"char_end": 4215,
"char_start": 4203,
"chars": "{base_url}';"
},
{
"char_end": 4219,
"char_start": 4216,
"chars": "\n "
},
{
"char_end": 4225,
"char_start": 4220,
"chars": " "
},
{
"char_end": 4230,
"char_start": 4226,
"chars": " a"
},
{
"char_end": 4238,
"char_start": 4231,
"chars": "gs = {'"
},
{
"char_end": 4258,
"char_start": 4247,
"chars": ": base_url}"
},
{
"char_end": 4302,
"char_start": 4296,
"chars": ", args"
},
{
"char_end": 5383,
"char_start": 5382,
"chars": "{"
},
{
"char_end": 5392,
"char_start": 5391,
"chars": "}"
},
{
"char_end": 5447,
"char_start": 5407,
"chars": "='{base_url}';\"\n args"
},
{
"char_end": 5451,
"char_start": 5450,
"chars": "{"
},
{
"char_end": 5469,
"char_start": 5452,
"chars": "new_last': new_la"
},
{
"char_end": 5474,
"char_start": 5471,
"chars": ", '"
},
{
"char_end": 5494,
"char_start": 5483,
"chars": ": base_url}"
},
{
"char_end": 5537,
"char_start": 5531,
"chars": ", args"
},
{
"char_end": 6864,
"char_start": 6819,
"chars": "'{base_url}', '{first}', '{last}', '{name}');"
},
{
"char_end": 6885,
"char_start": 6882,
"chars": "arg"
},
{
"char_end": 6890,
"char_start": 6889,
"chars": "{"
},
{
"char_end": 6893,
"char_start": 6891,
"chars": "ba"
},
{
"char_end": 6897,
"char_start": 6894,
"chars": "e_u"
},
{
"char_end": 6902,
"char_start": 6898,
"chars": "l': "
},
{
"char_end": 6916,
"char_start": 6912,
"chars": "'fir"
},
{
"char_end": 6921,
"char_start": 6918,
"chars": "': "
},
{
"char_end": 6931,
"char_start": 6928,
"chars": "'la"
},
{
"char_end": 6936,
"char_start": 6933,
"chars": "': "
},
{
"char_end": 6955,
"char_start": 6948,
"chars": ": name}"
},
{
"char_end": 6994,
"char_start": 6988,
"chars": ", args"
}
],
"deleted": [
{
"char_end": 469,
"char_start": 466,
"chars": ".fo"
},
{
"char_end": 474,
"char_start": 470,
"chars": "mat("
},
{
"char_end": 479,
"char_start": 478,
"chars": ")"
},
{
"char_end": 1305,
"char_start": 1302,
"chars": ".fo"
},
{
"char_end": 1307,
"char_start": 1306,
"chars": "m"
},
{
"char_end": 1310,
"char_start": 1309,
"chars": "("
},
{
"char_end": 1324,
"char_start": 1323,
"chars": ")"
},
{
"char_end": 2262,
"char_start": 2259,
"chars": ".fo"
},
{
"char_end": 2264,
"char_start": 2263,
"chars": "m"
},
{
"char_end": 2267,
"char_start": 2266,
"chars": "("
},
{
"char_end": 2287,
"char_start": 2286,
"chars": ")"
},
{
"char_end": 3502,
"char_start": 3499,
"chars": ".fo"
},
{
"char_end": 3507,
"char_start": 3503,
"chars": "mat("
},
{
"char_end": 3523,
"char_start": 3522,
"chars": ")"
},
{
"char_end": 3988,
"char_start": 3987,
"chars": "+"
},
{
"char_end": 3991,
"char_start": 3990,
"chars": "t"
},
{
"char_end": 3993,
"char_start": 3992,
"chars": "("
},
{
"char_end": 4009,
"char_start": 4001,
"chars": ") + \"';\""
},
{
"char_end": 5135,
"char_start": 5127,
"chars": "\" + str("
},
{
"char_end": 5148,
"char_start": 5143,
"chars": ") + \""
},
{
"char_end": 5169,
"char_start": 5167,
"chars": "\"+"
},
{
"char_end": 5173,
"char_start": 5172,
"chars": "("
},
{
"char_end": 5187,
"char_start": 5181,
"chars": ")+\"';\""
},
{
"char_end": 6527,
"char_start": 6525,
"chars": "ql"
},
{
"char_end": 6529,
"char_start": 6528,
"chars": "+"
},
{
"char_end": 6532,
"char_start": 6531,
"chars": "\""
},
{
"char_end": 6535,
"char_start": 6533,
"chars": "\"+"
},
{
"char_end": 6537,
"char_start": 6536,
"chars": "t"
},
{
"char_end": 6539,
"char_start": 6538,
"chars": "("
},
{
"char_end": 6551,
"char_start": 6547,
"chars": ")+\"'"
},
{
"char_end": 6555,
"char_start": 6553,
"chars": "\"+"
},
{
"char_end": 6559,
"char_start": 6557,
"chars": "r("
},
{
"char_end": 6568,
"char_start": 6564,
"chars": ")+ \""
},
{
"char_end": 6572,
"char_start": 6570,
"chars": "\"+"
},
{
"char_end": 6576,
"char_start": 6574,
"chars": "r("
},
{
"char_end": 6583,
"char_start": 6580,
"chars": ")+\""
},
{
"char_end": 6592,
"char_start": 6586,
"chars": "\"+str("
},
{
"char_end": 6599,
"char_start": 6596,
"chars": ")+\""
},
{
"char_end": 6603,
"char_start": 6600,
"chars": ");\""
}
]
},
"commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63",
"file_name": "validURLs.py",
"func_name": "analyze_scene",
"line_changes": {
"added": [
{
"char_end": 471,
"char_start": 402,
"line": " sql = \"SELECT * FROM user_analyzed WHERE user='{user}';\"\n",
"line_no": 10
},
{
"char_end": 505,
"char_start": 471,
"line": " args = {'user': user}\n",
"line_no": 11
},
{
"char_end": 551,
"char_start": 505,
"line": " results = self.db.exec(sql, args)\n",
"line_no": 12
},
{
"char_end": 1345,
"char_start": 1248,
"line": " sql = \"SELECT * FROM user_analyzed WHERE url='{bracket}' AND user='{user}';\"\n",
"line_no": 22
},
{
"char_end": 1407,
"char_start": 1345,
"line": " args = {'bracket': bracket, 'user': user}\n",
"line_no": 23
},
{
"char_end": 1461,
"char_start": 1407,
"line": " results = self.db.exec(sql, args)\n",
"line_no": 24
},
{
"char_end": 2363,
"char_start": 2244,
"line": " sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{bracket}', '{user}', '{name}');\"\n",
"line_no": 38
},
{
"char_end": 2441,
"char_start": 2363,
"line": " args = {'bracket': bracket, 'user':user, 'name':name}\n",
"line_no": 39
},
{
"char_end": 2489,
"char_start": 2441,
"line": " self.db.exec(sql, args)\n",
"line_no": 40
},
{
"char_end": 3670,
"char_start": 3559,
"line": " sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{url}', '{user}', '{name}');\"\n",
"line_no": 61
},
{
"char_end": 3736,
"char_start": 3670,
"line": " args = {'url': url, 'user':user, 'name':name}\n",
"line_no": 62
},
{
"char_end": 3780,
"char_start": 3736,
"line": " self.db.exec(sql, args)\n",
"line_no": 63
},
{
"char_end": 4217,
"char_start": 4136,
"line": " sql = \"SELECT first,last FROM valids WHERE base_url = '{base_url}';\"\n",
"line_no": 72
},
{
"char_end": 4259,
"char_start": 4217,
"line": " args = {'base_url': base_url}\n",
"line_no": 73
},
{
"char_end": 4304,
"char_start": 4259,
"line": " result = self.db.exec(sql, args)\n",
"line_no": 74
},
{
"char_end": 5423,
"char_start": 5332,
"line": " sql = \"UPDATE valids SET last={new_last} where base_url='{base_url}';\"\n",
"line_no": 98
},
{
"char_end": 5495,
"char_start": 5423,
"line": " args = {'new_last': new_last, 'base_url': base_url}\n",
"line_no": 99
},
{
"char_end": 5539,
"char_start": 5495,
"line": " self.db.exec(sql, args)\n",
"line_no": 100
},
{
"char_end": 6866,
"char_start": 6738,
"line": " sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES ('{base_url}', '{first}', '{last}', '{name}');\"\n",
"line_no": 123
},
{
"char_end": 6956,
"char_start": 6866,
"line": " args = {'base_url': base_url, 'first': first, 'last': last, 'name': name}\n",
"line_no": 124
},
{
"char_end": 6996,
"char_start": 6956,
"line": " self.db.exec(sql, args)\n",
"line_no": 125
}
],
"deleted": [
{
"char_end": 480,
"char_start": 402,
"line": " sql = \"SELECT * FROM user_analyzed WHERE user='{}';\".format(user)\n",
"line_no": 10
},
{
"char_end": 520,
"char_start": 480,
"line": " results = self.db.exec(sql)\n",
"line_no": 11
},
{
"char_end": 1325,
"char_start": 1217,
"line": " sql = \"SELECT * FROM user_analyzed WHERE url='{}' AND user='{}';\".format(bracket, user)\n",
"line_no": 21
},
{
"char_end": 1373,
"char_start": 1325,
"line": " results = self.db.exec(sql)\n",
"line_no": 22
},
{
"char_end": 2288,
"char_start": 2156,
"line": " sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(bracket, user, name)\n",
"line_no": 36
},
{
"char_end": 2330,
"char_start": 2288,
"line": " self.db.exec(sql)\n",
"line_no": 37
},
{
"char_end": 3524,
"char_start": 3400,
"line": " sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(url, user, name)\n",
"line_no": 58
},
{
"char_end": 3562,
"char_start": 3524,
"line": " self.db.exec(sql)\n",
"line_no": 59
},
{
"char_end": 4010,
"char_start": 3918,
"line": " sql = \"SELECT first,last FROM valids WHERE base_url = '\" + str(base_url) + \"';\"\n",
"line_no": 68
},
{
"char_end": 4049,
"char_start": 4010,
"line": " result = self.db.exec(sql)\n",
"line_no": 69
},
{
"char_end": 5188,
"char_start": 5077,
"line": " sql = \"UPDATE valids SET last=\" + str(new_last) + \" where base_url = '\"+str(base_url)+\"';\"\n",
"line_no": 93
},
{
"char_end": 5226,
"char_start": 5188,
"line": " self.db.exec(sql)\n",
"line_no": 94
},
{
"char_end": 6508,
"char_start": 6425,
"line": " sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES (\"\n",
"line_no": 117
},
{
"char_end": 6604,
"char_start": 6508,
"line": " sql += \"'\"+str(base_url)+\"', \"+str(first)+ \", \"+str(last)+\", '\"+str(name)+\"');\"\n",
"line_no": 118
},
{
"char_end": 6638,
"char_start": 6604,
"line": " self.db.exec(sql)\n",
"line_no": 119
}
]
},
"vul_type": "cwe-089"
} | 340 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_article(index):\n with conn.cursor(cursor_factory=DictCursor) as cur:",
" query = \"SELECT * FROM articles WHERE index=\"+str(index)\n cur.execute(query)",
" article = cur.fetchone()\n return article"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 133,
"char_start": 132,
"chars": "%"
},
{
"char_end": 135,
"char_start": 134,
"chars": "\""
},
{
"char_end": 172,
"char_start": 161,
"chars": ", (index, )"
}
],
"deleted": [
{
"char_end": 134,
"char_start": 132,
"chars": "\"+"
},
{
"char_end": 144,
"char_start": 135,
"chars": "tr(index)"
}
]
},
"commit_link": "github.com/sepehr125/arxiv-doc2vec-recommender/commit/f23a4c32e6192b145017f64734b0a9a384c9123a",
"file_name": "app.py",
"func_name": "get_article",
"line_changes": {
"added": [
{
"char_end": 136,
"char_start": 80,
"line": " query = \"SELECT * FROM articles WHERE index=%s\"\n",
"line_no": 3
},
{
"char_end": 174,
"char_start": 136,
"line": " cur.execute(query, (index, ))\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 145,
"char_start": 80,
"line": " query = \"SELECT * FROM articles WHERE index=\"+str(index)\n",
"line_no": 3
},
{
"char_end": 172,
"char_start": 145,
"line": " cur.execute(query)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-089"
} | 341 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_article(index):\n with conn.cursor(cursor_factory=DictCursor) as cur:",
" query = \"SELECT * FROM articles WHERE index=%s\"\n cur.execute(query, (index, ))",
" article = cur.fetchone()\n return article"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 133,
"char_start": 132,
"chars": "%"
},
{
"char_end": 135,
"char_start": 134,
"chars": "\""
},
{
"char_end": 172,
"char_start": 161,
"chars": ", (index, )"
}
],
"deleted": [
{
"char_end": 134,
"char_start": 132,
"chars": "\"+"
},
{
"char_end": 144,
"char_start": 135,
"chars": "tr(index)"
}
]
},
"commit_link": "github.com/sepehr125/arxiv-doc2vec-recommender/commit/f23a4c32e6192b145017f64734b0a9a384c9123a",
"file_name": "app.py",
"func_name": "get_article",
"line_changes": {
"added": [
{
"char_end": 136,
"char_start": 80,
"line": " query = \"SELECT * FROM articles WHERE index=%s\"\n",
"line_no": 3
},
{
"char_end": 174,
"char_start": 136,
"line": " cur.execute(query, (index, ))\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 145,
"char_start": 80,
"line": " query = \"SELECT * FROM articles WHERE index=\"+str(index)\n",
"line_no": 3
},
{
"char_end": 172,
"char_start": 145,
"line": " cur.execute(query)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-089"
} | 341 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def create_cf_base():\n url = 'http://codeforces.com/problemset/'\n r = requests.get(url)\n max_page = 0\n soup = BeautifulSoup(r.text, \"lxml\")\n base = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\cf.db\")\n conn = base.cursor()\n conn.execute(\"create table problems (problem INTEGER, diff CHAR)\")\n for i in available_tags:",
" conn.execute(\"create table \" + i + \" (problems INTEGER, diff CHAR)\")",
"\n for link in soup.find_all(attrs={\"class\" : \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[3]))",
" a = 0\n b = 0\n f = False\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/problemset/' + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n old = ''\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5 and old != s[3] + s[4]:\n a = s[3]\n b = s[4]\n old = s[3] + s[4]\n if not f:\n f = True\n last_update = old\n conn.execute(\"insert into problems values (?, ?)\", (a, b))\n if len(s) == 4 and s[3] in available_tags:",
" conn.execute(\"insert into \" + s[3] + \" values (?, ?)\", (a, b))",
"\n base.commit()\n base.close()\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"create table users (chat_id INTEGER, username STRING, last_update STRING, last_problem STRING, state INTEGER)\")\n conn.execute(\"create table last_update_problemset (problem STRING)\")\n conn.execute(\"insert into last_update_problemset values (?)\", (last_update, ))\n settings.commit()\n settings.close()"
] | [
1,
0,
1,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 396,
"char_start": 395,
"chars": "?"
},
{
"char_end": 433,
"char_start": 427,
"chars": ", (i,)"
},
{
"char_end": 1430,
"char_start": 1429,
"chars": "?"
},
{
"char_end": 1454,
"char_start": 1448,
"chars": "s[3], "
}
],
"deleted": [
{
"char_end": 404,
"char_start": 395,
"chars": "\" + i + \""
},
{
"char_end": 1443,
"char_start": 1431,
"chars": "\" + s[3] + \""
}
]
},
"commit_link": "github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90",
"file_name": "bases/createcfbase.py",
"func_name": "create_cf_base",
"line_changes": {
"added": [
{
"char_end": 435,
"char_start": 360,
"line": " conn.execute(\"create table ? (problems INTEGER, diff CHAR)\", (i,))\n",
"line_no": 10
},
{
"char_end": 1461,
"char_start": 1383,
"line": " conn.execute(\"insert into ? values (?, ?)\", (s[3], a, b))\n",
"line_no": 37
}
],
"deleted": [
{
"char_end": 437,
"char_start": 360,
"line": " conn.execute(\"create table \" + i + \" (problems INTEGER, diff CHAR)\")\n",
"line_no": 10
},
{
"char_end": 1468,
"char_start": 1385,
"line": " conn.execute(\"insert into \" + s[3] + \" values (?, ?)\", (a, b))\n",
"line_no": 37
}
]
},
"vul_type": "cwe-089"
} | 342 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def create_cf_base():\n url = 'http://codeforces.com/problemset/'\n r = requests.get(url)\n max_page = 0\n soup = BeautifulSoup(r.text, \"lxml\")\n base = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\cf.db\")\n conn = base.cursor()\n conn.execute(\"create table problems (problem INTEGER, diff CHAR)\")\n for i in available_tags:",
" conn.execute(\"create table ? (problems INTEGER, diff CHAR)\", (i,))",
"\n for link in soup.find_all(attrs={\"class\" : \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[3]))",
" a = 0\n b = 0\n f = False\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/problemset/' + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n old = ''\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5 and old != s[3] + s[4]:\n a = s[3]\n b = s[4]\n old = s[3] + s[4]\n if not f:\n f = True\n last_update = old\n conn.execute(\"insert into problems values (?, ?)\", (a, b))\n if len(s) == 4 and s[3] in available_tags:",
" conn.execute(\"insert into ? values (?, ?)\", (s[3], a, b))",
"\n base.commit()\n base.close()\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"create table users (chat_id INTEGER, username STRING, last_update STRING, last_problem STRING, state INTEGER)\")\n conn.execute(\"create table last_update_problemset (problem STRING)\")\n conn.execute(\"insert into last_update_problemset values (?)\", (last_update, ))\n settings.commit()\n settings.close()"
] | [
1,
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 396,
"char_start": 395,
"chars": "?"
},
{
"char_end": 433,
"char_start": 427,
"chars": ", (i,)"
},
{
"char_end": 1430,
"char_start": 1429,
"chars": "?"
},
{
"char_end": 1454,
"char_start": 1448,
"chars": "s[3], "
}
],
"deleted": [
{
"char_end": 404,
"char_start": 395,
"chars": "\" + i + \""
},
{
"char_end": 1443,
"char_start": 1431,
"chars": "\" + s[3] + \""
}
]
},
"commit_link": "github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90",
"file_name": "bases/createcfbase.py",
"func_name": "create_cf_base",
"line_changes": {
"added": [
{
"char_end": 435,
"char_start": 360,
"line": " conn.execute(\"create table ? (problems INTEGER, diff CHAR)\", (i,))\n",
"line_no": 10
},
{
"char_end": 1461,
"char_start": 1383,
"line": " conn.execute(\"insert into ? values (?, ?)\", (s[3], a, b))\n",
"line_no": 37
}
],
"deleted": [
{
"char_end": 437,
"char_start": 360,
"line": " conn.execute(\"create table \" + i + \" (problems INTEGER, diff CHAR)\")\n",
"line_no": 10
},
{
"char_end": 1468,
"char_start": 1385,
"line": " conn.execute(\"insert into \" + s[3] + \" values (?, ?)\", (a, b))\n",
"line_no": 37
}
]
},
"vul_type": "cwe-089"
} | 342 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def closeGame(ID):",
"\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = %i\" % ID)",
"\tdatabase.commit()"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 76,
"char_start": 75,
"chars": "?"
},
{
"char_end": 78,
"char_start": 77,
"chars": ","
}
],
"deleted": [
{
"char_end": 77,
"char_start": 75,
"chars": "%i"
},
{
"char_end": 80,
"char_start": 78,
"chars": " %"
}
]
},
"commit_link": "github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2",
"file_name": "plugins/database.py",
"func_name": "closeGame",
"line_changes": {
"added": [
{
"char_end": 83,
"char_start": 19,
"line": "\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = ?\", ID)\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 85,
"char_start": 19,
"line": "\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = %i\" % ID)\n",
"line_no": 2
}
]
},
"vul_type": "cwe-089"
} | 343 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def closeGame(ID):",
"\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = ?\", ID)",
"\tdatabase.commit()"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 76,
"char_start": 75,
"chars": "?"
},
{
"char_end": 78,
"char_start": 77,
"chars": ","
}
],
"deleted": [
{
"char_end": 77,
"char_start": 75,
"chars": "%i"
},
{
"char_end": 80,
"char_start": 78,
"chars": " %"
}
]
},
"commit_link": "github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2",
"file_name": "plugins/database.py",
"func_name": "closeGame",
"line_changes": {
"added": [
{
"char_end": 83,
"char_start": 19,
"line": "\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = ?\", ID)\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 85,
"char_start": 19,
"line": "\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = %i\" % ID)\n",
"line_no": 2
}
]
},
"vul_type": "cwe-089"
} | 343 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def cancelFollow(self,userid,friendid):",
" sqlText=\"delete from friends where userid=%d and friendid=%d;\"%(userid,friendid)\n result=sql.deleteDB(self.conn,sqlText)",
" return result;"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 112,
"char_start": 111,
"chars": "s"
},
{
"char_end": 131,
"char_start": 114,
"chars": "\n params=["
},
{
"char_end": 147,
"char_start": 146,
"chars": "]"
},
{
"char_end": 200,
"char_start": 193,
"chars": ",params"
}
],
"deleted": [
{
"char_end": 112,
"char_start": 111,
"chars": "d"
},
{
"char_end": 116,
"char_start": 114,
"chars": "%("
},
{
"char_end": 132,
"char_start": 131,
"chars": ")"
}
]
},
"commit_link": "github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9",
"file_name": "modules/users.py",
"func_name": "cancelFollow",
"line_changes": {
"added": [
{
"char_end": 115,
"char_start": 44,
"line": " sqlText=\"delete from friends where userid=%d and friendid=%s;\"\n",
"line_no": 2
},
{
"char_end": 148,
"char_start": 115,
"line": " params=[userid,friendid]\n",
"line_no": 3
},
{
"char_end": 202,
"char_start": 148,
"line": " result=sql.deleteDB(self.conn,sqlText,params)\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 133,
"char_start": 44,
"line": " sqlText=\"delete from friends where userid=%d and friendid=%d;\"%(userid,friendid)\n",
"line_no": 2
},
{
"char_end": 180,
"char_start": 133,
"line": " result=sql.deleteDB(self.conn,sqlText)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 344 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def cancelFollow(self,userid,friendid):",
" sqlText=\"delete from friends where userid=%d and friendid=%s;\"\n params=[userid,friendid]\n result=sql.deleteDB(self.conn,sqlText,params)",
" return result;"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 112,
"char_start": 111,
"chars": "s"
},
{
"char_end": 131,
"char_start": 114,
"chars": "\n params=["
},
{
"char_end": 147,
"char_start": 146,
"chars": "]"
},
{
"char_end": 200,
"char_start": 193,
"chars": ",params"
}
],
"deleted": [
{
"char_end": 112,
"char_start": 111,
"chars": "d"
},
{
"char_end": 116,
"char_start": 114,
"chars": "%("
},
{
"char_end": 132,
"char_start": 131,
"chars": ")"
}
]
},
"commit_link": "github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9",
"file_name": "modules/users.py",
"func_name": "cancelFollow",
"line_changes": {
"added": [
{
"char_end": 115,
"char_start": 44,
"line": " sqlText=\"delete from friends where userid=%d and friendid=%s;\"\n",
"line_no": 2
},
{
"char_end": 148,
"char_start": 115,
"line": " params=[userid,friendid]\n",
"line_no": 3
},
{
"char_end": 202,
"char_start": 148,
"line": " result=sql.deleteDB(self.conn,sqlText,params)\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 133,
"char_start": 44,
"line": " sqlText=\"delete from friends where userid=%d and friendid=%d;\"%(userid,friendid)\n",
"line_no": 2
},
{
"char_end": 180,
"char_start": 133,
"line": " result=sql.deleteDB(self.conn,sqlText)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 344 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def change_pass(self, new_pass, logged_user):\n update_sql = \"\"\"\n UPDATE Clients",
" SET password = '{}'\n WHERE client_id = '{}'\n \"\"\".format(new_pass, logged_user.get_client_id())",
"\n cursor = self.__conn.cursor()\n",
" cursor.execute(update_sql)",
" self.__conn.commit()"
] | [
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 130,
"char_start": 129,
"chars": "?"
},
{
"char_end": 162,
"char_start": 161,
"chars": "?"
},
{
"char_end": 289,
"char_start": 248,
"chars": ", (new_pass, logged_user.get_client_id())"
}
],
"deleted": [
{
"char_end": 133,
"char_start": 129,
"chars": "'{}'"
},
{
"char_end": 168,
"char_start": 164,
"chars": "'{}'"
},
{
"char_end": 226,
"char_start": 180,
"chars": ".format(new_pass, logged_user.get_client_id())"
}
]
},
"commit_link": "github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3",
"file_name": "Week_9/sql_manager.py",
"func_name": "change_pass",
"line_changes": {
"added": [
{
"char_end": 131,
"char_start": 102,
"line": " SET password = ?\n",
"line_no": 4
},
{
"char_end": 163,
"char_start": 131,
"line": " WHERE client_id = ?\n",
"line_no": 5
},
{
"char_end": 175,
"char_start": 163,
"line": " \"\"\"\n",
"line_no": 6
},
{
"char_end": 291,
"char_start": 215,
"line": " cursor.execute(update_sql, (new_pass, logged_user.get_client_id()))\n",
"line_no": 10
}
],
"deleted": [
{
"char_end": 134,
"char_start": 102,
"line": " SET password = '{}'\n",
"line_no": 4
},
{
"char_end": 169,
"char_start": 134,
"line": " WHERE client_id = '{}'\n",
"line_no": 5
},
{
"char_end": 227,
"char_start": 169,
"line": " \"\"\".format(new_pass, logged_user.get_client_id())\n",
"line_no": 6
},
{
"char_end": 302,
"char_start": 267,
"line": " cursor.execute(update_sql)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-089"
} | 345 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def change_pass(self, new_pass, logged_user):\n update_sql = \"\"\"\n UPDATE Clients",
" SET password = ?\n WHERE client_id = ?\n \"\"\"",
"\n cursor = self.__conn.cursor()\n",
" cursor.execute(update_sql, (new_pass, logged_user.get_client_id()))",
" self.__conn.commit()"
] | [
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 130,
"char_start": 129,
"chars": "?"
},
{
"char_end": 162,
"char_start": 161,
"chars": "?"
},
{
"char_end": 289,
"char_start": 248,
"chars": ", (new_pass, logged_user.get_client_id())"
}
],
"deleted": [
{
"char_end": 133,
"char_start": 129,
"chars": "'{}'"
},
{
"char_end": 168,
"char_start": 164,
"chars": "'{}'"
},
{
"char_end": 226,
"char_start": 180,
"chars": ".format(new_pass, logged_user.get_client_id())"
}
]
},
"commit_link": "github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3",
"file_name": "Week_9/sql_manager.py",
"func_name": "change_pass",
"line_changes": {
"added": [
{
"char_end": 131,
"char_start": 102,
"line": " SET password = ?\n",
"line_no": 4
},
{
"char_end": 163,
"char_start": 131,
"line": " WHERE client_id = ?\n",
"line_no": 5
},
{
"char_end": 175,
"char_start": 163,
"line": " \"\"\"\n",
"line_no": 6
},
{
"char_end": 291,
"char_start": 215,
"line": " cursor.execute(update_sql, (new_pass, logged_user.get_client_id()))\n",
"line_no": 10
}
],
"deleted": [
{
"char_end": 134,
"char_start": 102,
"line": " SET password = '{}'\n",
"line_no": 4
},
{
"char_end": 169,
"char_start": 134,
"line": " WHERE client_id = '{}'\n",
"line_no": 5
},
{
"char_end": 227,
"char_start": 169,
"line": " \"\"\".format(new_pass, logged_user.get_client_id())\n",
"line_no": 6
},
{
"char_end": 302,
"char_start": 267,
"line": " cursor.execute(update_sql)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-089"
} | 345 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def getCommentsByPostid(self,postid,userid):",
" sqlText=\"select (select Count(*) from comment_like where comments.commentid = comment_like.commentid) as like,(select Count(*) from comment_like where comments.commentid = comment_like.commentid and comment_like.userid=%d) as flag,commentid,name,comment from users,comments where users.userid=comments.userid and postid=%d order by date desc;\"%(userid,postid)\n result=sql.queryDB(self.conn,sqlText)",
" return result;"
] | [
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 124,
"char_start": 114,
"chars": "\\\n "
},
{
"char_end": 212,
"char_start": 194,
"chars": "\\\n "
},
{
"char_end": 275,
"char_start": 257,
"chars": "\\\n "
},
{
"char_end": 324,
"char_start": 323,
"chars": "s"
},
{
"char_end": 347,
"char_start": 329,
"chars": "\\\n "
},
{
"char_end": 419,
"char_start": 401,
"chars": "\\\n "
},
{
"char_end": 461,
"char_start": 460,
"chars": "s"
},
{
"char_end": 499,
"char_start": 482,
"chars": "\n params=["
},
{
"char_end": 513,
"char_start": 512,
"chars": "]"
},
{
"char_end": 565,
"char_start": 558,
"chars": ",params"
}
],
"deleted": [
{
"char_end": 278,
"char_start": 277,
"chars": "d"
},
{
"char_end": 379,
"char_start": 378,
"chars": "d"
},
{
"char_end": 402,
"char_start": 400,
"chars": "%("
},
{
"char_end": 416,
"char_start": 415,
"chars": ")"
}
]
},
"commit_link": "github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9",
"file_name": "modules/comment.py",
"func_name": "getCommentsByPostid",
"line_changes": {
"added": [
{
"char_end": 116,
"char_start": 49,
"line": " sqlText=\"select (select Count(*) from comment_like where \\\n",
"line_no": 2
},
{
"char_end": 196,
"char_start": 116,
"line": " comments.commentid = comment_like.commentid) as like,(select Count(*) \\\n",
"line_no": 3
},
{
"char_end": 259,
"char_start": 196,
"line": " from comment_like where comments.commentid = \\\n",
"line_no": 4
},
{
"char_end": 331,
"char_start": 259,
"line": " comment_like.commentid and comment_like.userid=%s) as \\\n",
"line_no": 5
},
{
"char_end": 403,
"char_start": 331,
"line": " flag,commentid,name,comment from users,comments where \\\n",
"line_no": 6
},
{
"char_end": 483,
"char_start": 403,
"line": " users.userid=comments.userid and postid=%s order by date desc;\"\n",
"line_no": 7
},
{
"char_end": 514,
"char_start": 483,
"line": " params=[userid,postid]\n",
"line_no": 8
},
{
"char_end": 567,
"char_start": 514,
"line": " result=sql.queryDB(self.conn,sqlText,params)\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 417,
"char_start": 49,
"line": " sqlText=\"select (select Count(*) from comment_like where comments.commentid = comment_like.commentid) as like,(select Count(*) from comment_like where comments.commentid = comment_like.commentid and comment_like.userid=%d) as flag,commentid,name,comment from users,comments where users.userid=comments.userid and postid=%d order by date desc;\"%(userid,postid)\n",
"line_no": 2
},
{
"char_end": 463,
"char_start": 417,
"line": " result=sql.queryDB(self.conn,sqlText)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 346 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def getCommentsByPostid(self,postid,userid):",
" sqlText=\"select (select Count(*) from comment_like where \\\n comments.commentid = comment_like.commentid) as like,(select Count(*) \\\n from comment_like where comments.commentid = \\\n comment_like.commentid and comment_like.userid=%s) as \\\n flag,commentid,name,comment from users,comments where \\\n users.userid=comments.userid and postid=%s order by date desc;\"\n params=[userid,postid]\n result=sql.queryDB(self.conn,sqlText,params)",
" return result;"
] | [
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 124,
"char_start": 114,
"chars": "\\\n "
},
{
"char_end": 212,
"char_start": 194,
"chars": "\\\n "
},
{
"char_end": 275,
"char_start": 257,
"chars": "\\\n "
},
{
"char_end": 324,
"char_start": 323,
"chars": "s"
},
{
"char_end": 347,
"char_start": 329,
"chars": "\\\n "
},
{
"char_end": 419,
"char_start": 401,
"chars": "\\\n "
},
{
"char_end": 461,
"char_start": 460,
"chars": "s"
},
{
"char_end": 499,
"char_start": 482,
"chars": "\n params=["
},
{
"char_end": 513,
"char_start": 512,
"chars": "]"
},
{
"char_end": 565,
"char_start": 558,
"chars": ",params"
}
],
"deleted": [
{
"char_end": 278,
"char_start": 277,
"chars": "d"
},
{
"char_end": 379,
"char_start": 378,
"chars": "d"
},
{
"char_end": 402,
"char_start": 400,
"chars": "%("
},
{
"char_end": 416,
"char_start": 415,
"chars": ")"
}
]
},
"commit_link": "github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9",
"file_name": "modules/comment.py",
"func_name": "getCommentsByPostid",
"line_changes": {
"added": [
{
"char_end": 116,
"char_start": 49,
"line": " sqlText=\"select (select Count(*) from comment_like where \\\n",
"line_no": 2
},
{
"char_end": 196,
"char_start": 116,
"line": " comments.commentid = comment_like.commentid) as like,(select Count(*) \\\n",
"line_no": 3
},
{
"char_end": 259,
"char_start": 196,
"line": " from comment_like where comments.commentid = \\\n",
"line_no": 4
},
{
"char_end": 331,
"char_start": 259,
"line": " comment_like.commentid and comment_like.userid=%s) as \\\n",
"line_no": 5
},
{
"char_end": 403,
"char_start": 331,
"line": " flag,commentid,name,comment from users,comments where \\\n",
"line_no": 6
},
{
"char_end": 483,
"char_start": 403,
"line": " users.userid=comments.userid and postid=%s order by date desc;\"\n",
"line_no": 7
},
{
"char_end": 514,
"char_start": 483,
"line": " params=[userid,postid]\n",
"line_no": 8
},
{
"char_end": 567,
"char_start": 514,
"line": " result=sql.queryDB(self.conn,sqlText,params)\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 417,
"char_start": 49,
"line": " sqlText=\"select (select Count(*) from comment_like where comments.commentid = comment_like.commentid) as like,(select Count(*) from comment_like where comments.commentid = comment_like.commentid and comment_like.userid=%d) as flag,commentid,name,comment from users,comments where users.userid=comments.userid and postid=%d order by date desc;\"%(userid,postid)\n",
"line_no": 2
},
{
"char_end": 463,
"char_start": 417,
"line": " result=sql.queryDB(self.conn,sqlText)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-089"
} | 346 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def callback(recipeName):\n menu.pack_forget()\n viewRecipeFrame.pack(expand=True, fill='both')\n groceryButton.pack_forget()\n database_file = \"meal_planner.db\"\n print(recipeName)\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()",
" selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = \"\"\" + \"\\\"\" + recipeName + \"\\\"\")",
" for result in [selection]:\n for row in result.fetchall():\n name = row[0]\n time = row[1]\n servings = row[2]\n ingredients = row[4]\n directions = row[5]",
" string = (\"Name: {} \\n Cook time: {} \\n Number of Servings: {} \\n \".format(name, time, servings))\n secondString = (\"Ingredients: {}\".format(ingredients))\n thirdString = (\"Directions: {}\".format(directions))\n Label(viewRecipeFrame, text=string, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=secondString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=thirdString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [viewRecipeFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)"
] | [
1,
0,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 418,
"char_start": 416,
"chars": "?;"
},
{
"char_end": 422,
"char_start": 421,
"chars": ","
},
{
"char_end": 424,
"char_start": 423,
"chars": "("
},
{
"char_end": 435,
"char_start": 434,
"chars": ","
},
{
"char_end": 437,
"char_start": 436,
"chars": ")"
}
],
"deleted": [
{
"char_end": 421,
"char_start": 419,
"chars": " +"
},
{
"char_end": 429,
"char_start": 422,
"chars": "\"\\\"\" + "
},
{
"char_end": 441,
"char_start": 439,
"chars": " +"
},
{
"char_end": 446,
"char_start": 442,
"chars": "\"\\\"\""
}
]
},
"commit_link": "github.com/trishamoyer/RecipePlanner-Python/commit/44d2ce370715d9344fad34b3b749322ab095a925",
"file_name": "mealPlan.py",
"func_name": "__init__.callback",
"line_changes": {
"added": [
{
"char_end": 439,
"char_start": 336,
"line": " selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = ?;\"\"\", (recipeName, ))\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 448,
"char_start": 336,
"line": " selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = \"\"\" + \"\\\"\" + recipeName + \"\\\"\")\n",
"line_no": 9
}
]
},
"vul_type": "cwe-089"
} | 347 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def callback(recipeName):\n menu.pack_forget()\n viewRecipeFrame.pack(expand=True, fill='both')\n groceryButton.pack_forget()\n database_file = \"meal_planner.db\"\n print(recipeName)\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()",
" selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = ?;\"\"\", (recipeName, ))",
" for result in [selection]:\n for row in result.fetchall():\n name = row[0]\n time = row[1]\n servings = row[2]\n ingredients = row[4]\n directions = row[5]",
" string = (\"Name: {} \\n Cook time: {} \\n Number of Servings: {} \\n \".format(name, time, servings))\n secondString = (\"Ingredients: {}\".format(ingredients))\n thirdString = (\"Directions: {}\".format(directions))\n Label(viewRecipeFrame, text=string, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=secondString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=thirdString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [viewRecipeFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)"
] | [
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 418,
"char_start": 416,
"chars": "?;"
},
{
"char_end": 422,
"char_start": 421,
"chars": ","
},
{
"char_end": 424,
"char_start": 423,
"chars": "("
},
{
"char_end": 435,
"char_start": 434,
"chars": ","
},
{
"char_end": 437,
"char_start": 436,
"chars": ")"
}
],
"deleted": [
{
"char_end": 421,
"char_start": 419,
"chars": " +"
},
{
"char_end": 429,
"char_start": 422,
"chars": "\"\\\"\" + "
},
{
"char_end": 441,
"char_start": 439,
"chars": " +"
},
{
"char_end": 446,
"char_start": 442,
"chars": "\"\\\"\""
}
]
},
"commit_link": "github.com/trishamoyer/RecipePlanner-Python/commit/44d2ce370715d9344fad34b3b749322ab095a925",
"file_name": "mealPlan.py",
"func_name": "__init__.callback",
"line_changes": {
"added": [
{
"char_end": 439,
"char_start": 336,
"line": " selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = ?;\"\"\", (recipeName, ))\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 448,
"char_start": 336,
"line": " selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = \"\"\" + \"\\\"\" + recipeName + \"\\\"\")\n",
"line_no": 9
}
]
},
"vul_type": "cwe-089"
} | 347 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@jwt_required\n def patch(self, user_id):\n \"\"\" Replaces information of corresponding user_id with request body \"\"\"\n query = f\"\"\"update users set user_id = %s \"\"\"",
" query += f\"\"\"where user_id = '{user_id}'\"\"\"",
" json_data = request.get_json()",
" parameters = (json_data['user_id'], )",
" database_utilities.execute_query(query, parameters)"
] | [
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 220,
"char_start": 219,
"chars": "%"
},
{
"char_end": 315,
"char_start": 308,
"chars": "user_id"
}
],
"deleted": [
{
"char_end": 222,
"char_start": 219,
"chars": "'{u"
},
{
"char_end": 230,
"char_start": 223,
"chars": "er_id}'"
}
]
},
"commit_link": "github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485",
"file_name": "apis/users.py",
"func_name": "patch",
"line_changes": {
"added": [
{
"char_end": 225,
"char_start": 182,
"line": " query += f\"\"\"where user_id = %s\"\"\"\n",
"line_no": 5
},
{
"char_end": 317,
"char_start": 264,
"line": " parameters = (json_data['user_id'], user_id)\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 234,
"char_start": 182,
"line": " query += f\"\"\"where user_id = '{user_id}'\"\"\"\n",
"line_no": 5
},
{
"char_end": 319,
"char_start": 273,
"line": " parameters = (json_data['user_id'], )\n",
"line_no": 7
}
]
},
"vul_type": "cwe-089"
} | 348 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@jwt_required\n def patch(self, user_id):\n \"\"\" Replaces information of corresponding user_id with request body \"\"\"\n query = f\"\"\"update users set user_id = %s \"\"\"",
" query += f\"\"\"where user_id = %s\"\"\"",
" json_data = request.get_json()",
" parameters = (json_data['user_id'], user_id)",
" database_utilities.execute_query(query, parameters)"
] | [
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 220,
"char_start": 219,
"chars": "%"
},
{
"char_end": 315,
"char_start": 308,
"chars": "user_id"
}
],
"deleted": [
{
"char_end": 222,
"char_start": 219,
"chars": "'{u"
},
{
"char_end": 230,
"char_start": 223,
"chars": "er_id}'"
}
]
},
"commit_link": "github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485",
"file_name": "apis/users.py",
"func_name": "patch",
"line_changes": {
"added": [
{
"char_end": 225,
"char_start": 182,
"line": " query += f\"\"\"where user_id = %s\"\"\"\n",
"line_no": 5
},
{
"char_end": 317,
"char_start": 264,
"line": " parameters = (json_data['user_id'], user_id)\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 234,
"char_start": 182,
"line": " query += f\"\"\"where user_id = '{user_id}'\"\"\"\n",
"line_no": 5
},
{
"char_end": 319,
"char_start": 273,
"line": " parameters = (json_data['user_id'], )\n",
"line_no": 7
}
]
},
"vul_type": "cwe-089"
} | 348 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@mod.route('/edit', methods=['GET', 'POST'])\ndef edit():",
" sql = \"SELECT * FROM users where email = '%s';\" % (session['logged_email'])\n cursor.execute(sql)",
" u = cursor.fetchone()\n if request.method == 'POST':",
" sql = \"UPDATE users SET nickname = '%s' where email = '%s'\" \\\n % (request.form['nickname'], session['logged_email'])\n cursor.execute(sql)\n sql = \"SELECT * FROM users where email = '%s';\" \\\n % (session['logged_email'])\n cursor.execute(sql)",
" u = cursor.fetchone()\n conn.commit()\n flash('Edit Nickname Success!')\n return render_template('users/edit.html', u=u)"
] | [
1,
0,
1,
0,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 64,
"char_start": 61,
"chars": "cur"
},
{
"char_end": 76,
"char_start": 65,
"chars": "or.execute("
},
{
"char_end": 116,
"char_start": 115,
"chars": ","
},
{
"char_end": 142,
"char_start": 141,
"chars": ","
},
{
"char_end": 215,
"char_start": 212,
"chars": "cur"
},
{
"char_end": 227,
"char_start": 216,
"chars": "or.execute("
},
{
"char_end": 277,
"char_start": 276,
"chars": ","
},
{
"char_end": 330,
"char_start": 329,
"chars": ")"
},
{
"char_end": 394,
"char_start": 393,
"chars": ","
},
{
"char_end": 420,
"char_start": 419,
"chars": ","
}
],
"deleted": [
{
"char_end": 67,
"char_start": 62,
"chars": "ql = "
},
{
"char_end": 103,
"char_start": 102,
"chars": "'"
},
{
"char_end": 106,
"char_start": 105,
"chars": "'"
},
{
"char_end": 110,
"char_start": 108,
"chars": " %"
},
{
"char_end": 159,
"char_start": 136,
"chars": "\n cursor.execute(sql"
},
{
"char_end": 234,
"char_start": 229,
"chars": "ql = "
},
{
"char_end": 264,
"char_start": 263,
"chars": "'"
},
{
"char_end": 267,
"char_start": 266,
"chars": "'"
},
{
"char_end": 283,
"char_start": 282,
"chars": "'"
},
{
"char_end": 286,
"char_start": 285,
"chars": "'"
},
{
"char_end": 299,
"char_start": 287,
"chars": " \\\n %"
},
{
"char_end": 394,
"char_start": 375,
"chars": "sql)\n sql = "
},
{
"char_end": 430,
"char_start": 429,
"chars": "'"
},
{
"char_end": 433,
"char_start": 432,
"chars": "'"
},
{
"char_end": 451,
"char_start": 435,
"chars": " \\\n %"
},
{
"char_end": 504,
"char_start": 477,
"chars": "\n cursor.execute(sql"
}
]
},
"commit_link": "github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9",
"file_name": "flaskr/flaskr/views/users.py",
"func_name": "edit",
"line_changes": {
"added": [
{
"char_end": 145,
"char_start": 57,
"line": " cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))\n",
"line_no": 3
},
{
"char_end": 331,
"char_start": 204,
"line": " cursor.execute(\"UPDATE users SET nickname = %s where email = %s\", (request.form['nickname'], session['logged_email']))\n",
"line_no": 6
},
{
"char_end": 423,
"char_start": 331,
"line": " cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 137,
"char_start": 57,
"line": " sql = \"SELECT * FROM users where email = '%s';\" % (session['logged_email'])\n",
"line_no": 3
},
{
"char_end": 161,
"char_start": 137,
"line": " cursor.execute(sql)\n",
"line_no": 4
},
{
"char_end": 290,
"char_start": 220,
"line": " sql = \"UPDATE users SET nickname = '%s' where email = '%s'\" \\\n",
"line_no": 7
},
{
"char_end": 352,
"char_start": 290,
"line": " % (request.form['nickname'], session['logged_email'])\n",
"line_no": 8
},
{
"char_end": 380,
"char_start": 352,
"line": " cursor.execute(sql)\n",
"line_no": 9
},
{
"char_end": 438,
"char_start": 380,
"line": " sql = \"SELECT * FROM users where email = '%s';\" \\\n",
"line_no": 10
},
{
"char_end": 478,
"char_start": 438,
"line": " % (session['logged_email'])\n",
"line_no": 11
},
{
"char_end": 506,
"char_start": 478,
"line": " cursor.execute(sql)\n",
"line_no": 12
}
]
},
"vul_type": "cwe-089"
} | 349 | cwe-089 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@mod.route('/edit', methods=['GET', 'POST'])\ndef edit():",
" cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))",
" u = cursor.fetchone()\n if request.method == 'POST':",
" cursor.execute(\"UPDATE users SET nickname = %s where email = %s\", (request.form['nickname'], session['logged_email']))\n cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))",
" u = cursor.fetchone()\n conn.commit()\n flash('Edit Nickname Success!')\n return render_template('users/edit.html', u=u)"
] | [
1,
1,
1,
1,
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 64,
"char_start": 61,
"chars": "cur"
},
{
"char_end": 76,
"char_start": 65,
"chars": "or.execute("
},
{
"char_end": 116,
"char_start": 115,
"chars": ","
},
{
"char_end": 142,
"char_start": 141,
"chars": ","
},
{
"char_end": 215,
"char_start": 212,
"chars": "cur"
},
{
"char_end": 227,
"char_start": 216,
"chars": "or.execute("
},
{
"char_end": 277,
"char_start": 276,
"chars": ","
},
{
"char_end": 330,
"char_start": 329,
"chars": ")"
},
{
"char_end": 394,
"char_start": 393,
"chars": ","
},
{
"char_end": 420,
"char_start": 419,
"chars": ","
}
],
"deleted": [
{
"char_end": 67,
"char_start": 62,
"chars": "ql = "
},
{
"char_end": 103,
"char_start": 102,
"chars": "'"
},
{
"char_end": 106,
"char_start": 105,
"chars": "'"
},
{
"char_end": 110,
"char_start": 108,
"chars": " %"
},
{
"char_end": 159,
"char_start": 136,
"chars": "\n cursor.execute(sql"
},
{
"char_end": 234,
"char_start": 229,
"chars": "ql = "
},
{
"char_end": 264,
"char_start": 263,
"chars": "'"
},
{
"char_end": 267,
"char_start": 266,
"chars": "'"
},
{
"char_end": 283,
"char_start": 282,
"chars": "'"
},
{
"char_end": 286,
"char_start": 285,
"chars": "'"
},
{
"char_end": 299,
"char_start": 287,
"chars": " \\\n %"
},
{
"char_end": 394,
"char_start": 375,
"chars": "sql)\n sql = "
},
{
"char_end": 430,
"char_start": 429,
"chars": "'"
},
{
"char_end": 433,
"char_start": 432,
"chars": "'"
},
{
"char_end": 451,
"char_start": 435,
"chars": " \\\n %"
},
{
"char_end": 504,
"char_start": 477,
"chars": "\n cursor.execute(sql"
}
]
},
"commit_link": "github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9",
"file_name": "flaskr/flaskr/views/users.py",
"func_name": "edit",
"line_changes": {
"added": [
{
"char_end": 145,
"char_start": 57,
"line": " cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))\n",
"line_no": 3
},
{
"char_end": 331,
"char_start": 204,
"line": " cursor.execute(\"UPDATE users SET nickname = %s where email = %s\", (request.form['nickname'], session['logged_email']))\n",
"line_no": 6
},
{
"char_end": 423,
"char_start": 331,
"line": " cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 137,
"char_start": 57,
"line": " sql = \"SELECT * FROM users where email = '%s';\" % (session['logged_email'])\n",
"line_no": 3
},
{
"char_end": 161,
"char_start": 137,
"line": " cursor.execute(sql)\n",
"line_no": 4
},
{
"char_end": 290,
"char_start": 220,
"line": " sql = \"UPDATE users SET nickname = '%s' where email = '%s'\" \\\n",
"line_no": 7
},
{
"char_end": 352,
"char_start": 290,
"line": " % (request.form['nickname'], session['logged_email'])\n",
"line_no": 8
},
{
"char_end": 380,
"char_start": 352,
"line": " cursor.execute(sql)\n",
"line_no": 9
},
{
"char_end": 438,
"char_start": 380,
"line": " sql = \"SELECT * FROM users where email = '%s';\" \\\n",
"line_no": 10
},
{
"char_end": 478,
"char_start": 438,
"line": " % (session['logged_email'])\n",
"line_no": 11
},
{
"char_end": 506,
"char_start": 478,
"line": " cursor.execute(sql)\n",
"line_no": 12
}
]
},
"vul_type": "cwe-089"
} | 349 | cwe-089 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.