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.
[ "def respond_error(self, context, exception):\n context.respond_server_error()\n stack = traceback.format_exc()\n return \"\"\"\n <html>\n <body>", " <style>\n body {\n font-family: sans-serif;\n color: #888;\n text-align: center;\n }", " body pre {\n width: 600px;\n text-align: left;\n margin: auto;\n font-family: monospace;\n }\n </style>", " <img src=\"/ajenti:static/main/error.jpeg\" />\n <br/>\n <p>\n Server error\n </p>\n <pre>\n%s\n </pre>\n </body>\n </html>", " \"\"\" % stack" ]
[ 1, 1, 1, 1, 0 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 896, "char_start": 885, "chars": "cgi.escape(" }, { "char_end": 902, "char_start": 901, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Eugeny/ajenti/commit/d3fc5eb142ff16d55d158afb050af18d5ff09120", "file_name": "ajenti/routing.py", "func_name": "respond_error", "line_changes": { "added": [ { "char_end": 902, "char_start": 871, "line": " \"\"\" % cgi.escape(stack)", "line_no": 33 } ], "deleted": [ { "char_end": 890, "char_start": 871, "line": " \"\"\" % stack\n", "line_no": 33 } ] }, "vul_type": "cwe-079" }
150
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def respond_error(self, context, exception):\n context.respond_server_error()\n stack = traceback.format_exc()\n return \"\"\"\n <html>\n <body>", " <style>\n body {\n font-family: sans-serif;\n color: #888;\n text-align: center;\n }", " body pre {\n width: 600px;\n text-align: left;\n margin: auto;\n font-family: monospace;\n }\n </style>", " <img src=\"/ajenti:static/main/error.jpeg\" />\n <br/>\n <p>\n Server error\n </p>\n <pre>\n%s\n </pre>\n </body>\n </html>", " \"\"\" % cgi.escape(stack)" ]
[ 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 896, "char_start": 885, "chars": "cgi.escape(" }, { "char_end": 902, "char_start": 901, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Eugeny/ajenti/commit/d3fc5eb142ff16d55d158afb050af18d5ff09120", "file_name": "ajenti/routing.py", "func_name": "respond_error", "line_changes": { "added": [ { "char_end": 902, "char_start": 871, "line": " \"\"\" % cgi.escape(stack)", "line_no": 33 } ], "deleted": [ { "char_end": 890, "char_start": 871, "line": " \"\"\" % stack\n", "line_no": 33 } ] }, "vul_type": "cwe-079" }
150
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@check_document_access_permission()\ndef edit_bundle(request):\n bundle_id = request.GET.get('bundle')\n doc = None\n \n if bundle_id:\n doc = Document2.objects.get(id=bundle_id)\n bundle = Bundle(document=doc)\n else:\n bundle = Bundle()", " coordinators = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='coordinator2')]", " return render('editor/bundle_editor.mako', request, {", " 'bundle_json': bundle.json,\n 'coordinators_json': json.dumps(coordinators),", " 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user)) \n })" ]
[ 1, 1, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 541, "char_start": 530, "chars": "_for_html()" }, { "char_end": 617, "char_start": 593, "chars": ", cls=JSONEncoderForHTML" } ], "deleted": [] }, "commit_link": "github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735", "file_name": "apps/oozie/src/oozie/views/editor2.py", "func_name": "edit_bundle", "line_changes": { "added": [ { "char_end": 543, "char_start": 498, "line": " 'bundle_json': bundle.json_for_html(),\n", "line_no": 16 }, { "char_end": 620, "char_start": 543, "line": " 'coordinators_json': json.dumps(coordinators, cls=JSONEncoderForHTML),\n", "line_no": 17 } ], "deleted": [ { "char_end": 532, "char_start": 498, "line": " 'bundle_json': bundle.json,\n", "line_no": 16 }, { "char_end": 585, "char_start": 532, "line": " 'coordinators_json': json.dumps(coordinators),\n", "line_no": 17 } ] }, "vul_type": "cwe-079" }
151
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@check_document_access_permission()\ndef edit_bundle(request):\n bundle_id = request.GET.get('bundle')\n doc = None\n \n if bundle_id:\n doc = Document2.objects.get(id=bundle_id)\n bundle = Bundle(document=doc)\n else:\n bundle = Bundle()", " coordinators = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='coordinator2')]", " return render('editor/bundle_editor.mako', request, {", " 'bundle_json': bundle.json_for_html(),\n 'coordinators_json': json.dumps(coordinators, cls=JSONEncoderForHTML),", " 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user)) \n })" ]
[ 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 541, "char_start": 530, "chars": "_for_html()" }, { "char_end": 617, "char_start": 593, "chars": ", cls=JSONEncoderForHTML" } ], "deleted": [] }, "commit_link": "github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735", "file_name": "apps/oozie/src/oozie/views/editor2.py", "func_name": "edit_bundle", "line_changes": { "added": [ { "char_end": 543, "char_start": 498, "line": " 'bundle_json': bundle.json_for_html(),\n", "line_no": 16 }, { "char_end": 620, "char_start": 543, "line": " 'coordinators_json': json.dumps(coordinators, cls=JSONEncoderForHTML),\n", "line_no": 17 } ], "deleted": [ { "char_end": 532, "char_start": 498, "line": " 'bundle_json': bundle.json,\n", "line_no": 16 }, { "char_end": 585, "char_start": 532, "line": " 'coordinators_json': json.dumps(coordinators),\n", "line_no": 17 } ] }, "vul_type": "cwe-079" }
151
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def history_data(start_time, offset=None):\n \"\"\"Return history data.", " Arguments:\n start_time: select history starting from this timestamp.\n offset: number of items to skip\n \"\"\"\n # history atimes are stored as ints, ensure start_time is not a float\n start_time = int(start_time)\n hist = objreg.get('web-history')\n if offset is not None:\n entries = hist.entries_before(start_time, limit=1000, offset=offset)\n else:\n # end is 24hrs earlier than start\n end_time = start_time - 24*60*60\n entries = hist.entries_between(end_time, start_time)\n", " return [{\"url\": e.url, \"title\": e.title or e.url, \"time\": e.atime}\n for e in entries]" ]
[ 1, 1, 0 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 635, "char_start": 623, "chars": "html.escape(" }, { "char_end": 641, "char_start": 640, "chars": ")" }, { "char_end": 655, "char_start": 642, "chars": "\n " }, { "char_end": 677, "char_start": 665, "chars": "html.escape(" }, { "char_end": 685, "char_start": 684, "chars": ")" }, { "char_end": 701, "char_start": 689, "chars": "html.escape(" }, { "char_end": 707, "char_start": 706, "chars": ")" }, { "char_end": 721, "char_start": 708, "chars": "\n " } ], "deleted": [ { "char_end": 685, "char_start": 673, "chars": "\n " } ] }, "commit_link": "github.com/qutebrowser/qutebrowser/commit/4c9360237f186681b1e3f2a0f30c45161cf405c7", "file_name": "qutebrowser/browser/qutescheme.py", "func_name": "history_data", "line_changes": { "added": [ { "char_end": 643, "char_start": 603, "line": " return [{\"url\": html.escape(e.url),\n", "line_no": 18 }, { "char_end": 709, "char_start": 643, "line": " \"title\": html.escape(e.title) or html.escape(e.url),\n", "line_no": 19 }, { "char_end": 756, "char_start": 709, "line": " \"time\": e.atime} for e in entries]\n", "line_no": 20 } ], "deleted": [ { "char_end": 674, "char_start": 603, "line": " return [{\"url\": e.url, \"title\": e.title or e.url, \"time\": e.atime}\n", "line_no": 18 }, { "char_end": 703, "char_start": 674, "line": " for e in entries]\n", "line_no": 19 } ] }, "vul_type": "cwe-079" }
152
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def history_data(start_time, offset=None):\n \"\"\"Return history data.", " Arguments:\n start_time: select history starting from this timestamp.\n offset: number of items to skip\n \"\"\"\n # history atimes are stored as ints, ensure start_time is not a float\n start_time = int(start_time)\n hist = objreg.get('web-history')\n if offset is not None:\n entries = hist.entries_before(start_time, limit=1000, offset=offset)\n else:\n # end is 24hrs earlier than start\n end_time = start_time - 24*60*60\n entries = hist.entries_between(end_time, start_time)\n", " return [{\"url\": html.escape(e.url),\n \"title\": html.escape(e.title) or html.escape(e.url),\n \"time\": e.atime} for e in entries]" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 635, "char_start": 623, "chars": "html.escape(" }, { "char_end": 641, "char_start": 640, "chars": ")" }, { "char_end": 655, "char_start": 642, "chars": "\n " }, { "char_end": 677, "char_start": 665, "chars": "html.escape(" }, { "char_end": 685, "char_start": 684, "chars": ")" }, { "char_end": 701, "char_start": 689, "chars": "html.escape(" }, { "char_end": 707, "char_start": 706, "chars": ")" }, { "char_end": 721, "char_start": 708, "chars": "\n " } ], "deleted": [ { "char_end": 685, "char_start": 673, "chars": "\n " } ] }, "commit_link": "github.com/qutebrowser/qutebrowser/commit/4c9360237f186681b1e3f2a0f30c45161cf405c7", "file_name": "qutebrowser/browser/qutescheme.py", "func_name": "history_data", "line_changes": { "added": [ { "char_end": 643, "char_start": 603, "line": " return [{\"url\": html.escape(e.url),\n", "line_no": 18 }, { "char_end": 709, "char_start": 643, "line": " \"title\": html.escape(e.title) or html.escape(e.url),\n", "line_no": 19 }, { "char_end": 756, "char_start": 709, "line": " \"time\": e.atime} for e in entries]\n", "line_no": 20 } ], "deleted": [ { "char_end": 674, "char_start": 603, "line": " return [{\"url\": e.url, \"title\": e.title or e.url, \"time\": e.atime}\n", "line_no": 18 }, { "char_end": 703, "char_start": 674, "line": " for e in entries]\n", "line_no": 19 } ] }, "vul_type": "cwe-079" }
152
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@register.filter\ndef json_dumps(value, indent=None):\n if isinstance(value, QuerySet):\n result = serialize('json', value, indent=indent)\n else:\n result = json.dumps(value, indent=indent, cls=DjbletsJSONEncoder)\n", " return mark_safe(result)" ]
[ 1, 0 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 263, "char_start": 252, "chars": "force_text(" }, { "char_end": 299, "char_start": 270, "chars": ".translate(_safe_js_escapes))" } ], "deleted": [] }, "commit_link": "github.com/djblets/djblets/commit/77a68c03cd619a0996f3f37337b8c39ca6643d6e", "file_name": "djblets/util/templatetags/djblets_js.py", "func_name": "json_dumps", "line_changes": { "added": [ { "char_end": 299, "char_start": 231, "line": " return mark_safe(force_text(result).translate(_safe_js_escapes))\n", "line_no": 8 } ], "deleted": [ { "char_end": 259, "char_start": 231, "line": " return mark_safe(result)\n", "line_no": 8 } ] }, "vul_type": "cwe-079" }
153
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@register.filter\ndef json_dumps(value, indent=None):\n if isinstance(value, QuerySet):\n result = serialize('json', value, indent=indent)\n else:\n result = json.dumps(value, indent=indent, cls=DjbletsJSONEncoder)\n", " return mark_safe(force_text(result).translate(_safe_js_escapes))" ]
[ 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 263, "char_start": 252, "chars": "force_text(" }, { "char_end": 299, "char_start": 270, "chars": ".translate(_safe_js_escapes))" } ], "deleted": [] }, "commit_link": "github.com/djblets/djblets/commit/77a68c03cd619a0996f3f37337b8c39ca6643d6e", "file_name": "djblets/util/templatetags/djblets_js.py", "func_name": "json_dumps", "line_changes": { "added": [ { "char_end": 299, "char_start": 231, "line": " return mark_safe(force_text(result).translate(_safe_js_escapes))\n", "line_no": 8 } ], "deleted": [ { "char_end": 259, "char_start": 231, "line": " return mark_safe(result)\n", "line_no": 8 } ] }, "vul_type": "cwe-079" }
153
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def htmlvalue(self, val):", " return self.block.render_basic(val)" ]
[ 1, 0 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 68, "char_start": 38, "chars": "\"\"\"\n Return an HTML rep" }, { "char_end": 73, "char_start": 70, "chars": "sen" }, { "char_end": 117, "char_start": 74, "chars": "ation of this block that is safe to be incl" }, { "char_end": 138, "char_start": 118, "chars": "ded\n in compa" }, { "char_end": 142, "char_start": 139, "chars": "iso" }, { "char_end": 199, "char_start": 144, "chars": "views\n \"\"\"\n return escape(text_from_html(" }, { "char_end": 229, "char_start": 227, "chars": "))" } ], "deleted": [] }, "commit_link": "github.com/wagtail/wagtail/commit/61045ceefea114c40ac4b680af58990dbe732389", "file_name": "wagtail/admin/compare.py", "func_name": "htmlvalue", "line_changes": { "added": [ { "char_end": 42, "char_start": 30, "line": " \"\"\"\n", "line_no": 2 }, { "char_end": 122, "char_start": 42, "line": " Return an HTML representation of this block that is safe to be included\n", "line_no": 3 }, { "char_end": 150, "char_start": 122, "line": " in comparison views\n", "line_no": 4 }, { "char_end": 162, "char_start": 150, "line": " \"\"\"\n", "line_no": 5 }, { "char_end": 229, "char_start": 162, "line": " return escape(text_from_html(self.block.render_basic(val)))\n", "line_no": 6 } ], "deleted": [ { "char_end": 73, "char_start": 30, "line": " return self.block.render_basic(val)\n", "line_no": 2 } ] }, "vul_type": "cwe-079" }
154
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def htmlvalue(self, val):", " \"\"\"\n Return an HTML representation of this block that is safe to be included\n in comparison views\n \"\"\"\n return escape(text_from_html(self.block.render_basic(val)))" ]
[ 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 68, "char_start": 38, "chars": "\"\"\"\n Return an HTML rep" }, { "char_end": 73, "char_start": 70, "chars": "sen" }, { "char_end": 117, "char_start": 74, "chars": "ation of this block that is safe to be incl" }, { "char_end": 138, "char_start": 118, "chars": "ded\n in compa" }, { "char_end": 142, "char_start": 139, "chars": "iso" }, { "char_end": 199, "char_start": 144, "chars": "views\n \"\"\"\n return escape(text_from_html(" }, { "char_end": 229, "char_start": 227, "chars": "))" } ], "deleted": [] }, "commit_link": "github.com/wagtail/wagtail/commit/61045ceefea114c40ac4b680af58990dbe732389", "file_name": "wagtail/admin/compare.py", "func_name": "htmlvalue", "line_changes": { "added": [ { "char_end": 42, "char_start": 30, "line": " \"\"\"\n", "line_no": 2 }, { "char_end": 122, "char_start": 42, "line": " Return an HTML representation of this block that is safe to be included\n", "line_no": 3 }, { "char_end": 150, "char_start": 122, "line": " in comparison views\n", "line_no": 4 }, { "char_end": 162, "char_start": 150, "line": " \"\"\"\n", "line_no": 5 }, { "char_end": 229, "char_start": 162, "line": " return escape(text_from_html(self.block.render_basic(val)))\n", "line_no": 6 } ], "deleted": [ { "char_end": 73, "char_start": 30, "line": " return self.block.render_basic(val)\n", "line_no": 2 } ] }, "vul_type": "cwe-079" }
154
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@register.tag\n@basictag(takes_context=True)\ndef gravatar(context, user, size=None):\n \"\"\"\n Outputs the HTML for displaying a user's gravatar.", " This can take an optional size of the image (defaults to 80 if not\n specified).", " This is also influenced by the following settings:", " GRAVATAR_SIZE - Default size for gravatars\n GRAVATAR_RATING - Maximum allowed rating (g, pg, r, x)\n GRAVATAR_DEFAULT - Default image set to show if the user hasn't\n specified a gravatar (identicon, monsterid, wavatar)", " See http://www.gravatar.com/ for more information.\n \"\"\"\n url = get_gravatar_url(context['request'], user, size)", " if url:", " return ('<img src=\"%s\" width=\"%s\" height=\"%s\" alt=\"%s\" '\n ' class=\"gravatar\"/>' %\n (url, size, size, user.get_full_name() or user.username))", " else:\n return ''" ]
[ 1, 1, 1, 1, 1, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 724, "char_start": 713, "chars": "format_html" }, { "char_end": 738, "char_start": 725, "chars": "\n " }, { "char_end": 752, "char_start": 749, "chars": "{0}" }, { "char_end": 764, "char_start": 761, "chars": "{1}" }, { "char_end": 777, "char_start": 774, "chars": "{1}" }, { "char_end": 787, "char_start": 784, "chars": "{2}" }, { "char_end": 824, "char_start": 823, "chars": "," } ], "deleted": [ { "char_end": 727, "char_start": 725, "chars": "%s" }, { "char_end": 738, "char_start": 736, "chars": "%s" }, { "char_end": 750, "char_start": 748, "chars": "%s" }, { "char_end": 759, "char_start": 757, "chars": "%s" }, { "char_end": 779, "char_start": 775, "chars": " " }, { "char_end": 785, "char_start": 780, "chars": " " }, { "char_end": 806, "char_start": 804, "chars": " %" }, { "char_end": 811, "char_start": 807, "chars": " " }, { "char_end": 824, "char_start": 823, "chars": "(" }, { "char_end": 833, "char_start": 827, "chars": ", size" }, { "char_end": 879, "char_start": 878, "chars": ")" } ] }, "commit_link": "github.com/djblets/djblets/commit/77ac64642ad530bf69e390c51fc6fdcb8914c8e7", "file_name": "djblets/gravatars/templatetags/gravatars.py", "func_name": "gravatar", "line_changes": { "added": [ { "char_end": 726, "char_start": 698, "line": " return format_html(\n", "line_no": 22 }, { "char_end": 791, "char_start": 726, "line": " '<img src=\"{0}\" width=\"{1}\" height=\"{1}\" alt=\"{2}\" '\n", "line_no": 23 }, { "char_end": 825, "char_start": 791, "line": " 'class=\"gravatar\"/>',\n", "line_no": 24 }, { "char_end": 887, "char_start": 825, "line": " url, size, user.get_full_name() or user.username)\n", "line_no": 25 } ], "deleted": [ { "char_end": 763, "char_start": 698, "line": " return ('<img src=\"%s\" width=\"%s\" height=\"%s\" alt=\"%s\" '\n", "line_no": 22 }, { "char_end": 807, "char_start": 763, "line": " ' class=\"gravatar\"/>' %\n", "line_no": 23 }, { "char_end": 881, "char_start": 807, "line": " (url, size, size, user.get_full_name() or user.username))\n", "line_no": 24 } ] }, "vul_type": "cwe-079" }
155
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@register.tag\n@basictag(takes_context=True)\ndef gravatar(context, user, size=None):\n \"\"\"\n Outputs the HTML for displaying a user's gravatar.", " This can take an optional size of the image (defaults to 80 if not\n specified).", " This is also influenced by the following settings:", " GRAVATAR_SIZE - Default size for gravatars\n GRAVATAR_RATING - Maximum allowed rating (g, pg, r, x)\n GRAVATAR_DEFAULT - Default image set to show if the user hasn't\n specified a gravatar (identicon, monsterid, wavatar)", " See http://www.gravatar.com/ for more information.\n \"\"\"\n url = get_gravatar_url(context['request'], user, size)", " if url:", " return format_html(\n '<img src=\"{0}\" width=\"{1}\" height=\"{1}\" alt=\"{2}\" '\n 'class=\"gravatar\"/>',\n url, size, user.get_full_name() or user.username)", " else:\n return ''" ]
[ 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 724, "char_start": 713, "chars": "format_html" }, { "char_end": 738, "char_start": 725, "chars": "\n " }, { "char_end": 752, "char_start": 749, "chars": "{0}" }, { "char_end": 764, "char_start": 761, "chars": "{1}" }, { "char_end": 777, "char_start": 774, "chars": "{1}" }, { "char_end": 787, "char_start": 784, "chars": "{2}" }, { "char_end": 824, "char_start": 823, "chars": "," } ], "deleted": [ { "char_end": 727, "char_start": 725, "chars": "%s" }, { "char_end": 738, "char_start": 736, "chars": "%s" }, { "char_end": 750, "char_start": 748, "chars": "%s" }, { "char_end": 759, "char_start": 757, "chars": "%s" }, { "char_end": 779, "char_start": 775, "chars": " " }, { "char_end": 785, "char_start": 780, "chars": " " }, { "char_end": 806, "char_start": 804, "chars": " %" }, { "char_end": 811, "char_start": 807, "chars": " " }, { "char_end": 824, "char_start": 823, "chars": "(" }, { "char_end": 833, "char_start": 827, "chars": ", size" }, { "char_end": 879, "char_start": 878, "chars": ")" } ] }, "commit_link": "github.com/djblets/djblets/commit/77ac64642ad530bf69e390c51fc6fdcb8914c8e7", "file_name": "djblets/gravatars/templatetags/gravatars.py", "func_name": "gravatar", "line_changes": { "added": [ { "char_end": 726, "char_start": 698, "line": " return format_html(\n", "line_no": 22 }, { "char_end": 791, "char_start": 726, "line": " '<img src=\"{0}\" width=\"{1}\" height=\"{1}\" alt=\"{2}\" '\n", "line_no": 23 }, { "char_end": 825, "char_start": 791, "line": " 'class=\"gravatar\"/>',\n", "line_no": 24 }, { "char_end": 887, "char_start": 825, "line": " url, size, user.get_full_name() or user.username)\n", "line_no": 25 } ], "deleted": [ { "char_end": 763, "char_start": 698, "line": " return ('<img src=\"%s\" width=\"%s\" height=\"%s\" alt=\"%s\" '\n", "line_no": 22 }, { "char_end": 807, "char_start": 763, "line": " ' class=\"gravatar\"/>' %\n", "line_no": 23 }, { "char_end": 881, "char_start": 807, "line": " (url, size, size, user.get_full_name() or user.username))\n", "line_no": 24 } ] }, "vul_type": "cwe-079" }
155
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "QStandardItem* PeerListWidget::addPeer(const QString& ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n int row = m_listModel->rowCount();\n // Adding Peer to peer list\n m_listModel->insertRow(row);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip, Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP_HIDDEN), ip);\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n }\n else {\n m_missingFlags.insert(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);", " m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), peer.client());", " m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);", " return m_listModel->item(row, PeerListDelegate::IP);\n}" ]
[ 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1546, "char_start": 1517, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 1559, "char_start": 1558, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16", "file_name": "src/gui/properties/peerlistwidget.cpp", "func_name": "PeerListWidget::addPeer", "line_changes": { "added": [ { "char_end": 1563, "char_start": 1441, "line": " m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), Utils::String::toHtmlEscaped(peer.client()));\n", "line_no": 24 } ], "deleted": [ { "char_end": 1533, "char_start": 1441, "line": " m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), peer.client());\n", "line_no": 24 } ] }, "vul_type": "cwe-079" }
156
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "QStandardItem* PeerListWidget::addPeer(const QString& ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n int row = m_listModel->rowCount();\n // Adding Peer to peer list\n m_listModel->insertRow(row);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip, Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP_HIDDEN), ip);\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n }\n else {\n m_missingFlags.insert(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);", " m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), Utils::String::toHtmlEscaped(peer.client()));", " m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);", " return m_listModel->item(row, PeerListDelegate::IP);\n}" ]
[ 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1546, "char_start": 1517, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 1559, "char_start": 1558, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16", "file_name": "src/gui/properties/peerlistwidget.cpp", "func_name": "PeerListWidget::addPeer", "line_changes": { "added": [ { "char_end": 1563, "char_start": 1441, "line": " m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), Utils::String::toHtmlEscaped(peer.client()));\n", "line_no": 24 } ], "deleted": [ { "char_end": 1533, "char_start": 1441, "line": " m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), peer.client());\n", "line_no": 24 } ] }, "vul_type": "cwe-079" }
156
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "def is_safe_url(url, host=None):\n \"\"\"\n Return ``True`` if the url is a safe redirection (i.e. it doesn't point to\n a different host and uses a safe scheme).", " Always returns ``False`` on an empty url.\n \"\"\"\n if url is not None:\n url = url.strip()\n if not url:\n return False", " # Chrome treats \\ completely as /\n url = url.replace('\\\\', '/')\n # Chrome considers any URL with more than two slashes to be absolute, but\n # urlparse is not so flexible. Treat any url with three slashes as unsafe.\n if url.startswith('///'):\n return False\n url_info = urlparse(url)\n # Forbid URLs like http:///example.com - with a scheme, but without a hostname.\n # In that URL, example.com is not the hostname but, a path component. However,\n # Chrome will still consider example.com to be the hostname, so we must not\n # allow this syntax.\n if not url_info.netloc and url_info.scheme:\n return False\n # Forbid URLs that start with control characters. Some browsers (like\n # Chrome) ignore quite a few control characters at the start of a\n # URL and might consider the URL as scheme relative.\n if unicodedata.category(url[0])[0] == 'C':\n return False\n return ((not url_info.netloc or url_info.netloc == host) and\n (not url_info.scheme or url_info.scheme in ['http', 'https']))" ]
[ 1, 1, 0 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 350, "char_start": 349, "chars": "p" }, { "char_end": 360, "char_start": 359, "chars": "i" }, { "char_end": 364, "char_start": 362, "chars": "co" }, { "char_end": 367, "char_start": 366, "chars": "d" }, { "char_end": 372, "char_start": 371, "chars": "p" }, { "char_end": 377, "char_start": 376, "chars": "o" }, { "char_end": 382, "char_start": 381, "chars": "m" }, { "char_end": 409, "char_start": 408, "chars": "i" }, { "char_end": 417, "char_start": 416, "chars": "w" }, { "char_end": 432, "char_start": 430, "chars": "ck" }, { "char_end": 457, "char_start": 455, "chars": "_i" }, { "char_end": 462, "char_start": 458, "chars": "_saf" }, { "char_end": 464, "char_start": 463, "chars": "_" }, { "char_end": 467, "char_start": 466, "chars": "l" }, { "char_end": 472, "char_start": 471, "chars": "," }, { "char_end": 490, "char_start": 486, "chars": "_saf" }, { "char_end": 493, "char_start": 491, "chars": "_u" }, { "char_end": 496, "char_start": 494, "chars": "l(" }, { "char_end": 505, "char_start": 500, "chars": "repla" }, { "char_end": 508, "char_start": 507, "chars": "(" }, { "char_end": 511, "char_start": 509, "chars": "\\\\" }, { "char_end": 520, "char_start": 515, "chars": "/'), " }, { "char_end": 522, "char_start": 521, "chars": "o" }, { "char_end": 524, "char_start": 523, "chars": "t" } ], "deleted": [ { "char_end": 346, "char_start": 345, "chars": "\n" }, { "char_end": 396, "char_start": 347, "chars": " url = url.replace('\\\\', '/')\n # Chrome cons" }, { "char_end": 403, "char_start": 397, "chars": "ders a" }, { "char_end": 405, "char_start": 404, "chars": "y" }, { "char_end": 422, "char_start": 406, "chars": "URL with more th" }, { "char_end": 425, "char_start": 423, "chars": "n " }, { "char_end": 433, "char_start": 426, "chars": "wo slas" }, { "char_end": 435, "char_start": 434, "chars": "e" }, { "char_end": 439, "char_start": 436, "chars": " to" }, { "char_end": 448, "char_start": 441, "chars": "e absol" }, { "char_end": 471, "char_start": 450, "chars": "e, but\n # urlparse" }, { "char_end": 477, "char_start": 473, "chars": "s no" }, { "char_end": 480, "char_start": 479, "chars": "s" }, { "char_end": 502, "char_start": 481, "chars": " flexible. Treat any " }, { "char_end": 504, "char_start": 503, "chars": "r" }, { "char_end": 510, "char_start": 505, "chars": " with" }, { "char_end": 514, "char_start": 511, "chars": "thr" }, { "char_end": 536, "char_start": 515, "chars": "e slashes as unsafe.\n" }, { "char_end": 549, "char_start": 537, "chars": " if url.st" }, { "char_end": 568, "char_start": 552, "chars": "swith('///'):\n " }, { "char_end": 598, "char_start": 569, "chars": " return False\n url_inf" }, { "char_end": 601, "char_start": 599, "chars": " =" }, { "char_end": 608, "char_start": 602, "chars": "urlpar" }, { "char_end": 615, "char_start": 610, "chars": "(url)" }, { "char_end": 625, "char_start": 622, "chars": "For" }, { "char_end": 649, "char_start": 626, "chars": "id URLs like http:///ex" }, { "char_end": 668, "char_start": 650, "chars": "mple.com - with a " }, { "char_end": 681, "char_start": 669, "chars": "cheme, but w" }, { "char_end": 727, "char_start": 682, "chars": "thout a hostname.\n # In that URL, example." }, { "char_end": 730, "char_start": 728, "chars": "om" }, { "char_end": 747, "char_start": 731, "chars": "is not the hostn" }, { "char_end": 752, "char_start": 748, "chars": "me b" }, { "char_end": 761, "char_start": 754, "chars": ", a pat" }, { "char_end": 780, "char_start": 764, "chars": "omponent. Howeve" }, { "char_end": 794, "char_start": 781, "chars": ",\n # Chrom" }, { "char_end": 812, "char_start": 795, "chars": " will still consi" }, { "char_end": 842, "char_start": 814, "chars": "r example.com to be the host" }, { "char_end": 857, "char_start": 843, "chars": "ame, so we mus" }, { "char_end": 877, "char_start": 858, "chars": " not\n # allow th" }, { "char_end": 884, "char_start": 878, "chars": "s synt" }, { "char_end": 901, "char_start": 885, "chars": "x.\n if not ur" }, { "char_end": 928, "char_start": 902, "chars": "_info.netloc and url_info." }, { "char_end": 936, "char_start": 929, "chars": "cheme:\n" }, { "char_end": 954, "char_start": 937, "chars": " return Fal" }, { "char_end": 964, "char_start": 955, "chars": "e\n # F" }, { "char_end": 985, "char_start": 965, "chars": "rbid URLs that start" }, { "char_end": 1006, "char_start": 987, "chars": "ith control charact" }, { "char_end": 1010, "char_start": 1007, "chars": "rs." }, { "char_end": 1047, "char_start": 1011, "chars": "Some browsers (like\n # Chrome) ig" }, { "char_end": 1050, "char_start": 1048, "chars": "or" }, { "char_end": 1056, "char_start": 1051, "chars": " quit" }, { "char_end": 1067, "char_start": 1058, "chars": "a few con" }, { "char_end": 1069, "char_start": 1068, "chars": "r" }, { "char_end": 1071, "char_start": 1070, "chars": "l" }, { "char_end": 1079, "char_start": 1074, "chars": "aract" }, { "char_end": 1110, "char_start": 1080, "chars": "rs at the start of a\n # URL" }, { "char_end": 1122, "char_start": 1111, "chars": "and might c" }, { "char_end": 1130, "char_start": 1123, "chars": "nsider " }, { "char_end": 1133, "char_start": 1132, "chars": "e" }, { "char_end": 1139, "char_start": 1137, "chars": " a" }, { "char_end": 1156, "char_start": 1140, "chars": " scheme relative" }, { "char_end": 1213, "char_start": 1162, "chars": "if unicodedata.category(url[0])[0] == 'C':\n " }, { "char_end": 1246, "char_start": 1220, "chars": "False\n return ((not url" }, { "char_end": 1249, "char_start": 1248, "chars": "n" }, { "char_end": 1253, "char_start": 1250, "chars": "o.n" }, { "char_end": 1262, "char_start": 1254, "chars": "tloc or " }, { "char_end": 1274, "char_start": 1265, "chars": "_info.net" }, { "char_end": 1280, "char_start": 1275, "chars": "oc ==" }, { "char_end": 1296, "char_start": 1290, "chars": "\n " }, { "char_end": 1311, "char_start": 1297, "chars": " (not url" }, { "char_end": 1317, "char_start": 1313, "chars": "nfo." }, { "char_end": 1320, "char_start": 1318, "chars": "ch" }, { "char_end": 1325, "char_start": 1321, "chars": "me o" }, { "char_end": 1327, "char_start": 1326, "chars": " " }, { "char_end": 1335, "char_start": 1330, "chars": "_info" }, { "char_end": 1339, "char_start": 1336, "chars": "sch" }, { "char_end": 1341, "char_start": 1340, "chars": "m" }, { "char_end": 1347, "char_start": 1343, "chars": "in [" }, { "char_end": 1352, "char_start": 1348, "chars": "http" }, { "char_end": 1356, "char_start": 1355, "chars": "'" }, { "char_end": 1360, "char_start": 1357, "chars": "ttp" }, { "char_end": 1364, "char_start": 1361, "chars": "'])" } ] }, "commit_link": "github.com/django/django/commit/c5544d289233f501917e25970c03ed444abbd4f0", "file_name": "django/utils/http.py", "func_name": "is_safe_url", "line_changes": { "added": [ { "char_end": 525, "char_start": 444, "line": " return _is_safe_url(url, host) and _is_safe_url(url.replace('\\\\', '/'), host)\n", "line_no": 14 } ], "deleted": [ { "char_end": 379, "char_start": 346, "line": " url = url.replace('\\\\', '/')\n", "line_no": 13 } ] }, "vul_type": "cwe-079" }
157
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def is_safe_url(url, host=None):\n \"\"\"\n Return ``True`` if the url is a safe redirection (i.e. it doesn't point to\n a different host and uses a safe scheme).", " Always returns ``False`` on an empty url.\n \"\"\"\n if url is not None:\n url = url.strip()\n if not url:\n return False", " # Chrome treats \\ completely as / in paths but it could be part of some\n # basic auth credentials so we need to check both URLs.\n return _is_safe_url(url, host) and _is_safe_url(url.replace('\\\\', '/'), host)" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 350, "char_start": 349, "chars": "p" }, { "char_end": 360, "char_start": 359, "chars": "i" }, { "char_end": 364, "char_start": 362, "chars": "co" }, { "char_end": 367, "char_start": 366, "chars": "d" }, { "char_end": 372, "char_start": 371, "chars": "p" }, { "char_end": 377, "char_start": 376, "chars": "o" }, { "char_end": 382, "char_start": 381, "chars": "m" }, { "char_end": 409, "char_start": 408, "chars": "i" }, { "char_end": 417, "char_start": 416, "chars": "w" }, { "char_end": 432, "char_start": 430, "chars": "ck" }, { "char_end": 457, "char_start": 455, "chars": "_i" }, { "char_end": 462, "char_start": 458, "chars": "_saf" }, { "char_end": 464, "char_start": 463, "chars": "_" }, { "char_end": 467, "char_start": 466, "chars": "l" }, { "char_end": 472, "char_start": 471, "chars": "," }, { "char_end": 490, "char_start": 486, "chars": "_saf" }, { "char_end": 493, "char_start": 491, "chars": "_u" }, { "char_end": 496, "char_start": 494, "chars": "l(" }, { "char_end": 505, "char_start": 500, "chars": "repla" }, { "char_end": 508, "char_start": 507, "chars": "(" }, { "char_end": 511, "char_start": 509, "chars": "\\\\" }, { "char_end": 520, "char_start": 515, "chars": "/'), " }, { "char_end": 522, "char_start": 521, "chars": "o" }, { "char_end": 524, "char_start": 523, "chars": "t" } ], "deleted": [ { "char_end": 346, "char_start": 345, "chars": "\n" }, { "char_end": 396, "char_start": 347, "chars": " url = url.replace('\\\\', '/')\n # Chrome cons" }, { "char_end": 403, "char_start": 397, "chars": "ders a" }, { "char_end": 405, "char_start": 404, "chars": "y" }, { "char_end": 422, "char_start": 406, "chars": "URL with more th" }, { "char_end": 425, "char_start": 423, "chars": "n " }, { "char_end": 433, "char_start": 426, "chars": "wo slas" }, { "char_end": 435, "char_start": 434, "chars": "e" }, { "char_end": 439, "char_start": 436, "chars": " to" }, { "char_end": 448, "char_start": 441, "chars": "e absol" }, { "char_end": 471, "char_start": 450, "chars": "e, but\n # urlparse" }, { "char_end": 477, "char_start": 473, "chars": "s no" }, { "char_end": 480, "char_start": 479, "chars": "s" }, { "char_end": 502, "char_start": 481, "chars": " flexible. Treat any " }, { "char_end": 504, "char_start": 503, "chars": "r" }, { "char_end": 510, "char_start": 505, "chars": " with" }, { "char_end": 514, "char_start": 511, "chars": "thr" }, { "char_end": 536, "char_start": 515, "chars": "e slashes as unsafe.\n" }, { "char_end": 549, "char_start": 537, "chars": " if url.st" }, { "char_end": 568, "char_start": 552, "chars": "swith('///'):\n " }, { "char_end": 598, "char_start": 569, "chars": " return False\n url_inf" }, { "char_end": 601, "char_start": 599, "chars": " =" }, { "char_end": 608, "char_start": 602, "chars": "urlpar" }, { "char_end": 615, "char_start": 610, "chars": "(url)" }, { "char_end": 625, "char_start": 622, "chars": "For" }, { "char_end": 649, "char_start": 626, "chars": "id URLs like http:///ex" }, { "char_end": 668, "char_start": 650, "chars": "mple.com - with a " }, { "char_end": 681, "char_start": 669, "chars": "cheme, but w" }, { "char_end": 727, "char_start": 682, "chars": "thout a hostname.\n # In that URL, example." }, { "char_end": 730, "char_start": 728, "chars": "om" }, { "char_end": 747, "char_start": 731, "chars": "is not the hostn" }, { "char_end": 752, "char_start": 748, "chars": "me b" }, { "char_end": 761, "char_start": 754, "chars": ", a pat" }, { "char_end": 780, "char_start": 764, "chars": "omponent. Howeve" }, { "char_end": 794, "char_start": 781, "chars": ",\n # Chrom" }, { "char_end": 812, "char_start": 795, "chars": " will still consi" }, { "char_end": 842, "char_start": 814, "chars": "r example.com to be the host" }, { "char_end": 857, "char_start": 843, "chars": "ame, so we mus" }, { "char_end": 877, "char_start": 858, "chars": " not\n # allow th" }, { "char_end": 884, "char_start": 878, "chars": "s synt" }, { "char_end": 901, "char_start": 885, "chars": "x.\n if not ur" }, { "char_end": 928, "char_start": 902, "chars": "_info.netloc and url_info." }, { "char_end": 936, "char_start": 929, "chars": "cheme:\n" }, { "char_end": 954, "char_start": 937, "chars": " return Fal" }, { "char_end": 964, "char_start": 955, "chars": "e\n # F" }, { "char_end": 985, "char_start": 965, "chars": "rbid URLs that start" }, { "char_end": 1006, "char_start": 987, "chars": "ith control charact" }, { "char_end": 1010, "char_start": 1007, "chars": "rs." }, { "char_end": 1047, "char_start": 1011, "chars": "Some browsers (like\n # Chrome) ig" }, { "char_end": 1050, "char_start": 1048, "chars": "or" }, { "char_end": 1056, "char_start": 1051, "chars": " quit" }, { "char_end": 1067, "char_start": 1058, "chars": "a few con" }, { "char_end": 1069, "char_start": 1068, "chars": "r" }, { "char_end": 1071, "char_start": 1070, "chars": "l" }, { "char_end": 1079, "char_start": 1074, "chars": "aract" }, { "char_end": 1110, "char_start": 1080, "chars": "rs at the start of a\n # URL" }, { "char_end": 1122, "char_start": 1111, "chars": "and might c" }, { "char_end": 1130, "char_start": 1123, "chars": "nsider " }, { "char_end": 1133, "char_start": 1132, "chars": "e" }, { "char_end": 1139, "char_start": 1137, "chars": " a" }, { "char_end": 1156, "char_start": 1140, "chars": " scheme relative" }, { "char_end": 1213, "char_start": 1162, "chars": "if unicodedata.category(url[0])[0] == 'C':\n " }, { "char_end": 1246, "char_start": 1220, "chars": "False\n return ((not url" }, { "char_end": 1249, "char_start": 1248, "chars": "n" }, { "char_end": 1253, "char_start": 1250, "chars": "o.n" }, { "char_end": 1262, "char_start": 1254, "chars": "tloc or " }, { "char_end": 1274, "char_start": 1265, "chars": "_info.net" }, { "char_end": 1280, "char_start": 1275, "chars": "oc ==" }, { "char_end": 1296, "char_start": 1290, "chars": "\n " }, { "char_end": 1311, "char_start": 1297, "chars": " (not url" }, { "char_end": 1317, "char_start": 1313, "chars": "nfo." }, { "char_end": 1320, "char_start": 1318, "chars": "ch" }, { "char_end": 1325, "char_start": 1321, "chars": "me o" }, { "char_end": 1327, "char_start": 1326, "chars": " " }, { "char_end": 1335, "char_start": 1330, "chars": "_info" }, { "char_end": 1339, "char_start": 1336, "chars": "sch" }, { "char_end": 1341, "char_start": 1340, "chars": "m" }, { "char_end": 1347, "char_start": 1343, "chars": "in [" }, { "char_end": 1352, "char_start": 1348, "chars": "http" }, { "char_end": 1356, "char_start": 1355, "chars": "'" }, { "char_end": 1360, "char_start": 1357, "chars": "ttp" }, { "char_end": 1364, "char_start": 1361, "chars": "'])" } ] }, "commit_link": "github.com/django/django/commit/c5544d289233f501917e25970c03ed444abbd4f0", "file_name": "django/utils/http.py", "func_name": "is_safe_url", "line_changes": { "added": [ { "char_end": 525, "char_start": 444, "line": " return _is_safe_url(url, host) and _is_safe_url(url.replace('\\\\', '/'), host)\n", "line_no": 14 } ], "deleted": [ { "char_end": 379, "char_start": 346, "line": " url = url.replace('\\\\', '/')\n", "line_no": 13 } ] }, "vul_type": "cwe-079" }
157
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def get_context_data(self, **kwargs):\n context = super().get_context_data(**kwargs)\n context['comments'] = self.object.comment_set.all().order_by('-time')\n context['form'] = self.get_form()", " context['md'] = markdown(self.object.content,\n extensions=[\n 'markdown.extensions.extra',\n 'markdown.extensions.codehilite',\n 'markdown.extensions.toc',\n ])", "\n return context" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 240, "char_start": 239, "chars": "s" }, { "char_end": 245, "char_start": 241, "chars": "fe_m" } ], "deleted": [ { "char_end": 240, "char_start": 239, "chars": "m" }, { "char_end": 243, "char_start": 241, "chars": "rk" }, { "char_end": 247, "char_start": 244, "chars": "own" }, { "char_end": 550, "char_start": 267, "chars": ",\n extensions=[\n 'markdown.extensions.extra',\n 'markdown.extensions.codehilite',\n 'markdown.extensions.toc',\n ]" } ] }, "commit_link": "github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c", "file_name": "app/Index/views.py", "func_name": "get_context_data", "line_changes": { "added": [ { "char_end": 268, "char_start": 215, "line": " context['md'] = safe_md(self.object.content)\n", "line_no": 5 } ], "deleted": [ { "char_end": 269, "char_start": 215, "line": " context['md'] = markdown(self.object.content,\n", "line_no": 5 }, { "char_end": 315, "char_start": 269, "line": " extensions=[\n", "line_no": 6 }, { "char_end": 381, "char_start": 315, "line": " 'markdown.extensions.extra',\n", "line_no": 7 }, { "char_end": 452, "char_start": 381, "line": " 'markdown.extensions.codehilite',\n", "line_no": 8 }, { "char_end": 516, "char_start": 452, "line": " 'markdown.extensions.toc',\n", "line_no": 9 }, { "char_end": 552, "char_start": 516, "line": " ])\n", "line_no": 10 } ] }, "vul_type": "cwe-079" }
158
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def get_context_data(self, **kwargs):\n context = super().get_context_data(**kwargs)\n context['comments'] = self.object.comment_set.all().order_by('-time')\n context['form'] = self.get_form()", " context['md'] = safe_md(self.object.content)", "\n return context" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 240, "char_start": 239, "chars": "s" }, { "char_end": 245, "char_start": 241, "chars": "fe_m" } ], "deleted": [ { "char_end": 240, "char_start": 239, "chars": "m" }, { "char_end": 243, "char_start": 241, "chars": "rk" }, { "char_end": 247, "char_start": 244, "chars": "own" }, { "char_end": 550, "char_start": 267, "chars": ",\n extensions=[\n 'markdown.extensions.extra',\n 'markdown.extensions.codehilite',\n 'markdown.extensions.toc',\n ]" } ] }, "commit_link": "github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c", "file_name": "app/Index/views.py", "func_name": "get_context_data", "line_changes": { "added": [ { "char_end": 268, "char_start": 215, "line": " context['md'] = safe_md(self.object.content)\n", "line_no": 5 } ], "deleted": [ { "char_end": 269, "char_start": 215, "line": " context['md'] = markdown(self.object.content,\n", "line_no": 5 }, { "char_end": 315, "char_start": 269, "line": " extensions=[\n", "line_no": 6 }, { "char_end": 381, "char_start": 315, "line": " 'markdown.extensions.extra',\n", "line_no": 7 }, { "char_end": 452, "char_start": 381, "line": " 'markdown.extensions.codehilite',\n", "line_no": 8 }, { "char_end": 516, "char_start": 452, "line": " 'markdown.extensions.toc',\n", "line_no": 9 }, { "char_end": 552, "char_start": 516, "line": " ])\n", "line_no": 10 } ] }, "vul_type": "cwe-079" }
158
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@check_document_access_permission()\ndef edit_workflow(request):\n workflow_id = request.GET.get('workflow')\n \n if workflow_id:\n wid = {}\n if workflow_id.isdigit():\n wid['id'] = workflow_id\n else:\n wid['uuid'] = workflow_id\n doc = Document2.objects.get(type='oozie-workflow2', **wid)\n workflow = Workflow(document=doc)\n else:\n doc = None\n workflow = Workflow()\n workflow.set_workspace(request.user)\n workflow.check_workspace(request.fs, request.user)\n \n workflow_data = workflow.get_data()", " api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))", " return render('editor/workflow_editor.mako', request, {", " 'layout_json': json.dumps(workflow_data['layout']),\n 'workflow_json': json.dumps(workflow_data['workflow']),\n 'credentials_json': json.dumps(credentials.credentials.keys()),\n 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES),", " 'doc1_id': doc.doc.get().id if doc else -1,", " 'subworkflows_json': json.dumps(_get_workflows(request.user)),", " 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })" ]
[ 1, 1, 1, 0, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 822, "char_start": 798, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 908, "char_start": 884, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 1002, "char_start": 978, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 1098, "char_start": 1074, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 1241, "char_start": 1217, "chars": ", cls=JSONEncoderForHTML" } ], "deleted": [] }, "commit_link": "github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735", "file_name": "apps/oozie/src/oozie/views/editor2.py", "func_name": "edit_workflow", "line_changes": { "added": [ { "char_end": 825, "char_start": 743, "line": " 'layout_json': json.dumps(workflow_data['layout'], cls=JSONEncoderForHTML),\n", "line_no": 30 }, { "char_end": 911, "char_start": 825, "line": " 'workflow_json': json.dumps(workflow_data['workflow'], cls=JSONEncoderForHTML),\n", "line_no": 31 }, { "char_end": 1005, "char_start": 911, "line": " 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n", "line_no": 32 }, { "char_end": 1101, "char_start": 1005, "line": " 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES, cls=JSONEncoderForHTML),\n", "line_no": 33 }, { "char_end": 1244, "char_start": 1151, "line": " 'subworkflows_json': json.dumps(_get_workflows(request.user), cls=JSONEncoderForHTML),\n", "line_no": 35 } ], "deleted": [ { "char_end": 801, "char_start": 743, "line": " 'layout_json': json.dumps(workflow_data['layout']),\n", "line_no": 30 }, { "char_end": 863, "char_start": 801, "line": " 'workflow_json': json.dumps(workflow_data['workflow']),\n", "line_no": 31 }, { "char_end": 933, "char_start": 863, "line": " 'credentials_json': json.dumps(credentials.credentials.keys()),\n", "line_no": 32 }, { "char_end": 1005, "char_start": 933, "line": " 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES),\n", "line_no": 33 }, { "char_end": 1124, "char_start": 1055, "line": " 'subworkflows_json': json.dumps(_get_workflows(request.user)),\n", "line_no": 35 } ] }, "vul_type": "cwe-079" }
159
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@check_document_access_permission()\ndef edit_workflow(request):\n workflow_id = request.GET.get('workflow')\n \n if workflow_id:\n wid = {}\n if workflow_id.isdigit():\n wid['id'] = workflow_id\n else:\n wid['uuid'] = workflow_id\n doc = Document2.objects.get(type='oozie-workflow2', **wid)\n workflow = Workflow(document=doc)\n else:\n doc = None\n workflow = Workflow()\n workflow.set_workspace(request.user)\n workflow.check_workspace(request.fs, request.user)\n \n workflow_data = workflow.get_data()", " api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))", " return render('editor/workflow_editor.mako', request, {", " 'layout_json': json.dumps(workflow_data['layout'], cls=JSONEncoderForHTML),\n 'workflow_json': json.dumps(workflow_data['workflow'], cls=JSONEncoderForHTML),\n 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES, cls=JSONEncoderForHTML),", " 'doc1_id': doc.doc.get().id if doc else -1,", " 'subworkflows_json': json.dumps(_get_workflows(request.user), cls=JSONEncoderForHTML),", " 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })" ]
[ 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 822, "char_start": 798, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 908, "char_start": 884, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 1002, "char_start": 978, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 1098, "char_start": 1074, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 1241, "char_start": 1217, "chars": ", cls=JSONEncoderForHTML" } ], "deleted": [] }, "commit_link": "github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735", "file_name": "apps/oozie/src/oozie/views/editor2.py", "func_name": "edit_workflow", "line_changes": { "added": [ { "char_end": 825, "char_start": 743, "line": " 'layout_json': json.dumps(workflow_data['layout'], cls=JSONEncoderForHTML),\n", "line_no": 30 }, { "char_end": 911, "char_start": 825, "line": " 'workflow_json': json.dumps(workflow_data['workflow'], cls=JSONEncoderForHTML),\n", "line_no": 31 }, { "char_end": 1005, "char_start": 911, "line": " 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n", "line_no": 32 }, { "char_end": 1101, "char_start": 1005, "line": " 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES, cls=JSONEncoderForHTML),\n", "line_no": 33 }, { "char_end": 1244, "char_start": 1151, "line": " 'subworkflows_json': json.dumps(_get_workflows(request.user), cls=JSONEncoderForHTML),\n", "line_no": 35 } ], "deleted": [ { "char_end": 801, "char_start": 743, "line": " 'layout_json': json.dumps(workflow_data['layout']),\n", "line_no": 30 }, { "char_end": 863, "char_start": 801, "line": " 'workflow_json': json.dumps(workflow_data['workflow']),\n", "line_no": 31 }, { "char_end": 933, "char_start": 863, "line": " 'credentials_json': json.dumps(credentials.credentials.keys()),\n", "line_no": 32 }, { "char_end": 1005, "char_start": 933, "line": " 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES),\n", "line_no": 33 }, { "char_end": 1124, "char_start": 1055, "line": " 'subworkflows_json': json.dumps(_get_workflows(request.user)),\n", "line_no": 35 } ] }, "vul_type": "cwe-079" }
159
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@classmethod\n def simple_search(cls, query, using=None, index=None):", "", " es_search = cls.search(using=using, index=index)", "", " es_query = cls.get_es_query(query=query)\n highlighted_fields = [f.split('^', 1)[0] for f in cls.search_fields]", "", "", " es_search = es_search.query(es_query).highlight(*highlighted_fields)", " return es_search" ]
[ 1, 0, 1, 0, 1, 0, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 240, "char_start": 84, "chars": "\"\"\"\n Do a search without facets.\n\n This is used in:\n\n * The Docsearch API\n * The Project Admin Search page\n \"\"\"\n\n " }, { "char_end": 354, "char_start": 289, "chars": " es_search = es_search.highlight_options(encoder='html')\n\n" }, { "char_end": 557, "char_start": 556, "chars": "\n" } ], "deleted": [ { "char_end": 260, "char_start": 259, "chars": "\n" } ] }, "commit_link": "github.com/readthedocs/readthedocs.org/commit/1ebe494ffde18109307f205d2bd94102452f697a", "file_name": "readthedocs/search/documents.py", "func_name": "simple_search", "line_changes": { "added": [ { "char_end": 88, "char_start": 76, "line": " \"\"\"\n", "line_no": 3 }, { "char_end": 124, "char_start": 88, "line": " Do a search without facets.\n", "line_no": 4 }, { "char_end": 125, "char_start": 124, "line": "\n", "line_no": 5 }, { "char_end": 150, "char_start": 125, "line": " This is used in:\n", "line_no": 6 }, { "char_end": 151, "char_start": 150, "line": "\n", "line_no": 7 }, { "char_end": 179, "char_start": 151, "line": " * The Docsearch API\n", "line_no": 8 }, { "char_end": 219, "char_start": 179, "line": " * The Project Admin Search page\n", "line_no": 9 }, { "char_end": 231, "char_start": 219, "line": " \"\"\"\n", "line_no": 10 }, { "char_end": 232, "char_start": 231, "line": "\n", "line_no": 11 }, { "char_end": 353, "char_start": 289, "line": " es_search = es_search.highlight_options(encoder='html')\n", "line_no": 13 }, { "char_end": 354, "char_start": 353, "line": "\n", "line_no": 14 }, { "char_end": 558, "char_start": 557, "line": "\n", "line_no": 18 } ], "deleted": [ { "char_end": 260, "char_start": 259, "line": "\n", "line_no": 6 } ] }, "vul_type": "cwe-079" }
160
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@classmethod\n def simple_search(cls, query, using=None, index=None):", " \"\"\"\n Do a search without facets.", " This is used in:", " * The Docsearch API\n * The Project Admin Search page\n \"\"\"\n", " es_search = cls.search(using=using, index=index)", " es_search = es_search.highlight_options(encoder='html')\n", " es_query = cls.get_es_query(query=query)\n highlighted_fields = [f.split('^', 1)[0] for f in cls.search_fields]", " es_search = es_search.query(es_query).highlight(*highlighted_fields)", "", "", " return es_search" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 240, "char_start": 84, "chars": "\"\"\"\n Do a search without facets.\n\n This is used in:\n\n * The Docsearch API\n * The Project Admin Search page\n \"\"\"\n\n " }, { "char_end": 354, "char_start": 289, "chars": " es_search = es_search.highlight_options(encoder='html')\n\n" }, { "char_end": 557, "char_start": 556, "chars": "\n" } ], "deleted": [ { "char_end": 260, "char_start": 259, "chars": "\n" } ] }, "commit_link": "github.com/readthedocs/readthedocs.org/commit/1ebe494ffde18109307f205d2bd94102452f697a", "file_name": "readthedocs/search/documents.py", "func_name": "simple_search", "line_changes": { "added": [ { "char_end": 88, "char_start": 76, "line": " \"\"\"\n", "line_no": 3 }, { "char_end": 124, "char_start": 88, "line": " Do a search without facets.\n", "line_no": 4 }, { "char_end": 125, "char_start": 124, "line": "\n", "line_no": 5 }, { "char_end": 150, "char_start": 125, "line": " This is used in:\n", "line_no": 6 }, { "char_end": 151, "char_start": 150, "line": "\n", "line_no": 7 }, { "char_end": 179, "char_start": 151, "line": " * The Docsearch API\n", "line_no": 8 }, { "char_end": 219, "char_start": 179, "line": " * The Project Admin Search page\n", "line_no": 9 }, { "char_end": 231, "char_start": 219, "line": " \"\"\"\n", "line_no": 10 }, { "char_end": 232, "char_start": 231, "line": "\n", "line_no": 11 }, { "char_end": 353, "char_start": 289, "line": " es_search = es_search.highlight_options(encoder='html')\n", "line_no": 13 }, { "char_end": 354, "char_start": 353, "line": "\n", "line_no": 14 }, { "char_end": 558, "char_start": 557, "line": "\n", "line_no": 18 } ], "deleted": [ { "char_end": 260, "char_start": 259, "line": "\n", "line_no": 6 } ] }, "vul_type": "cwe-079" }
160
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "bool WddxPacket::recursiveAddVar(const String& varName,\n const Variant& varVariant,\n bool hasVarTag) {", " bool isArray = varVariant.isArray();\n bool isObject = varVariant.isObject();", " if (isArray || isObject) {\n if (hasVarTag) {\n m_packetString += \"<var name='\";\n m_packetString += varName.data();\n m_packetString += \"'>\";\n }", " Array varAsArray;\n Object varAsObject = varVariant.toObject();\n if (isArray) varAsArray = varVariant.toArray();\n if (isObject) varAsArray = varAsObject.toArray();", " int length = varAsArray.length();\n if (length > 0) {\n ArrayIter it = ArrayIter(varAsArray);\n if (it.first().isString()) isObject = true;\n if (isObject) {\n m_packetString += \"<struct>\";\n if (!isArray) {\n m_packetString += \"<var name='php_class_name'><string>\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"</string></var>\";\n }\n } else {\n m_packetString += \"<array length='\";\n m_packetString += std::to_string(length);\n m_packetString += \"'>\";\n }\n for (ArrayIter it(varAsArray); it; ++it) {\n Variant key = it.first();\n Variant value = it.second();\n recursiveAddVar(key.toString(), value, isObject);\n }\n if (isObject) {\n m_packetString += \"</struct>\";\n }\n else {\n m_packetString += \"</array>\";\n }\n }\n else {\n //empty object\n if (isObject) {\n m_packetString += \"<struct>\";\n if (!isArray) {\n m_packetString += \"<var name='php_class_name'><string>\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"</string></var>\";\n }\n m_packetString += \"</struct>\";\n }\n }\n if (hasVarTag) {\n m_packetString += \"</var>\";\n }\n return true;\n }", " std::string varType = getDataTypeString(varVariant.getType()).data();\n if (!getWddxEncoded(varType, \"\", varName, false).empty()) {", " std::string varValue = varVariant.toString().data();", " if (varType.compare(\"boolean\") == 0) {\n varValue = varVariant.toBoolean() ? \"true\" : \"false\";", "", " }\n m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag);\n return true;\n }", " return false;\n}" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 2094, "char_start": 2094, "chars": "" }, { "char_end": 2421, "char_start": 2195, "chars": ";\n } else {\n varValue = StringUtil::HtmlEncode(varVariant.toString(),\n StringUtil::QuoteStyle::Double,\n \"UTF-8\", false, false).toCppString()" } ], "deleted": [ { "char_end": 2123, "char_start": 2092, "chars": " = varVariant.toString().data()" }, { "char_end": 2168, "char_start": 2168, "chars": "" } ] }, "commit_link": "github.com/facebook/hhvm/commit/324701c9fd31beb4f070f1b7ef78b115fbdfec34", "file_name": "hphp/runtime/ext/wddx/ext_wddx.cpp", "func_name": "HPHP::WddxPacket::recursiveAddVar", "line_changes": { "added": [ { "char_end": 2094, "char_start": 2068, "line": " std::string varValue;\n", "line_no": 68 }, { "char_end": 2210, "char_start": 2197, "line": " } else {\n", "line_no": 71 }, { "char_end": 2273, "char_start": 2210, "line": " varValue = StringUtil::HtmlEncode(varVariant.toString(),\n", "line_no": 72 }, { "char_end": 2345, "char_start": 2273, "line": " StringUtil::QuoteStyle::Double,\n", "line_no": 73 }, { "char_end": 2423, "char_start": 2345, "line": " \"UTF-8\", false, false).toCppString();\n", "line_no": 74 } ], "deleted": [ { "char_end": 2125, "char_start": 2068, "line": " std::string varValue = varVariant.toString().data();\n", "line_no": 68 } ] }, "vul_type": "cwe-079" }
161
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "bool WddxPacket::recursiveAddVar(const String& varName,\n const Variant& varVariant,\n bool hasVarTag) {", " bool isArray = varVariant.isArray();\n bool isObject = varVariant.isObject();", " if (isArray || isObject) {\n if (hasVarTag) {\n m_packetString += \"<var name='\";\n m_packetString += varName.data();\n m_packetString += \"'>\";\n }", " Array varAsArray;\n Object varAsObject = varVariant.toObject();\n if (isArray) varAsArray = varVariant.toArray();\n if (isObject) varAsArray = varAsObject.toArray();", " int length = varAsArray.length();\n if (length > 0) {\n ArrayIter it = ArrayIter(varAsArray);\n if (it.first().isString()) isObject = true;\n if (isObject) {\n m_packetString += \"<struct>\";\n if (!isArray) {\n m_packetString += \"<var name='php_class_name'><string>\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"</string></var>\";\n }\n } else {\n m_packetString += \"<array length='\";\n m_packetString += std::to_string(length);\n m_packetString += \"'>\";\n }\n for (ArrayIter it(varAsArray); it; ++it) {\n Variant key = it.first();\n Variant value = it.second();\n recursiveAddVar(key.toString(), value, isObject);\n }\n if (isObject) {\n m_packetString += \"</struct>\";\n }\n else {\n m_packetString += \"</array>\";\n }\n }\n else {\n //empty object\n if (isObject) {\n m_packetString += \"<struct>\";\n if (!isArray) {\n m_packetString += \"<var name='php_class_name'><string>\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"</string></var>\";\n }\n m_packetString += \"</struct>\";\n }\n }\n if (hasVarTag) {\n m_packetString += \"</var>\";\n }\n return true;\n }", " std::string varType = getDataTypeString(varVariant.getType()).data();\n if (!getWddxEncoded(varType, \"\", varName, false).empty()) {", " std::string varValue;", " if (varType.compare(\"boolean\") == 0) {\n varValue = varVariant.toBoolean() ? \"true\" : \"false\";", " } else {\n varValue = StringUtil::HtmlEncode(varVariant.toString(),\n StringUtil::QuoteStyle::Double,\n \"UTF-8\", false, false).toCppString();", " }\n m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag);\n return true;\n }", " return false;\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 2094, "char_start": 2094, "chars": "" }, { "char_end": 2421, "char_start": 2195, "chars": ";\n } else {\n varValue = StringUtil::HtmlEncode(varVariant.toString(),\n StringUtil::QuoteStyle::Double,\n \"UTF-8\", false, false).toCppString()" } ], "deleted": [ { "char_end": 2123, "char_start": 2092, "chars": " = varVariant.toString().data()" }, { "char_end": 2168, "char_start": 2168, "chars": "" } ] }, "commit_link": "github.com/facebook/hhvm/commit/324701c9fd31beb4f070f1b7ef78b115fbdfec34", "file_name": "hphp/runtime/ext/wddx/ext_wddx.cpp", "func_name": "HPHP::WddxPacket::recursiveAddVar", "line_changes": { "added": [ { "char_end": 2094, "char_start": 2068, "line": " std::string varValue;\n", "line_no": 68 }, { "char_end": 2210, "char_start": 2197, "line": " } else {\n", "line_no": 71 }, { "char_end": 2273, "char_start": 2210, "line": " varValue = StringUtil::HtmlEncode(varVariant.toString(),\n", "line_no": 72 }, { "char_end": 2345, "char_start": 2273, "line": " StringUtil::QuoteStyle::Double,\n", "line_no": 73 }, { "char_end": 2423, "char_start": 2345, "line": " \"UTF-8\", false, false).toCppString();\n", "line_no": 74 } ], "deleted": [ { "char_end": 2125, "char_start": 2068, "line": " std::string varValue = varVariant.toString().data();\n", "line_no": 68 } ] }, "vul_type": "cwe-079" }
161
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_receive(self, request):\n \"\"\"\n This is called by render_POST when the client is telling us\n that it is ready to receive data as soon as it is available.\n This is the basis of a long-polling (comet) mechanism: the\n server will wait to reply until data is available.", " Args:\n request (Request): Incoming request.", " \"\"\"", " csessid = request.args.get('csessid')[0]", " self.last_alive[csessid] = (time.time(), False)", " dataentries = self.databuffer.get(csessid, [])\n if dataentries:\n return dataentries.pop(0)\n request.notifyFinish().addErrback(self._responseFailed, csessid, request)\n if csessid in self.requests:\n self.requests[csessid].finish() # Clear any stale request.\n self.requests[csessid] = request\n return server.NOT_DONE_YET" ]
[ 1, 1, 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 418, "char_start": 407, "chars": "cgi.escape(" }, { "char_end": 431, "char_start": 430, "chars": "[" }, { "char_end": 441, "char_start": 440, "chars": "]" }, { "char_end": 445, "char_start": 444, "chars": ")" } ], "deleted": [ { "char_end": 424, "char_start": 419, "chars": ".get(" }, { "char_end": 434, "char_start": 433, "chars": ")" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_receive", "line_changes": { "added": [ { "char_end": 446, "char_start": 389, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 12 } ], "deleted": [ { "char_end": 438, "char_start": 389, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 12 } ] }, "vul_type": "cwe-079" }
162
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_receive(self, request):\n \"\"\"\n This is called by render_POST when the client is telling us\n that it is ready to receive data as soon as it is available.\n This is the basis of a long-polling (comet) mechanism: the\n server will wait to reply until data is available.", " Args:\n request (Request): Incoming request.", " \"\"\"", " csessid = cgi.escape(request.args['csessid'][0])", " self.last_alive[csessid] = (time.time(), False)", " dataentries = self.databuffer.get(csessid, [])\n if dataentries:\n return dataentries.pop(0)\n request.notifyFinish().addErrback(self._responseFailed, csessid, request)\n if csessid in self.requests:\n self.requests[csessid].finish() # Clear any stale request.\n self.requests[csessid] = request\n return server.NOT_DONE_YET" ]
[ 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 418, "char_start": 407, "chars": "cgi.escape(" }, { "char_end": 431, "char_start": 430, "chars": "[" }, { "char_end": 441, "char_start": 440, "chars": "]" }, { "char_end": 445, "char_start": 444, "chars": ")" } ], "deleted": [ { "char_end": 424, "char_start": 419, "chars": ".get(" }, { "char_end": 434, "char_start": 433, "chars": ")" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_receive", "line_changes": { "added": [ { "char_end": 446, "char_start": 389, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 12 } ], "deleted": [ { "char_end": 438, "char_start": 389, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 12 } ] }, "vul_type": "cwe-079" }
162
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@check_document_access_permission()\ndef edit_coordinator(request):\n coordinator_id = request.GET.get('coordinator')\n doc = None\n \n if coordinator_id:\n doc = Document2.objects.get(id=coordinator_id)\n coordinator = Coordinator(document=doc)\n else:\n coordinator = Coordinator()", " api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))", " workflows = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]", " if coordinator_id and not filter(lambda a: a['uuid'] == coordinator.data['properties']['workflow'], workflows):\n raise PopupException(_('You don\\'t have access to the workflow of this coordinator.'))", " return render('editor/coordinator_editor.mako', request, {", " 'coordinator_json': coordinator.json,\n 'credentials_json': json.dumps(credentials.credentials.keys()),\n 'workflows_json': json.dumps(workflows),", " 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })" ]
[ 1, 1, 1, 1, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 968, "char_start": 957, "chars": "_for_html()" }, { "char_end": 1061, "char_start": 1037, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 1132, "char_start": 1108, "chars": ", cls=JSONEncoderForHTML" } ], "deleted": [] }, "commit_link": "github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735", "file_name": "apps/oozie/src/oozie/views/editor2.py", "func_name": "edit_coordinator", "line_changes": { "added": [ { "char_end": 970, "char_start": 915, "line": " 'coordinator_json': coordinator.json_for_html(),\n", "line_no": 27 }, { "char_end": 1064, "char_start": 970, "line": " 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n", "line_no": 28 }, { "char_end": 1135, "char_start": 1064, "line": " 'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML),\n", "line_no": 29 } ], "deleted": [ { "char_end": 959, "char_start": 915, "line": " 'coordinator_json': coordinator.json,\n", "line_no": 27 }, { "char_end": 1029, "char_start": 959, "line": " 'credentials_json': json.dumps(credentials.credentials.keys()),\n", "line_no": 28 }, { "char_end": 1076, "char_start": 1029, "line": " 'workflows_json': json.dumps(workflows),\n", "line_no": 29 } ] }, "vul_type": "cwe-079" }
163
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@check_document_access_permission()\ndef edit_coordinator(request):\n coordinator_id = request.GET.get('coordinator')\n doc = None\n \n if coordinator_id:\n doc = Document2.objects.get(id=coordinator_id)\n coordinator = Coordinator(document=doc)\n else:\n coordinator = Coordinator()", " api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))", " workflows = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]", " if coordinator_id and not filter(lambda a: a['uuid'] == coordinator.data['properties']['workflow'], workflows):\n raise PopupException(_('You don\\'t have access to the workflow of this coordinator.'))", " return render('editor/coordinator_editor.mako', request, {", " 'coordinator_json': coordinator.json_for_html(),\n 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n 'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML),", " 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })" ]
[ 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 968, "char_start": 957, "chars": "_for_html()" }, { "char_end": 1061, "char_start": 1037, "chars": ", cls=JSONEncoderForHTML" }, { "char_end": 1132, "char_start": 1108, "chars": ", cls=JSONEncoderForHTML" } ], "deleted": [] }, "commit_link": "github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735", "file_name": "apps/oozie/src/oozie/views/editor2.py", "func_name": "edit_coordinator", "line_changes": { "added": [ { "char_end": 970, "char_start": 915, "line": " 'coordinator_json': coordinator.json_for_html(),\n", "line_no": 27 }, { "char_end": 1064, "char_start": 970, "line": " 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n", "line_no": 28 }, { "char_end": 1135, "char_start": 1064, "line": " 'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML),\n", "line_no": 29 } ], "deleted": [ { "char_end": 959, "char_start": 915, "line": " 'coordinator_json': coordinator.json,\n", "line_no": 27 }, { "char_end": 1029, "char_start": 959, "line": " 'credentials_json': json.dumps(credentials.credentials.keys()),\n", "line_no": 28 }, { "char_end": 1076, "char_start": 1029, "line": " 'workflows_json': json.dumps(workflows),\n", "line_no": 29 } ] }, "vul_type": "cwe-079" }
163
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def _keyify(key):", " return _key_pattern.sub(' ', key.lower())" ]
[ 1, 0 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 64, "char_start": 22, "chars": "key = escape(key.lower(), quote=True)\n " } ], "deleted": [ { "char_end": 62, "char_start": 54, "chars": ".lower()" } ] }, "commit_link": "github.com/lepture/mistune/commit/5f06d724bc05580e7f203db2d4a4905fc1127f98", "file_name": "mistune.py", "func_name": "_keyify", "line_changes": { "added": [ { "char_end": 60, "char_start": 18, "line": " key = escape(key.lower(), quote=True)\n", "line_no": 2 }, { "char_end": 97, "char_start": 60, "line": " return _key_pattern.sub(' ', key)\n", "line_no": 3 } ], "deleted": [ { "char_end": 63, "char_start": 18, "line": " return _key_pattern.sub(' ', key.lower())\n", "line_no": 2 } ] }, "vul_type": "cwe-079" }
164
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def _keyify(key):", " key = escape(key.lower(), quote=True)\n return _key_pattern.sub(' ', key)" ]
[ 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 64, "char_start": 22, "chars": "key = escape(key.lower(), quote=True)\n " } ], "deleted": [ { "char_end": 62, "char_start": 54, "chars": ".lower()" } ] }, "commit_link": "github.com/lepture/mistune/commit/5f06d724bc05580e7f203db2d4a4905fc1127f98", "file_name": "mistune.py", "func_name": "_keyify", "line_changes": { "added": [ { "char_end": 60, "char_start": 18, "line": " key = escape(key.lower(), quote=True)\n", "line_no": 2 }, { "char_end": 97, "char_start": 60, "line": " return _key_pattern.sub(' ', key)\n", "line_no": 3 } ], "deleted": [ { "char_end": 63, "char_start": 18, "line": " return _key_pattern.sub(' ', key.lower())\n", "line_no": 2 } ] }, "vul_type": "cwe-079" }
164
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@login_required(redirect_field_name='', login_url='/403')\n@require_POST\n@require_AJAX\n@transaction.atomic\ndef batch_edit_translations(request):\n \"\"\"Perform an action on a list of translations.", " Available actions are defined in `ACTIONS_FN_MAP`. Arguments to this view\n are defined in `models.BatchActionsForm`.", " \"\"\"\n form = forms.BatchActionsForm(request.POST)\n if not form.is_valid():", " return HttpResponseBadRequest(form.errors.as_json())", "\n locale = get_object_or_404(Locale, code=form.cleaned_data['locale'])\n entities = Entity.objects.filter(pk__in=form.cleaned_data['entities'])", " if not entities.exists():\n return JsonResponse({'count': 0})", " # Batch editing is only available to translators. Check if user has\n # translate permissions for all of the projects in passed entities.\n # Also make sure projects are not enabled in read-only mode for a locale.\n projects_pk = entities.values_list('resource__project__pk', flat=True)\n projects = Project.objects.filter(pk__in=projects_pk.distinct())", " for project in projects:\n if (\n not request.user.can_translate(project=project, locale=locale)\n or readonly_exists(projects, locale)\n ):\n return HttpResponseForbidden(\n \"Forbidden: You don't have permission for batch editing\"\n )", " # Find all impacted active translations, including plural forms.\n active_translations = Translation.objects.filter(\n active=True,\n locale=locale,\n entity__in=entities,\n )", " # Execute the actual action.\n action_function = ACTIONS_FN_MAP[form.cleaned_data['action']]\n action_status = action_function(\n form,\n request.user,\n active_translations,\n locale,\n )", " if action_status.get('error'):\n return JsonResponse(action_status)", " invalid_translation_count = len(action_status.get('invalid_translation_pks', []))\n if action_status['count'] == 0:\n return JsonResponse({\n 'count': 0,\n 'invalid_translation_count': invalid_translation_count,\n })", " update_stats(action_status['translated_resources'], locale)\n mark_changed_translation(action_status['changed_entities'], locale)", " # Update latest translation.\n if action_status['latest_translation_pk']:\n Translation.objects.get(\n pk=action_status['latest_translation_pk']\n ).update_latest_translation()", " update_translation_memory(\n action_status['changed_translation_pks'],\n project,\n locale\n )", " return JsonResponse({\n 'count': action_status['count'],\n 'invalid_translation_count': invalid_translation_count,\n })" ]
[ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 480, "char_start": 464, "chars": "escape_html=True" } ], "deleted": [] }, "commit_link": "github.com/onefork/pontoon-sr/commit/fc07ed9c68e08d41f74c078b4e7727f1a0888be8", "file_name": "pontoon/batch/views.py", "func_name": "batch_edit_translations", "line_changes": { "added": [ { "char_end": 483, "char_start": 406, "line": " return HttpResponseBadRequest(form.errors.as_json(escape_html=True))\n", "line_no": 14 } ], "deleted": [ { "char_end": 467, "char_start": 406, "line": " return HttpResponseBadRequest(form.errors.as_json())\n", "line_no": 14 } ] }, "vul_type": "cwe-079" }
165
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@login_required(redirect_field_name='', login_url='/403')\n@require_POST\n@require_AJAX\n@transaction.atomic\ndef batch_edit_translations(request):\n \"\"\"Perform an action on a list of translations.", " Available actions are defined in `ACTIONS_FN_MAP`. Arguments to this view\n are defined in `models.BatchActionsForm`.", " \"\"\"\n form = forms.BatchActionsForm(request.POST)\n if not form.is_valid():", " return HttpResponseBadRequest(form.errors.as_json(escape_html=True))", "\n locale = get_object_or_404(Locale, code=form.cleaned_data['locale'])\n entities = Entity.objects.filter(pk__in=form.cleaned_data['entities'])", " if not entities.exists():\n return JsonResponse({'count': 0})", " # Batch editing is only available to translators. Check if user has\n # translate permissions for all of the projects in passed entities.\n # Also make sure projects are not enabled in read-only mode for a locale.\n projects_pk = entities.values_list('resource__project__pk', flat=True)\n projects = Project.objects.filter(pk__in=projects_pk.distinct())", " for project in projects:\n if (\n not request.user.can_translate(project=project, locale=locale)\n or readonly_exists(projects, locale)\n ):\n return HttpResponseForbidden(\n \"Forbidden: You don't have permission for batch editing\"\n )", " # Find all impacted active translations, including plural forms.\n active_translations = Translation.objects.filter(\n active=True,\n locale=locale,\n entity__in=entities,\n )", " # Execute the actual action.\n action_function = ACTIONS_FN_MAP[form.cleaned_data['action']]\n action_status = action_function(\n form,\n request.user,\n active_translations,\n locale,\n )", " if action_status.get('error'):\n return JsonResponse(action_status)", " invalid_translation_count = len(action_status.get('invalid_translation_pks', []))\n if action_status['count'] == 0:\n return JsonResponse({\n 'count': 0,\n 'invalid_translation_count': invalid_translation_count,\n })", " update_stats(action_status['translated_resources'], locale)\n mark_changed_translation(action_status['changed_entities'], locale)", " # Update latest translation.\n if action_status['latest_translation_pk']:\n Translation.objects.get(\n pk=action_status['latest_translation_pk']\n ).update_latest_translation()", " update_translation_memory(\n action_status['changed_translation_pks'],\n project,\n locale\n )", " return JsonResponse({\n 'count': action_status['count'],\n 'invalid_translation_count': invalid_translation_count,\n })" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 480, "char_start": 464, "chars": "escape_html=True" } ], "deleted": [] }, "commit_link": "github.com/onefork/pontoon-sr/commit/fc07ed9c68e08d41f74c078b4e7727f1a0888be8", "file_name": "pontoon/batch/views.py", "func_name": "batch_edit_translations", "line_changes": { "added": [ { "char_end": 483, "char_start": 406, "line": " return HttpResponseBadRequest(form.errors.as_json(escape_html=True))\n", "line_no": 14 } ], "deleted": [ { "char_end": 467, "char_start": 406, "line": " return HttpResponseBadRequest(form.errors.as_json())\n", "line_no": 14 } ] }, "vul_type": "cwe-079" }
165
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def make_eb_config(application_name, default_region):\n # Capture our current directory\n UTILS_DIR = os.path.dirname(os.path.abspath(__file__))\n # Create the jinja2 environment.\n # Notice the use of trim_blocks, which greatly helps control whitespace.", " j2_env = Environment(loader=FileSystemLoader(UTILS_DIR))", " return j2_env.get_template('templates/eb/config.yml').render(\n APPLICATION_NAME=application_name,\n DEFAULT_REGION=default_region\n )" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 339, "char_start": 322, "chars": ", autoescape=True" } ], "deleted": [] }, "commit_link": "github.com/OkunaOrg/okuna-www-api/commit/8c40c66ea7c483a0cbda4c21940180af909aab99", "file_name": "utils/make_eb_config.py", "func_name": "make_eb_config", "line_changes": { "added": [ { "char_end": 341, "char_start": 263, "line": " j2_env = Environment(loader=FileSystemLoader(UTILS_DIR), autoescape=True)\n", "line_no": 6 } ], "deleted": [ { "char_end": 324, "char_start": 263, "line": " j2_env = Environment(loader=FileSystemLoader(UTILS_DIR))\n", "line_no": 6 } ] }, "vul_type": "cwe-079" }
166
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def make_eb_config(application_name, default_region):\n # Capture our current directory\n UTILS_DIR = os.path.dirname(os.path.abspath(__file__))\n # Create the jinja2 environment.\n # Notice the use of trim_blocks, which greatly helps control whitespace.", " j2_env = Environment(loader=FileSystemLoader(UTILS_DIR), autoescape=True)", " return j2_env.get_template('templates/eb/config.yml').render(\n APPLICATION_NAME=application_name,\n DEFAULT_REGION=default_region\n )" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 339, "char_start": 322, "chars": ", autoescape=True" } ], "deleted": [] }, "commit_link": "github.com/OkunaOrg/okuna-www-api/commit/8c40c66ea7c483a0cbda4c21940180af909aab99", "file_name": "utils/make_eb_config.py", "func_name": "make_eb_config", "line_changes": { "added": [ { "char_end": 341, "char_start": 263, "line": " j2_env = Environment(loader=FileSystemLoader(UTILS_DIR), autoescape=True)\n", "line_no": 6 } ], "deleted": [ { "char_end": 324, "char_start": 263, "line": " j2_env = Environment(loader=FileSystemLoader(UTILS_DIR))\n", "line_no": 6 } ] }, "vul_type": "cwe-079" }
166
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_keepalive(self, request):\n \"\"\"\n This is called by render_POST when the\n client is replying to the keepalive.\n \"\"\"", " csessid = request.args.get('csessid')[0]", " self.last_alive[csessid] = (time.time(), False)\n return '\"\"'" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 184, "char_start": 173, "chars": "cgi.escape(" }, { "char_end": 197, "char_start": 196, "chars": "[" }, { "char_end": 207, "char_start": 206, "chars": "]" }, { "char_end": 211, "char_start": 210, "chars": ")" } ], "deleted": [ { "char_end": 190, "char_start": 185, "chars": ".get(" }, { "char_end": 200, "char_start": 199, "chars": ")" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_keepalive", "line_changes": { "added": [ { "char_end": 212, "char_start": 155, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 6 } ], "deleted": [ { "char_end": 204, "char_start": 155, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 6 } ] }, "vul_type": "cwe-079" }
167
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_keepalive(self, request):\n \"\"\"\n This is called by render_POST when the\n client is replying to the keepalive.\n \"\"\"", " csessid = cgi.escape(request.args['csessid'][0])", " self.last_alive[csessid] = (time.time(), False)\n return '\"\"'" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 184, "char_start": 173, "chars": "cgi.escape(" }, { "char_end": 197, "char_start": 196, "chars": "[" }, { "char_end": 207, "char_start": 206, "chars": "]" }, { "char_end": 211, "char_start": 210, "chars": ")" } ], "deleted": [ { "char_end": 190, "char_start": 185, "chars": ".get(" }, { "char_end": 200, "char_start": 199, "chars": ")" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_keepalive", "line_changes": { "added": [ { "char_end": 212, "char_start": 155, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 6 } ], "deleted": [ { "char_end": 204, "char_start": 155, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 6 } ] }, "vul_type": "cwe-079" }
167
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)\n{\n QWriteLocker locker(&lock);\n", " Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), ip, blocked, reason };", " m_peers.push_back(temp);", " if (m_peers.size() >= MAX_LOG_MESSAGES)\n m_peers.pop_front();", " emit newLogPeer(temp);\n}" ]
[ 1, 0, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 216, "char_start": 187, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 219, "char_start": 218, "chars": ")" }, { "char_end": 259, "char_start": 230, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 266, "char_start": 265, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16", "file_name": "src/base/logger.cpp", "func_name": "Logger::addPeer", "line_changes": { "added": [ { "char_end": 270, "char_start": 112, "line": " Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), Utils::String::toHtmlEscaped(ip), blocked, Utils::String::toHtmlEscaped(reason) };\n", "line_no": 5 } ], "deleted": [ { "char_end": 210, "char_start": 112, "line": " Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), ip, blocked, reason };\n", "line_no": 5 } ] }, "vul_type": "cwe-079" }
168
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)\n{\n QWriteLocker locker(&lock);\n", " Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), Utils::String::toHtmlEscaped(ip), blocked, Utils::String::toHtmlEscaped(reason) };", " m_peers.push_back(temp);", " if (m_peers.size() >= MAX_LOG_MESSAGES)\n m_peers.pop_front();", " emit newLogPeer(temp);\n}" ]
[ 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 216, "char_start": 187, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 219, "char_start": 218, "chars": ")" }, { "char_end": 259, "char_start": 230, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 266, "char_start": 265, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16", "file_name": "src/base/logger.cpp", "func_name": "Logger::addPeer", "line_changes": { "added": [ { "char_end": 270, "char_start": 112, "line": " Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), Utils::String::toHtmlEscaped(ip), blocked, Utils::String::toHtmlEscaped(reason) };\n", "line_no": 5 } ], "deleted": [ { "char_end": 210, "char_start": 112, "line": " Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), ip, blocked, reason };\n", "line_no": 5 } ] }, "vul_type": "cwe-079" }
168
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "@csrf.csrf_protect\ndef subscribe_for_tags(request):\n \"\"\"process subscription of users by tags\"\"\"\n #todo - use special separator to split tags\n tag_names = request.REQUEST.get('tags','').strip().split()\n pure_tag_names, wildcards = forms.clean_marked_tagnames(tag_names)\n if request.user.is_authenticated():\n if request.method == 'POST':\n if 'ok' in request.POST:\n request.user.mark_tags(\n pure_tag_names,\n wildcards,\n reason = 'good',\n action = 'add'\n )\n request.user.message_set.create(\n message = _('Your tag subscription was saved, thanks!')\n )\n else:\n message = _(\n 'Tag subscription was canceled (<a href=\"%(url)s\">undo</a>).'", " ) % {'url': request.path + '?tags=' + request.REQUEST['tags']}", " request.user.message_set.create(message = message)\n return HttpResponseRedirect(reverse('index'))\n else:\n data = {'tags': tag_names}\n return render(request, 'subscribe_for_tags.html', data)\n else:\n all_tag_names = pure_tag_names + wildcards\n message = _('Please sign in to subscribe for: %(tags)s') \\\n % {'tags': ', '.join(all_tag_names)}\n request.user.message_set.create(message = message)\n request.session['subscribe_for_tags'] = (pure_tag_names, wildcards)\n return HttpResponseRedirect(url_utils.get_login_url())" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 940, "char_start": 933, "chars": "escape(" }, { "char_end": 953, "char_start": 952, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/ASKBOT/askbot-devel/commit/a676a86b6b7a5737d4da4f59f71e037406f88d29", "file_name": "askbot/views/commands.py", "func_name": "subscribe_for_tags", "line_changes": { "added": [ { "char_end": 992, "char_start": 905, "line": " ) % {'url': escape(request.path) + '?tags=' + request.REQUEST['tags']}\n", "line_no": 22 } ], "deleted": [ { "char_end": 984, "char_start": 905, "line": " ) % {'url': request.path + '?tags=' + request.REQUEST['tags']}\n", "line_no": 22 } ] }, "vul_type": "cwe-079" }
169
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@csrf.csrf_protect\ndef subscribe_for_tags(request):\n \"\"\"process subscription of users by tags\"\"\"\n #todo - use special separator to split tags\n tag_names = request.REQUEST.get('tags','').strip().split()\n pure_tag_names, wildcards = forms.clean_marked_tagnames(tag_names)\n if request.user.is_authenticated():\n if request.method == 'POST':\n if 'ok' in request.POST:\n request.user.mark_tags(\n pure_tag_names,\n wildcards,\n reason = 'good',\n action = 'add'\n )\n request.user.message_set.create(\n message = _('Your tag subscription was saved, thanks!')\n )\n else:\n message = _(\n 'Tag subscription was canceled (<a href=\"%(url)s\">undo</a>).'", " ) % {'url': escape(request.path) + '?tags=' + request.REQUEST['tags']}", " request.user.message_set.create(message = message)\n return HttpResponseRedirect(reverse('index'))\n else:\n data = {'tags': tag_names}\n return render(request, 'subscribe_for_tags.html', data)\n else:\n all_tag_names = pure_tag_names + wildcards\n message = _('Please sign in to subscribe for: %(tags)s') \\\n % {'tags': ', '.join(all_tag_names)}\n request.user.message_set.create(message = message)\n request.session['subscribe_for_tags'] = (pure_tag_names, wildcards)\n return HttpResponseRedirect(url_utils.get_login_url())" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 940, "char_start": 933, "chars": "escape(" }, { "char_end": 953, "char_start": 952, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/ASKBOT/askbot-devel/commit/a676a86b6b7a5737d4da4f59f71e037406f88d29", "file_name": "askbot/views/commands.py", "func_name": "subscribe_for_tags", "line_changes": { "added": [ { "char_end": 992, "char_start": 905, "line": " ) % {'url': escape(request.path) + '?tags=' + request.REQUEST['tags']}\n", "line_no": 22 } ], "deleted": [ { "char_end": 984, "char_start": 905, "line": " ) % {'url': request.path + '?tags=' + request.REQUEST['tags']}\n", "line_no": 22 } ] }, "vul_type": "cwe-079" }
169
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def nav_path(request):\n \"\"\"Return current path as list of items with \"name\" and \"href\" members", " The href members are view_directory links for directories and view_log\n links for files, but are set to None when the link would point to\n the current view\"\"\"", " if not request.repos:\n return []", " is_dir = request.pathtype == vclib.DIR", " # add root item\n items = []\n root_item = _item(name=request.server.escape(request.repos.name), href=None)\n if request.path_parts or request.view_func is not view_directory:\n root_item.href = request.get_url(view_func=view_directory,\n where='', pathtype=vclib.DIR,\n params={}, escape=1)\n items.append(root_item)", " # add path part items\n path_parts = []\n for part in request.path_parts:\n path_parts.append(part)\n is_last = len(path_parts) == len(request.path_parts)\n", " item = _item(name=part, href=None)", "\n if not is_last or (is_dir and request.view_func is not view_directory):\n item.href = request.get_url(view_func=view_directory,\n where=_path_join(path_parts),\n pathtype=vclib.DIR,\n params={}, escape=1)\n elif not is_dir and request.view_func is not view_log:\n item.href = request.get_url(view_func=view_log,\n where=_path_join(path_parts),\n pathtype=vclib.FILE,\n params={}, escape=1)\n items.append(item)", " return items" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 941, "char_start": 919, "chars": "request.server.escape(" }, { "char_end": 946, "char_start": 945, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/viewvc/viewvc/commit/9dcfc7daa4c940992920d3b2fbd317da20e44aad", "file_name": "lib/viewvc.py", "func_name": "nav_path", "line_changes": { "added": [ { "char_end": 959, "char_start": 897, "line": " item = _item(name=request.server.escape(part), href=None)\n", "line_no": 28 } ], "deleted": [ { "char_end": 936, "char_start": 897, "line": " item = _item(name=part, href=None)\n", "line_no": 28 } ] }, "vul_type": "cwe-079" }
170
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def nav_path(request):\n \"\"\"Return current path as list of items with \"name\" and \"href\" members", " The href members are view_directory links for directories and view_log\n links for files, but are set to None when the link would point to\n the current view\"\"\"", " if not request.repos:\n return []", " is_dir = request.pathtype == vclib.DIR", " # add root item\n items = []\n root_item = _item(name=request.server.escape(request.repos.name), href=None)\n if request.path_parts or request.view_func is not view_directory:\n root_item.href = request.get_url(view_func=view_directory,\n where='', pathtype=vclib.DIR,\n params={}, escape=1)\n items.append(root_item)", " # add path part items\n path_parts = []\n for part in request.path_parts:\n path_parts.append(part)\n is_last = len(path_parts) == len(request.path_parts)\n", " item = _item(name=request.server.escape(part), href=None)", "\n if not is_last or (is_dir and request.view_func is not view_directory):\n item.href = request.get_url(view_func=view_directory,\n where=_path_join(path_parts),\n pathtype=vclib.DIR,\n params={}, escape=1)\n elif not is_dir and request.view_func is not view_log:\n item.href = request.get_url(view_func=view_log,\n where=_path_join(path_parts),\n pathtype=vclib.FILE,\n params={}, escape=1)\n items.append(item)", " return items" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 941, "char_start": 919, "chars": "request.server.escape(" }, { "char_end": 946, "char_start": 945, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/viewvc/viewvc/commit/9dcfc7daa4c940992920d3b2fbd317da20e44aad", "file_name": "lib/viewvc.py", "func_name": "nav_path", "line_changes": { "added": [ { "char_end": 959, "char_start": 897, "line": " item = _item(name=request.server.escape(part), href=None)\n", "line_no": 28 } ], "deleted": [ { "char_end": 936, "char_start": 897, "line": " item = _item(name=part, href=None)\n", "line_no": 28 } ] }, "vul_type": "cwe-079" }
170
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def __init__(self, *args, **kwargs):\n \"\"\"\n Takes two additional keyword arguments:", " :param cartpos: The cart position the form should be for\n :param event: The event this belongs to\n \"\"\"\n cartpos = self.cartpos = kwargs.pop('cartpos', None)\n orderpos = self.orderpos = kwargs.pop('orderpos', None)\n pos = cartpos or orderpos\n item = pos.item\n questions = pos.item.questions_to_ask\n event = kwargs.pop('event')", " super().__init__(*args, **kwargs)", " if item.admission and event.settings.attendee_names_asked:\n self.fields['attendee_name_parts'] = NamePartsFormField(\n max_length=255,\n required=event.settings.attendee_names_required,\n scheme=event.settings.name_scheme,\n label=_('Attendee name'),\n initial=(cartpos.attendee_name_parts if cartpos else orderpos.attendee_name_parts),\n )\n if item.admission and event.settings.attendee_emails_asked:\n self.fields['attendee_email'] = forms.EmailField(\n required=event.settings.attendee_emails_required,\n label=_('Attendee email'),\n initial=(cartpos.attendee_email if cartpos else orderpos.attendee_email)\n )", " for q in questions:\n # Do we already have an answer? Provide it as the initial value\n answers = [a for a in pos.answerlist if a.question_id == q.id]\n if answers:\n initial = answers[0]\n else:\n initial = None\n tz = pytz.timezone(event.settings.timezone)\n help_text = rich_text(q.help_text)", "", " if q.type == Question.TYPE_BOOLEAN:\n if q.required:\n # For some reason, django-bootstrap3 does not set the required attribute\n # itself.\n widget = forms.CheckboxInput(attrs={'required': 'required'})\n else:\n widget = forms.CheckboxInput()", " if initial:\n initialbool = (initial.answer == \"True\")\n else:\n initialbool = False", " field = forms.BooleanField(", " label=q.question, required=q.required,", " help_text=help_text,\n initial=initialbool, widget=widget,\n )\n elif q.type == Question.TYPE_NUMBER:\n field = forms.DecimalField(", " label=q.question, required=q.required,", " help_text=q.help_text,\n initial=initial.answer if initial else None,\n min_value=Decimal('0.00'),\n )\n elif q.type == Question.TYPE_STRING:\n field = forms.CharField(", " label=q.question, required=q.required,", " help_text=help_text,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_TEXT:\n field = forms.CharField(", " label=q.question, required=q.required,", " help_text=help_text,\n widget=forms.Textarea,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE:\n field = forms.ModelChoiceField(\n queryset=q.options,", " label=q.question, required=q.required,", " help_text=help_text,\n widget=forms.Select,\n empty_label='',\n initial=initial.options.first() if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE_MULTIPLE:\n field = forms.ModelMultipleChoiceField(\n queryset=q.options,", " label=q.question, required=q.required,", " help_text=help_text,\n widget=forms.CheckboxSelectMultiple,\n initial=initial.options.all() if initial else None,\n )\n elif q.type == Question.TYPE_FILE:\n field = forms.FileField(", " label=q.question, required=q.required,", " help_text=help_text,\n initial=initial.file if initial else None,\n widget=UploadedFileWidget(position=pos, event=event, answer=initial),\n )\n elif q.type == Question.TYPE_DATE:\n field = forms.DateField(", " label=q.question, required=q.required,", " help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).date() if initial and initial.answer else None,\n widget=DatePickerWidget(),\n )\n elif q.type == Question.TYPE_TIME:\n field = forms.TimeField(", " label=q.question, required=q.required,", " help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).time() if initial and initial.answer else None,\n widget=TimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n elif q.type == Question.TYPE_DATETIME:\n field = SplitDateTimeField(", " label=q.question, required=q.required,", " help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).astimezone(tz) if initial and initial.answer else None,\n widget=SplitDateTimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n field.question = q\n if answers:\n # Cache the answer object for later use\n field.answer = answers[0]\n self.fields['question_%s' % q.id] = field", " responses = question_form_fields.send(sender=event, position=pos)\n data = pos.meta_info_data\n for r, response in sorted(responses, key=lambda r: str(r[0])):\n for key, value in response.items():\n # We need to be this explicit, since OrderedDict.update does not retain ordering\n self.fields[key] = value\n value.initial = data.get('question_form_data', {}).get(key)" ]
[ 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1799, "char_start": 1723, "chars": "label = escape(q.question) # django-bootstrap3 calls mark_safe\n " }, { "char_end": 2369, "char_start": 2366, "chars": "lab" }, { "char_end": 2371, "char_start": 2370, "chars": "l" }, { "char_end": 2631, "char_start": 2628, "chars": "lab" }, { "char_end": 2633, "char_start": 2632, "chars": "l" }, { "char_end": 2948, "char_start": 2945, "chars": "lab" }, { "char_end": 2950, "char_start": 2949, "chars": "l" }, { "char_end": 3214, "char_start": 3211, "chars": "lab" }, { "char_end": 3216, "char_start": 3215, "chars": "l" }, { "char_end": 3572, "char_start": 3569, "chars": "lab" }, { "char_end": 3574, "char_start": 3573, "chars": "l" }, { "char_end": 3990, "char_start": 3987, "chars": "lab" }, { "char_end": 3992, "char_start": 3991, "chars": "l" }, { "char_end": 4320, "char_start": 4317, "chars": "lab" }, { "char_end": 4322, "char_start": 4321, "chars": "l" }, { "char_end": 4674, "char_start": 4671, "chars": "lab" }, { "char_end": 4676, "char_start": 4675, "chars": "l" }, { "char_end": 5036, "char_start": 5033, "chars": "lab" }, { "char_end": 5038, "char_start": 5037, "chars": "l" }, { "char_end": 5465, "char_start": 5462, "chars": "lab" }, { "char_end": 5467, "char_start": 5466, "chars": "l" } ], "deleted": [ { "char_end": 1759, "char_start": 1759, "chars": "" }, { "char_end": 2294, "char_start": 2290, "chars": "q.qu" }, { "char_end": 2300, "char_start": 2295, "chars": "stion" }, { "char_end": 2561, "char_start": 2557, "chars": "q.qu" }, { "char_end": 2567, "char_start": 2562, "chars": "stion" }, { "char_end": 2883, "char_start": 2879, "chars": "q.qu" }, { "char_end": 2889, "char_start": 2884, "chars": "stion" }, { "char_end": 3154, "char_start": 3150, "chars": "q.qu" }, { "char_end": 3160, "char_start": 3155, "chars": "stion" }, { "char_end": 3517, "char_start": 3513, "chars": "q.qu" }, { "char_end": 3523, "char_start": 3518, "chars": "stion" }, { "char_end": 3940, "char_start": 3936, "chars": "q.qu" }, { "char_end": 3946, "char_start": 3941, "chars": "stion" }, { "char_end": 4275, "char_start": 4271, "chars": "q.qu" }, { "char_end": 4281, "char_start": 4276, "chars": "stion" }, { "char_end": 4634, "char_start": 4630, "chars": "q.qu" }, { "char_end": 4640, "char_start": 4635, "chars": "stion" }, { "char_end": 5001, "char_start": 4997, "chars": "q.qu" }, { "char_end": 5007, "char_start": 5002, "chars": "stion" }, { "char_end": 5435, "char_start": 5431, "chars": "q.qu" }, { "char_end": 5441, "char_start": 5436, "chars": "stion" } ] }, "commit_link": "github.com/pretix/pretix/commit/affc6254a8316643d4afe9e8b7f8cd288c86ca1f", "file_name": "src/pretix/base/forms/questions.py", "func_name": "__init__", "line_changes": { "added": [ { "char_end": 1787, "char_start": 1711, "line": " label = escape(q.question) # django-bootstrap3 calls mark_safe\n", "line_no": 41 }, { "char_end": 2394, "char_start": 2340, "line": " label=label, required=q.required,\n", "line_no": 56 }, { "char_end": 2656, "char_start": 2602, "line": " label=label, required=q.required,\n", "line_no": 62 }, { "char_end": 2973, "char_start": 2919, "line": " label=label, required=q.required,\n", "line_no": 69 }, { "char_end": 3239, "char_start": 3185, "line": " label=label, required=q.required,\n", "line_no": 75 }, { "char_end": 3597, "char_start": 3543, "line": " label=label, required=q.required,\n", "line_no": 83 }, { "char_end": 4015, "char_start": 3961, "line": " label=label, required=q.required,\n", "line_no": 92 }, { "char_end": 4345, "char_start": 4291, "line": " label=label, required=q.required,\n", "line_no": 99 }, { "char_end": 4699, "char_start": 4645, "line": " label=label, required=q.required,\n", "line_no": 106 }, { "char_end": 5061, "char_start": 5007, "line": " label=label, required=q.required,\n", "line_no": 113 }, { "char_end": 5490, "char_start": 5436, "line": " label=label, required=q.required,\n", "line_no": 120 } ], "deleted": [ { "char_end": 2323, "char_start": 2264, "line": " label=q.question, required=q.required,\n", "line_no": 55 }, { "char_end": 2590, "char_start": 2531, "line": " label=q.question, required=q.required,\n", "line_no": 61 }, { "char_end": 2912, "char_start": 2853, "line": " label=q.question, required=q.required,\n", "line_no": 68 }, { "char_end": 3183, "char_start": 3124, "line": " label=q.question, required=q.required,\n", "line_no": 74 }, { "char_end": 3546, "char_start": 3487, "line": " label=q.question, required=q.required,\n", "line_no": 82 }, { "char_end": 3969, "char_start": 3910, "line": " label=q.question, required=q.required,\n", "line_no": 91 }, { "char_end": 4304, "char_start": 4245, "line": " label=q.question, required=q.required,\n", "line_no": 98 }, { "char_end": 4663, "char_start": 4604, "line": " label=q.question, required=q.required,\n", "line_no": 105 }, { "char_end": 5030, "char_start": 4971, "line": " label=q.question, required=q.required,\n", "line_no": 112 }, { "char_end": 5464, "char_start": 5405, "line": " label=q.question, required=q.required,\n", "line_no": 119 } ] }, "vul_type": "cwe-079" }
171
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def __init__(self, *args, **kwargs):\n \"\"\"\n Takes two additional keyword arguments:", " :param cartpos: The cart position the form should be for\n :param event: The event this belongs to\n \"\"\"\n cartpos = self.cartpos = kwargs.pop('cartpos', None)\n orderpos = self.orderpos = kwargs.pop('orderpos', None)\n pos = cartpos or orderpos\n item = pos.item\n questions = pos.item.questions_to_ask\n event = kwargs.pop('event')", " super().__init__(*args, **kwargs)", " if item.admission and event.settings.attendee_names_asked:\n self.fields['attendee_name_parts'] = NamePartsFormField(\n max_length=255,\n required=event.settings.attendee_names_required,\n scheme=event.settings.name_scheme,\n label=_('Attendee name'),\n initial=(cartpos.attendee_name_parts if cartpos else orderpos.attendee_name_parts),\n )\n if item.admission and event.settings.attendee_emails_asked:\n self.fields['attendee_email'] = forms.EmailField(\n required=event.settings.attendee_emails_required,\n label=_('Attendee email'),\n initial=(cartpos.attendee_email if cartpos else orderpos.attendee_email)\n )", " for q in questions:\n # Do we already have an answer? Provide it as the initial value\n answers = [a for a in pos.answerlist if a.question_id == q.id]\n if answers:\n initial = answers[0]\n else:\n initial = None\n tz = pytz.timezone(event.settings.timezone)\n help_text = rich_text(q.help_text)", " label = escape(q.question) # django-bootstrap3 calls mark_safe", " if q.type == Question.TYPE_BOOLEAN:\n if q.required:\n # For some reason, django-bootstrap3 does not set the required attribute\n # itself.\n widget = forms.CheckboxInput(attrs={'required': 'required'})\n else:\n widget = forms.CheckboxInput()", " if initial:\n initialbool = (initial.answer == \"True\")\n else:\n initialbool = False", " field = forms.BooleanField(", " label=label, required=q.required,", " help_text=help_text,\n initial=initialbool, widget=widget,\n )\n elif q.type == Question.TYPE_NUMBER:\n field = forms.DecimalField(", " label=label, required=q.required,", " help_text=q.help_text,\n initial=initial.answer if initial else None,\n min_value=Decimal('0.00'),\n )\n elif q.type == Question.TYPE_STRING:\n field = forms.CharField(", " label=label, required=q.required,", " help_text=help_text,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_TEXT:\n field = forms.CharField(", " label=label, required=q.required,", " help_text=help_text,\n widget=forms.Textarea,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE:\n field = forms.ModelChoiceField(\n queryset=q.options,", " label=label, required=q.required,", " help_text=help_text,\n widget=forms.Select,\n empty_label='',\n initial=initial.options.first() if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE_MULTIPLE:\n field = forms.ModelMultipleChoiceField(\n queryset=q.options,", " label=label, required=q.required,", " help_text=help_text,\n widget=forms.CheckboxSelectMultiple,\n initial=initial.options.all() if initial else None,\n )\n elif q.type == Question.TYPE_FILE:\n field = forms.FileField(", " label=label, required=q.required,", " help_text=help_text,\n initial=initial.file if initial else None,\n widget=UploadedFileWidget(position=pos, event=event, answer=initial),\n )\n elif q.type == Question.TYPE_DATE:\n field = forms.DateField(", " label=label, required=q.required,", " help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).date() if initial and initial.answer else None,\n widget=DatePickerWidget(),\n )\n elif q.type == Question.TYPE_TIME:\n field = forms.TimeField(", " label=label, required=q.required,", " help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).time() if initial and initial.answer else None,\n widget=TimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n elif q.type == Question.TYPE_DATETIME:\n field = SplitDateTimeField(", " label=label, required=q.required,", " help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).astimezone(tz) if initial and initial.answer else None,\n widget=SplitDateTimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n field.question = q\n if answers:\n # Cache the answer object for later use\n field.answer = answers[0]\n self.fields['question_%s' % q.id] = field", " responses = question_form_fields.send(sender=event, position=pos)\n data = pos.meta_info_data\n for r, response in sorted(responses, key=lambda r: str(r[0])):\n for key, value in response.items():\n # We need to be this explicit, since OrderedDict.update does not retain ordering\n self.fields[key] = value\n value.initial = data.get('question_form_data', {}).get(key)" ]
[ 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": 1799, "char_start": 1723, "chars": "label = escape(q.question) # django-bootstrap3 calls mark_safe\n " }, { "char_end": 2369, "char_start": 2366, "chars": "lab" }, { "char_end": 2371, "char_start": 2370, "chars": "l" }, { "char_end": 2631, "char_start": 2628, "chars": "lab" }, { "char_end": 2633, "char_start": 2632, "chars": "l" }, { "char_end": 2948, "char_start": 2945, "chars": "lab" }, { "char_end": 2950, "char_start": 2949, "chars": "l" }, { "char_end": 3214, "char_start": 3211, "chars": "lab" }, { "char_end": 3216, "char_start": 3215, "chars": "l" }, { "char_end": 3572, "char_start": 3569, "chars": "lab" }, { "char_end": 3574, "char_start": 3573, "chars": "l" }, { "char_end": 3990, "char_start": 3987, "chars": "lab" }, { "char_end": 3992, "char_start": 3991, "chars": "l" }, { "char_end": 4320, "char_start": 4317, "chars": "lab" }, { "char_end": 4322, "char_start": 4321, "chars": "l" }, { "char_end": 4674, "char_start": 4671, "chars": "lab" }, { "char_end": 4676, "char_start": 4675, "chars": "l" }, { "char_end": 5036, "char_start": 5033, "chars": "lab" }, { "char_end": 5038, "char_start": 5037, "chars": "l" }, { "char_end": 5465, "char_start": 5462, "chars": "lab" }, { "char_end": 5467, "char_start": 5466, "chars": "l" } ], "deleted": [ { "char_end": 1759, "char_start": 1759, "chars": "" }, { "char_end": 2294, "char_start": 2290, "chars": "q.qu" }, { "char_end": 2300, "char_start": 2295, "chars": "stion" }, { "char_end": 2561, "char_start": 2557, "chars": "q.qu" }, { "char_end": 2567, "char_start": 2562, "chars": "stion" }, { "char_end": 2883, "char_start": 2879, "chars": "q.qu" }, { "char_end": 2889, "char_start": 2884, "chars": "stion" }, { "char_end": 3154, "char_start": 3150, "chars": "q.qu" }, { "char_end": 3160, "char_start": 3155, "chars": "stion" }, { "char_end": 3517, "char_start": 3513, "chars": "q.qu" }, { "char_end": 3523, "char_start": 3518, "chars": "stion" }, { "char_end": 3940, "char_start": 3936, "chars": "q.qu" }, { "char_end": 3946, "char_start": 3941, "chars": "stion" }, { "char_end": 4275, "char_start": 4271, "chars": "q.qu" }, { "char_end": 4281, "char_start": 4276, "chars": "stion" }, { "char_end": 4634, "char_start": 4630, "chars": "q.qu" }, { "char_end": 4640, "char_start": 4635, "chars": "stion" }, { "char_end": 5001, "char_start": 4997, "chars": "q.qu" }, { "char_end": 5007, "char_start": 5002, "chars": "stion" }, { "char_end": 5435, "char_start": 5431, "chars": "q.qu" }, { "char_end": 5441, "char_start": 5436, "chars": "stion" } ] }, "commit_link": "github.com/pretix/pretix/commit/affc6254a8316643d4afe9e8b7f8cd288c86ca1f", "file_name": "src/pretix/base/forms/questions.py", "func_name": "__init__", "line_changes": { "added": [ { "char_end": 1787, "char_start": 1711, "line": " label = escape(q.question) # django-bootstrap3 calls mark_safe\n", "line_no": 41 }, { "char_end": 2394, "char_start": 2340, "line": " label=label, required=q.required,\n", "line_no": 56 }, { "char_end": 2656, "char_start": 2602, "line": " label=label, required=q.required,\n", "line_no": 62 }, { "char_end": 2973, "char_start": 2919, "line": " label=label, required=q.required,\n", "line_no": 69 }, { "char_end": 3239, "char_start": 3185, "line": " label=label, required=q.required,\n", "line_no": 75 }, { "char_end": 3597, "char_start": 3543, "line": " label=label, required=q.required,\n", "line_no": 83 }, { "char_end": 4015, "char_start": 3961, "line": " label=label, required=q.required,\n", "line_no": 92 }, { "char_end": 4345, "char_start": 4291, "line": " label=label, required=q.required,\n", "line_no": 99 }, { "char_end": 4699, "char_start": 4645, "line": " label=label, required=q.required,\n", "line_no": 106 }, { "char_end": 5061, "char_start": 5007, "line": " label=label, required=q.required,\n", "line_no": 113 }, { "char_end": 5490, "char_start": 5436, "line": " label=label, required=q.required,\n", "line_no": 120 } ], "deleted": [ { "char_end": 2323, "char_start": 2264, "line": " label=q.question, required=q.required,\n", "line_no": 55 }, { "char_end": 2590, "char_start": 2531, "line": " label=q.question, required=q.required,\n", "line_no": 61 }, { "char_end": 2912, "char_start": 2853, "line": " label=q.question, required=q.required,\n", "line_no": 68 }, { "char_end": 3183, "char_start": 3124, "line": " label=q.question, required=q.required,\n", "line_no": 74 }, { "char_end": 3546, "char_start": 3487, "line": " label=q.question, required=q.required,\n", "line_no": 82 }, { "char_end": 3969, "char_start": 3910, "line": " label=q.question, required=q.required,\n", "line_no": 91 }, { "char_end": 4304, "char_start": 4245, "line": " label=q.question, required=q.required,\n", "line_no": 98 }, { "char_end": 4663, "char_start": 4604, "line": " label=q.question, required=q.required,\n", "line_no": 105 }, { "char_end": 5030, "char_start": 4971, "line": " label=q.question, required=q.required,\n", "line_no": 112 }, { "char_end": 5464, "char_start": 5405, "line": " label=q.question, required=q.required,\n", "line_no": 119 } ] }, "vul_type": "cwe-079" }
171
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def link_dialog(request):\n # list of wiki pages\n name = request.values.get(\"pagename\", \"\")", "", " if name:\n from MoinMoin import search\n # XXX error handling!\n searchresult = search.searchPages(request, 't:\"%s\"' % name)", " pages = [p.page_name for p in searchresult.hits]\n pages.sort()\n pages[0:0] = [name]\n page_list = '''\n <tr>\n <td colspan=2>\n <select id=\"sctPagename\" size=\"1\" onchange=\"OnChangePagename(this.value);\">\n %s\n </select>\n <td>\n </tr>\n''' % \"\\n\".join(['<option value=\"%s\">%s</option>' % (wikiutil.escape(page), wikiutil.escape(page))\n for page in pages])\n else:\n page_list = \"\"", " # list of interwiki names\n interwiki_list = wikiutil.load_wikimap(request)\n interwiki = interwiki_list.keys()\n interwiki.sort()\n iwpreferred = request.cfg.interwiki_preferred[:]\n if not iwpreferred or iwpreferred and iwpreferred[-1] is not None:\n resultlist = iwpreferred\n for iw in interwiki:\n if not iw in iwpreferred:\n resultlist.append(iw)\n else:\n resultlist = iwpreferred[:-1]\n interwiki = \"\\n\".join(\n ['<option value=\"%s\">%s</option>' % (wikiutil.escape(key), wikiutil.escape(key))\n for key in resultlist])", " # wiki url\n url_prefix_static = request.cfg.url_prefix_static\n scriptname = request.script_root + '/'\n action = scriptname\n basepage = wikiutil.escape(request.page.page_name)\n request.write(u'''\n<!--\n * FCKeditor - The text editor for internet\n * Copyright (C) 2003-2004 Frederico Caldeira Knabben\n *\n * Licensed under the terms of the GNU Lesser General Public License:\n * http://www.opensource.org/licenses/lgpl-license.php\n *\n * For further information visit:\n * http://www.fckeditor.net/\n *\n * File Name: fck_link.html\n * Link dialog window.\n *\n * Version: 2.0 FC (Preview)\n * Modified: 2005-02-18 23:55:22\n *\n * File Authors:\n * Frederico Caldeira Knabben (fredck@fckeditor.net)\n-->\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n<meta name=\"robots\" content=\"index,nofollow\">\n<html>\n <head>\n <title>Link Properties</title>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"robots\" content=\"noindex,nofollow\" />\n <script src=\"%(url_prefix_static)s/applets/FCKeditor/editor/dialog/common/fck_dialog_common.js\" type=\"text/javascript\"></script>\n <script src=\"%(url_prefix_static)s/applets/moinFCKplugins/moinlink/fck_link.js\" type=\"text/javascript\"></script>\n <script src=\"%(url_prefix_static)s/applets/moinFCKplugins/moinurllib.js\" type=\"text/javascript\"></script>\n </head>\n <body scroll=\"no\" style=\"OVERFLOW: hidden\">\n <div id=\"divInfo\" style=\"DISPLAY: none\">\n <span fckLang=\"DlgLnkType\">Link Type</span><br />\n <select id=\"cmbLinkType\" onchange=\"SetLinkType(this.value);\">\n <option value=\"wiki\" selected=\"selected\">WikiPage</option>\n <option value=\"interwiki\">Interwiki</option>\n <option value=\"url\" fckLang=\"DlgLnkTypeURL\">URL</option>\n </select>\n <br />\n <br />\n <div id=\"divLinkTypeWiki\">\n <table height=\"100%%\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%%\" border=\"0\">\n <tr>\n <td>\n <form action=%(action)s method=\"GET\">\n <input type=\"hidden\" name=\"action\" value=\"fckdialog\">\n <input type=\"hidden\" name=\"dialog\" value=\"link\">\n <input type=\"hidden\" id=\"basepage\" name=\"basepage\" value=\"%(basepage)s\">\n <table cellSpacing=\"0\" cellPadding=\"0\" align=\"center\" border=\"0\">\n <tr>\n <td>\n <span fckLang=\"PageDlgName\">Page Name</span><br>", " <input id=\"txtPagename\" name=\"pagename\" size=\"30\" value=\"%(name)s\">", " </td>\n <td valign=\"bottom\">\n <input id=btnSearchpage type=\"submit\" value=\"Search\">\n </td>\n </tr>\n %(page_list)s\n </table>\n </form>\n </td>\n </tr>\n </table>\n </div>\n <div id=\"divLinkTypeInterwiki\">\n <table height=\"100%%\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%%\" border=\"0\">\n <tr>\n <td>\n <table cellSpacing=\"0\" cellPadding=\"0\" align=\"center\" border=\"0\">\n <tr>\n <td>\n <span fckLang=\"WikiDlgName\">Wiki:PageName</span><br>\n <select id=\"sctInterwiki\" size=\"1\">\n %(interwiki)s\n </select>:\n <input id=\"txtInterwikipagename\"></input>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </div>\n <div id=\"divLinkTypeUrl\">\n <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%%\" border=\"0\">\n <tr>\n <td nowrap=\"nowrap\">\n <span fckLang=\"DlgLnkProto\">Protocol</span><br />\n <select id=\"cmbLinkProtocol\">\n <option value=\"http://\" selected=\"selected\">http://</option>\n <option value=\"https://\">https://</option>\n <option value=\"ftp://\">ftp://</option>\n <option value=\"file://\">file://</option>\n <option value=\"news://\">news://</option>\n <option value=\"mailto:\">mailto:</option>\n <option value=\"\" fckLang=\"DlgLnkProtoOther\">&lt;other&gt;</option>\n </select>\n </td>\n <td nowrap=\"nowrap\">&nbsp;</td>\n <td nowrap=\"nowrap\" width=\"100%%\">\n <span fckLang=\"DlgLnkURL\">URL</span><br />\n <input id=\"txtUrl\" style=\"WIDTH: 100%%\" type=\"text\" onkeyup=\"OnUrlChange();\" onchange=\"OnUrlChange();\" />\n </td>\n </tr>\n </table>\n <br />\n </div>\n </div>\n </body>\n</html>\n''' % locals())" ]
[ 1, 0, 1, 1, 1, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 142, "char_start": 101, "chars": "name_escaped = wikiutil.escape(name)\n " }, { "char_end": 3833, "char_start": 3825, "chars": "_escaped" } ], "deleted": [] }, "commit_link": "github.com/moinwiki/moin-1.9/commit/70955a8eae091cc88fd9a6e510177e70289ec024", "file_name": "MoinMoin/action/fckdialog.py", "func_name": "link_dialog", "line_changes": { "added": [ { "char_end": 138, "char_start": 97, "line": " name_escaped = wikiutil.escape(name)\n", "line_no": 4 }, { "char_end": 3838, "char_start": 3752, "line": " <input id=\"txtPagename\" name=\"pagename\" size=\"30\" value=\"%(name_escaped)s\">\n", "line_no": 101 } ], "deleted": [ { "char_end": 3789, "char_start": 3711, "line": " <input id=\"txtPagename\" name=\"pagename\" size=\"30\" value=\"%(name)s\">\n", "line_no": 100 } ] }, "vul_type": "cwe-079" }
172
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def link_dialog(request):\n # list of wiki pages\n name = request.values.get(\"pagename\", \"\")", " name_escaped = wikiutil.escape(name)", " if name:\n from MoinMoin import search\n # XXX error handling!\n searchresult = search.searchPages(request, 't:\"%s\"' % name)", " pages = [p.page_name for p in searchresult.hits]\n pages.sort()\n pages[0:0] = [name]\n page_list = '''\n <tr>\n <td colspan=2>\n <select id=\"sctPagename\" size=\"1\" onchange=\"OnChangePagename(this.value);\">\n %s\n </select>\n <td>\n </tr>\n''' % \"\\n\".join(['<option value=\"%s\">%s</option>' % (wikiutil.escape(page), wikiutil.escape(page))\n for page in pages])\n else:\n page_list = \"\"", " # list of interwiki names\n interwiki_list = wikiutil.load_wikimap(request)\n interwiki = interwiki_list.keys()\n interwiki.sort()\n iwpreferred = request.cfg.interwiki_preferred[:]\n if not iwpreferred or iwpreferred and iwpreferred[-1] is not None:\n resultlist = iwpreferred\n for iw in interwiki:\n if not iw in iwpreferred:\n resultlist.append(iw)\n else:\n resultlist = iwpreferred[:-1]\n interwiki = \"\\n\".join(\n ['<option value=\"%s\">%s</option>' % (wikiutil.escape(key), wikiutil.escape(key))\n for key in resultlist])", " # wiki url\n url_prefix_static = request.cfg.url_prefix_static\n scriptname = request.script_root + '/'\n action = scriptname\n basepage = wikiutil.escape(request.page.page_name)\n request.write(u'''\n<!--\n * FCKeditor - The text editor for internet\n * Copyright (C) 2003-2004 Frederico Caldeira Knabben\n *\n * Licensed under the terms of the GNU Lesser General Public License:\n * http://www.opensource.org/licenses/lgpl-license.php\n *\n * For further information visit:\n * http://www.fckeditor.net/\n *\n * File Name: fck_link.html\n * Link dialog window.\n *\n * Version: 2.0 FC (Preview)\n * Modified: 2005-02-18 23:55:22\n *\n * File Authors:\n * Frederico Caldeira Knabben (fredck@fckeditor.net)\n-->\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n<meta name=\"robots\" content=\"index,nofollow\">\n<html>\n <head>\n <title>Link Properties</title>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"robots\" content=\"noindex,nofollow\" />\n <script src=\"%(url_prefix_static)s/applets/FCKeditor/editor/dialog/common/fck_dialog_common.js\" type=\"text/javascript\"></script>\n <script src=\"%(url_prefix_static)s/applets/moinFCKplugins/moinlink/fck_link.js\" type=\"text/javascript\"></script>\n <script src=\"%(url_prefix_static)s/applets/moinFCKplugins/moinurllib.js\" type=\"text/javascript\"></script>\n </head>\n <body scroll=\"no\" style=\"OVERFLOW: hidden\">\n <div id=\"divInfo\" style=\"DISPLAY: none\">\n <span fckLang=\"DlgLnkType\">Link Type</span><br />\n <select id=\"cmbLinkType\" onchange=\"SetLinkType(this.value);\">\n <option value=\"wiki\" selected=\"selected\">WikiPage</option>\n <option value=\"interwiki\">Interwiki</option>\n <option value=\"url\" fckLang=\"DlgLnkTypeURL\">URL</option>\n </select>\n <br />\n <br />\n <div id=\"divLinkTypeWiki\">\n <table height=\"100%%\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%%\" border=\"0\">\n <tr>\n <td>\n <form action=%(action)s method=\"GET\">\n <input type=\"hidden\" name=\"action\" value=\"fckdialog\">\n <input type=\"hidden\" name=\"dialog\" value=\"link\">\n <input type=\"hidden\" id=\"basepage\" name=\"basepage\" value=\"%(basepage)s\">\n <table cellSpacing=\"0\" cellPadding=\"0\" align=\"center\" border=\"0\">\n <tr>\n <td>\n <span fckLang=\"PageDlgName\">Page Name</span><br>", " <input id=\"txtPagename\" name=\"pagename\" size=\"30\" value=\"%(name_escaped)s\">", " </td>\n <td valign=\"bottom\">\n <input id=btnSearchpage type=\"submit\" value=\"Search\">\n </td>\n </tr>\n %(page_list)s\n </table>\n </form>\n </td>\n </tr>\n </table>\n </div>\n <div id=\"divLinkTypeInterwiki\">\n <table height=\"100%%\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%%\" border=\"0\">\n <tr>\n <td>\n <table cellSpacing=\"0\" cellPadding=\"0\" align=\"center\" border=\"0\">\n <tr>\n <td>\n <span fckLang=\"WikiDlgName\">Wiki:PageName</span><br>\n <select id=\"sctInterwiki\" size=\"1\">\n %(interwiki)s\n </select>:\n <input id=\"txtInterwikipagename\"></input>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </div>\n <div id=\"divLinkTypeUrl\">\n <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%%\" border=\"0\">\n <tr>\n <td nowrap=\"nowrap\">\n <span fckLang=\"DlgLnkProto\">Protocol</span><br />\n <select id=\"cmbLinkProtocol\">\n <option value=\"http://\" selected=\"selected\">http://</option>\n <option value=\"https://\">https://</option>\n <option value=\"ftp://\">ftp://</option>\n <option value=\"file://\">file://</option>\n <option value=\"news://\">news://</option>\n <option value=\"mailto:\">mailto:</option>\n <option value=\"\" fckLang=\"DlgLnkProtoOther\">&lt;other&gt;</option>\n </select>\n </td>\n <td nowrap=\"nowrap\">&nbsp;</td>\n <td nowrap=\"nowrap\" width=\"100%%\">\n <span fckLang=\"DlgLnkURL\">URL</span><br />\n <input id=\"txtUrl\" style=\"WIDTH: 100%%\" type=\"text\" onkeyup=\"OnUrlChange();\" onchange=\"OnUrlChange();\" />\n </td>\n </tr>\n </table>\n <br />\n </div>\n </div>\n </body>\n</html>\n''' % locals())" ]
[ 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 142, "char_start": 101, "chars": "name_escaped = wikiutil.escape(name)\n " }, { "char_end": 3833, "char_start": 3825, "chars": "_escaped" } ], "deleted": [] }, "commit_link": "github.com/moinwiki/moin-1.9/commit/70955a8eae091cc88fd9a6e510177e70289ec024", "file_name": "MoinMoin/action/fckdialog.py", "func_name": "link_dialog", "line_changes": { "added": [ { "char_end": 138, "char_start": 97, "line": " name_escaped = wikiutil.escape(name)\n", "line_no": 4 }, { "char_end": 3838, "char_start": 3752, "line": " <input id=\"txtPagename\" name=\"pagename\" size=\"30\" value=\"%(name_escaped)s\">\n", "line_no": 101 } ], "deleted": [ { "char_end": 3789, "char_start": 3711, "line": " <input id=\"txtPagename\" name=\"pagename\" size=\"30\" value=\"%(name)s\">\n", "line_no": 100 } ] }, "vul_type": "cwe-079" }
172
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def action_save_user(request: HttpRequest, default_forward_url: str = \"/admin/users\"):\n \"\"\"\n This functions saves the changes to the user or adds a new one. It completely creates the HttpResponse\n :param request: the HttpRequest\n :param default_forward_url: The URL to forward to if nothing was specified\n :return: The crafted HttpResponse\n \"\"\"\n forward_url = default_forward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if not request.user.is_authenticated:\n return HttpResponseForbidden()\n profile = Profile.objects.get(authuser=request.user)\n if profile.rights < 2:\n return HttpResponseForbidden()\n try:\n if request.GET.get(\"user_id\"):\n pid = int(request.GET[\"user_id\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n user: Profile = Profile.objects.get(pk=pid)", " user.displayName = displayname", " user.dect = dect", " user.notes = notes", " user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n if request.POST.get(\"active\"):\n user.active = magic.parse_bool(request.POST[\"active\"])\n au: User = user.authuser\n if check_password_conformity(pw1, pw2):\n logging.log(logging.INFO, \"Set password for user: \" + user.displayName)\n au.set_password(pw1)\n else:\n logging.log(logging.INFO, \"Failed to set password for: \" + user.displayName)", " au.email = mail", " au.save()\n user.save()\n else:\n # assume new user\n username = str(request.POST[\"username\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n if not check_password_conformity(pw1, pw2):\n recreate_form('password mismatch')", " auth_user: User = User.objects.create_user(username=username, email=mail, password=pw1)", " auth_user.save()\n user: Profile = Profile()\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])", " user.displayName = displayname", " user.authuser = auth_user\n user.dect = dect", " user.notes = notes", " user.active = True\n user.save()\n pass\n pass\n except Exception as e:\n return HttpResponseBadRequest(str(e))\n return redirect(forward_url)" ]
[ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1226, "char_start": 1219, "chars": "escape(" }, { "char_end": 1238, "char_start": 1237, "chars": ")" }, { "char_end": 1300, "char_start": 1293, "chars": "escape(" }, { "char_end": 1306, "char_start": 1305, "chars": ")" }, { "char_end": 1901, "char_start": 1894, "chars": "escape(" }, { "char_end": 1906, "char_start": 1905, "chars": ")" }, { "char_end": 2579, "char_start": 2572, "chars": "escape(" }, { "char_end": 2588, "char_start": 2587, "chars": ")" }, { "char_end": 2603, "char_start": 2596, "chars": "escape(" }, { "char_end": 2608, "char_start": 2607, "chars": ")" }, { "char_end": 2854, "char_start": 2847, "chars": "escape(" }, { "char_end": 2866, "char_start": 2865, "chars": ")" }, { "char_end": 2966, "char_start": 2959, "chars": "escape(" }, { "char_end": 2972, "char_start": 2971, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600", "file_name": "c3shop/frontpage/management/edit_user.py", "func_name": "action_save_user", "line_changes": { "added": [ { "char_end": 1239, "char_start": 1188, "line": " user.displayName = escape(displayname)\n", "line_no": 27 }, { "char_end": 1307, "char_start": 1268, "line": " user.notes = escape(notes)\n", "line_no": 29 }, { "char_end": 1907, "char_start": 1871, "line": " au.email = escape(mail)\n", "line_no": 40 }, { "char_end": 2624, "char_start": 2508, "line": " auth_user: User = User.objects.create_user(username=escape(username), email=escape(mail), password=pw1)\n", "line_no": 55 }, { "char_end": 2867, "char_start": 2816, "line": " user.displayName = escape(displayname)\n", "line_no": 60 }, { "char_end": 2973, "char_start": 2934, "line": " user.notes = escape(notes)\n", "line_no": 63 } ], "deleted": [ { "char_end": 1231, "char_start": 1188, "line": " user.displayName = displayname\n", "line_no": 27 }, { "char_end": 1291, "char_start": 1260, "line": " user.notes = notes\n", "line_no": 29 }, { "char_end": 1883, "char_start": 1855, "line": " au.email = mail\n", "line_no": 40 }, { "char_end": 2584, "char_start": 2484, "line": " auth_user: User = User.objects.create_user(username=username, email=mail, password=pw1)\n", "line_no": 55 }, { "char_end": 2819, "char_start": 2776, "line": " user.displayName = displayname\n", "line_no": 60 }, { "char_end": 2917, "char_start": 2886, "line": " user.notes = notes\n", "line_no": 63 } ] }, "vul_type": "cwe-079" }
173
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def action_save_user(request: HttpRequest, default_forward_url: str = \"/admin/users\"):\n \"\"\"\n This functions saves the changes to the user or adds a new one. It completely creates the HttpResponse\n :param request: the HttpRequest\n :param default_forward_url: The URL to forward to if nothing was specified\n :return: The crafted HttpResponse\n \"\"\"\n forward_url = default_forward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if not request.user.is_authenticated:\n return HttpResponseForbidden()\n profile = Profile.objects.get(authuser=request.user)\n if profile.rights < 2:\n return HttpResponseForbidden()\n try:\n if request.GET.get(\"user_id\"):\n pid = int(request.GET[\"user_id\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n user: Profile = Profile.objects.get(pk=pid)", " user.displayName = escape(displayname)", " user.dect = dect", " user.notes = escape(notes)", " user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n if request.POST.get(\"active\"):\n user.active = magic.parse_bool(request.POST[\"active\"])\n au: User = user.authuser\n if check_password_conformity(pw1, pw2):\n logging.log(logging.INFO, \"Set password for user: \" + user.displayName)\n au.set_password(pw1)\n else:\n logging.log(logging.INFO, \"Failed to set password for: \" + user.displayName)", " au.email = escape(mail)", " au.save()\n user.save()\n else:\n # assume new user\n username = str(request.POST[\"username\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n if not check_password_conformity(pw1, pw2):\n recreate_form('password mismatch')", " auth_user: User = User.objects.create_user(username=escape(username), email=escape(mail), password=pw1)", " auth_user.save()\n user: Profile = Profile()\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])", " user.displayName = escape(displayname)", " user.authuser = auth_user\n user.dect = dect", " user.notes = escape(notes)", " user.active = True\n user.save()\n pass\n pass\n except Exception as e:\n return HttpResponseBadRequest(str(e))\n return redirect(forward_url)" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1226, "char_start": 1219, "chars": "escape(" }, { "char_end": 1238, "char_start": 1237, "chars": ")" }, { "char_end": 1300, "char_start": 1293, "chars": "escape(" }, { "char_end": 1306, "char_start": 1305, "chars": ")" }, { "char_end": 1901, "char_start": 1894, "chars": "escape(" }, { "char_end": 1906, "char_start": 1905, "chars": ")" }, { "char_end": 2579, "char_start": 2572, "chars": "escape(" }, { "char_end": 2588, "char_start": 2587, "chars": ")" }, { "char_end": 2603, "char_start": 2596, "chars": "escape(" }, { "char_end": 2608, "char_start": 2607, "chars": ")" }, { "char_end": 2854, "char_start": 2847, "chars": "escape(" }, { "char_end": 2866, "char_start": 2865, "chars": ")" }, { "char_end": 2966, "char_start": 2959, "chars": "escape(" }, { "char_end": 2972, "char_start": 2971, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600", "file_name": "c3shop/frontpage/management/edit_user.py", "func_name": "action_save_user", "line_changes": { "added": [ { "char_end": 1239, "char_start": 1188, "line": " user.displayName = escape(displayname)\n", "line_no": 27 }, { "char_end": 1307, "char_start": 1268, "line": " user.notes = escape(notes)\n", "line_no": 29 }, { "char_end": 1907, "char_start": 1871, "line": " au.email = escape(mail)\n", "line_no": 40 }, { "char_end": 2624, "char_start": 2508, "line": " auth_user: User = User.objects.create_user(username=escape(username), email=escape(mail), password=pw1)\n", "line_no": 55 }, { "char_end": 2867, "char_start": 2816, "line": " user.displayName = escape(displayname)\n", "line_no": 60 }, { "char_end": 2973, "char_start": 2934, "line": " user.notes = escape(notes)\n", "line_no": 63 } ], "deleted": [ { "char_end": 1231, "char_start": 1188, "line": " user.displayName = displayname\n", "line_no": 27 }, { "char_end": 1291, "char_start": 1260, "line": " user.notes = notes\n", "line_no": 29 }, { "char_end": 1883, "char_start": 1855, "line": " au.email = mail\n", "line_no": 40 }, { "char_end": 2584, "char_start": 2484, "line": " auth_user: User = User.objects.create_user(username=username, email=mail, password=pw1)\n", "line_no": 55 }, { "char_end": 2819, "char_start": 2776, "line": " user.displayName = displayname\n", "line_no": 60 }, { "char_end": 2917, "char_start": 2886, "line": " user.notes = notes\n", "line_no": 63 } ] }, "vul_type": "cwe-079" }
173
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def save(self):\n # copy the user's input from plain text to description to be processed", " self.description = self.description_plain_text", " if CE.settings.auto_cross_reference:\n self.auto_cross_ref()\n else:\n self.find_tag()\n self.slug = slugify(self.title)\n super().save()" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 169, "char_start": 107, "chars": "# uses bleach to remove potentially harmful HTML code\n " }, { "char_end": 205, "char_start": 188, "chars": "bleach.clean(str(" }, { "char_end": 359, "char_start": 232, "chars": "),\n tags=CE.settings.bleach_allowed,\n strip=True)" } ], "deleted": [] }, "commit_link": "github.com/stevetasticsteve/CLA_Hub/commit/a06d85cd0b0964f8469e5c4bc9a6c132aa0b4c37", "file_name": "CE/models.py", "func_name": "save", "line_changes": { "added": [ { "char_end": 235, "char_start": 161, "line": " self.description = bleach.clean(str(self.description_plain_text),\n", "line_no": 4 }, { "char_end": 308, "char_start": 235, "line": " tags=CE.settings.bleach_allowed,\n", "line_no": 5 }, { "char_end": 360, "char_start": 308, "line": " strip=True)\n", "line_no": 6 } ], "deleted": [ { "char_end": 154, "char_start": 99, "line": " self.description = self.description_plain_text\n", "line_no": 3 } ] }, "vul_type": "cwe-079" }
174
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def save(self):\n # copy the user's input from plain text to description to be processed", " # uses bleach to remove potentially harmful HTML code\n self.description = bleach.clean(str(self.description_plain_text),\n tags=CE.settings.bleach_allowed,\n strip=True)", " if CE.settings.auto_cross_reference:\n self.auto_cross_ref()\n else:\n self.find_tag()\n self.slug = slugify(self.title)\n super().save()" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 169, "char_start": 107, "chars": "# uses bleach to remove potentially harmful HTML code\n " }, { "char_end": 205, "char_start": 188, "chars": "bleach.clean(str(" }, { "char_end": 359, "char_start": 232, "chars": "),\n tags=CE.settings.bleach_allowed,\n strip=True)" } ], "deleted": [] }, "commit_link": "github.com/stevetasticsteve/CLA_Hub/commit/a06d85cd0b0964f8469e5c4bc9a6c132aa0b4c37", "file_name": "CE/models.py", "func_name": "save", "line_changes": { "added": [ { "char_end": 235, "char_start": 161, "line": " self.description = bleach.clean(str(self.description_plain_text),\n", "line_no": 4 }, { "char_end": 308, "char_start": 235, "line": " tags=CE.settings.bleach_allowed,\n", "line_no": 5 }, { "char_end": 360, "char_start": 308, "line": " strip=True)\n", "line_no": 6 } ], "deleted": [ { "char_end": 154, "char_start": 99, "line": " self.description = self.description_plain_text\n", "line_no": 3 } ] }, "vul_type": "cwe-079" }
174
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent)\n{\n clear();\n m_torrent = torrent;\n downloaded_pieces->setTorrent(m_torrent);\n pieces_availability->setTorrent(m_torrent);\n if (!m_torrent) return;", " // Save path\n updateSavePath(m_torrent);\n // Hash\n hash_lbl->setText(m_torrent->hash());\n PropListModel->model()->clear();\n if (m_torrent->hasMetadata()) {\n // Creation date\n lbl_creationDate->setText(m_torrent->creationDate().toString(Qt::DefaultLocaleShortDate));", " label_total_size_val->setText(Utils::Misc::friendlyUnit(m_torrent->totalSize()));", " // Comment", " comment_text->setText(Utils::Misc::parseHtmlLinks(m_torrent->comment()));", "\n // URL seeds\n loadUrlSeeds();\n", " label_created_by_val->setText(m_torrent->creator());", "\n // List files in torrent\n PropListModel->model()->setupModelData(m_torrent->info());\n filesList->setExpanded(PropListModel->index(0, 0), true);", " // Load file priorities\n PropListModel->model()->updateFilesPriorities(m_torrent->filePriorities());\n }\n // Load dynamic data\n loadDynamicData();\n}" ]
[ 1, 1, 1, 1, 0, 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 742, "char_start": 713, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 762, "char_start": 761, "chars": ")" }, { "char_end": 881, "char_start": 852, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 901, "char_start": 900, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16", "file_name": "src/gui/properties/propertieswidget.cpp", "func_name": "PropertiesWidget::loadTorrentInfos", "line_changes": { "added": [ { "char_end": 767, "char_start": 655, "line": " comment_text->setText(Utils::Misc::parseHtmlLinks(Utils::String::toHtmlEscaped(m_torrent->comment())));\n", "line_no": 21 }, { "char_end": 905, "char_start": 814, "line": " label_created_by_val->setText(Utils::String::toHtmlEscaped(m_torrent->creator()));\n", "line_no": 26 } ], "deleted": [ { "char_end": 737, "char_start": 655, "line": " comment_text->setText(Utils::Misc::parseHtmlLinks(m_torrent->comment()));\n", "line_no": 21 }, { "char_end": 845, "char_start": 784, "line": " label_created_by_val->setText(m_torrent->creator());\n", "line_no": 26 } ] }, "vul_type": "cwe-079" }
175
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent)\n{\n clear();\n m_torrent = torrent;\n downloaded_pieces->setTorrent(m_torrent);\n pieces_availability->setTorrent(m_torrent);\n if (!m_torrent) return;", " // Save path\n updateSavePath(m_torrent);\n // Hash\n hash_lbl->setText(m_torrent->hash());\n PropListModel->model()->clear();\n if (m_torrent->hasMetadata()) {\n // Creation date\n lbl_creationDate->setText(m_torrent->creationDate().toString(Qt::DefaultLocaleShortDate));", " label_total_size_val->setText(Utils::Misc::friendlyUnit(m_torrent->totalSize()));", " // Comment", " comment_text->setText(Utils::Misc::parseHtmlLinks(Utils::String::toHtmlEscaped(m_torrent->comment())));", "\n // URL seeds\n loadUrlSeeds();\n", " label_created_by_val->setText(Utils::String::toHtmlEscaped(m_torrent->creator()));", "\n // List files in torrent\n PropListModel->model()->setupModelData(m_torrent->info());\n filesList->setExpanded(PropListModel->index(0, 0), true);", " // Load file priorities\n PropListModel->model()->updateFilesPriorities(m_torrent->filePriorities());\n }\n // Load dynamic data\n loadDynamicData();\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 742, "char_start": 713, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 762, "char_start": 761, "chars": ")" }, { "char_end": 881, "char_start": 852, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 901, "char_start": 900, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16", "file_name": "src/gui/properties/propertieswidget.cpp", "func_name": "PropertiesWidget::loadTorrentInfos", "line_changes": { "added": [ { "char_end": 767, "char_start": 655, "line": " comment_text->setText(Utils::Misc::parseHtmlLinks(Utils::String::toHtmlEscaped(m_torrent->comment())));\n", "line_no": 21 }, { "char_end": 905, "char_start": 814, "line": " label_created_by_val->setText(Utils::String::toHtmlEscaped(m_torrent->creator()));\n", "line_no": 26 } ], "deleted": [ { "char_end": 737, "char_start": 655, "line": " comment_text->setText(Utils::Misc::parseHtmlLinks(m_torrent->comment()));\n", "line_no": 21 }, { "char_end": 845, "char_start": 784, "line": " label_created_by_val->setText(m_torrent->creator());\n", "line_no": 26 } ] }, "vul_type": "cwe-079" }
175
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_close(self, request):\n \"\"\"\n This is called by render_POST when the client is signalling\n that it is about to be closed.", " Args:\n request (Request): Incoming request.", " \"\"\"", " csessid = request.args.get('csessid')[0]", " try:\n sess = self.sessionhandler.sessions_from_csessid(csessid)[0]\n sess.sessionhandler.disconnect(sess)\n except IndexError:\n self.client_disconnect(csessid)\n return '\"\"'" ]
[ 1, 1, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 260, "char_start": 249, "chars": "cgi.escape(" }, { "char_end": 273, "char_start": 272, "chars": "[" }, { "char_end": 283, "char_start": 282, "chars": "]" }, { "char_end": 287, "char_start": 286, "chars": ")" } ], "deleted": [ { "char_end": 266, "char_start": 261, "chars": ".get(" }, { "char_end": 276, "char_start": 275, "chars": ")" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_close", "line_changes": { "added": [ { "char_end": 288, "char_start": 231, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 10 } ], "deleted": [ { "char_end": 280, "char_start": 231, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 10 } ] }, "vul_type": "cwe-079" }
176
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_close(self, request):\n \"\"\"\n This is called by render_POST when the client is signalling\n that it is about to be closed.", " Args:\n request (Request): Incoming request.", " \"\"\"", " csessid = cgi.escape(request.args['csessid'][0])", " try:\n sess = self.sessionhandler.sessions_from_csessid(csessid)[0]\n sess.sessionhandler.disconnect(sess)\n except IndexError:\n self.client_disconnect(csessid)\n return '\"\"'" ]
[ 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 260, "char_start": 249, "chars": "cgi.escape(" }, { "char_end": 273, "char_start": 272, "chars": "[" }, { "char_end": 283, "char_start": 282, "chars": "]" }, { "char_end": 287, "char_start": 286, "chars": ")" } ], "deleted": [ { "char_end": 266, "char_start": 261, "chars": ".get(" }, { "char_end": 276, "char_start": 275, "chars": ")" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_close", "line_changes": { "added": [ { "char_end": 288, "char_start": 231, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 10 } ], "deleted": [ { "char_end": 280, "char_start": 231, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 10 } ] }, "vul_type": "cwe-079" }
176
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def get_queryset(self, **kwargs):\n queryset = Article.objects.order_by('-time')\n for i in queryset:", " i.md = markdown(i.content, extensions=[\n 'markdown.extensions.extra',\n 'markdown.extensions.codehilite',\n 'markdown.extensions.toc',\n ])", "\n return queryset" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 140, "char_start": 139, "chars": "f" }, { "char_end": 142, "char_start": 141, "chars": "_" }, { "char_end": 145, "char_start": 144, "chars": "(" } ], "deleted": [ { "char_end": 162, "char_start": 137, "chars": "markdown(i.content, exten" }, { "char_end": 188, "char_start": 163, "chars": "ions=[\n 'm" }, { "char_end": 196, "char_start": 189, "chars": "rkdown." }, { "char_end": 232, "char_start": 197, "chars": "xtensions.extra',\n '" }, { "char_end": 236, "char_start": 233, "chars": "ark" }, { "char_end": 247, "char_start": 237, "chars": "own.extens" }, { "char_end": 251, "char_start": 248, "chars": "ons" }, { "char_end": 289, "char_start": 254, "chars": "dehilite',\n 'markdow" }, { "char_end": 293, "char_start": 290, "chars": ".ex" }, { "char_end": 302, "char_start": 296, "chars": "sions." }, { "char_end": 321, "char_start": 303, "chars": "oc',\n ]" } ] }, "commit_link": "github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c", "file_name": "app/Index/views.py", "func_name": "get_queryset", "line_changes": { "added": [ { "char_end": 156, "char_start": 118, "line": " i.md = safe_md(i.content)\n", "line_no": 4 } ], "deleted": [ { "char_end": 170, "char_start": 118, "line": " i.md = markdown(i.content, extensions=[\n", "line_no": 4 }, { "char_end": 215, "char_start": 170, "line": " 'markdown.extensions.extra',\n", "line_no": 5 }, { "char_end": 265, "char_start": 215, "line": " 'markdown.extensions.codehilite',\n", "line_no": 6 }, { "char_end": 308, "char_start": 265, "line": " 'markdown.extensions.toc',\n", "line_no": 7 }, { "char_end": 323, "char_start": 308, "line": " ])\n", "line_no": 8 } ] }, "vul_type": "cwe-079" }
177
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def get_queryset(self, **kwargs):\n queryset = Article.objects.order_by('-time')\n for i in queryset:", " i.md = safe_md(i.content)", "\n return queryset" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 140, "char_start": 139, "chars": "f" }, { "char_end": 142, "char_start": 141, "chars": "_" }, { "char_end": 145, "char_start": 144, "chars": "(" } ], "deleted": [ { "char_end": 162, "char_start": 137, "chars": "markdown(i.content, exten" }, { "char_end": 188, "char_start": 163, "chars": "ions=[\n 'm" }, { "char_end": 196, "char_start": 189, "chars": "rkdown." }, { "char_end": 232, "char_start": 197, "chars": "xtensions.extra',\n '" }, { "char_end": 236, "char_start": 233, "chars": "ark" }, { "char_end": 247, "char_start": 237, "chars": "own.extens" }, { "char_end": 251, "char_start": 248, "chars": "ons" }, { "char_end": 289, "char_start": 254, "chars": "dehilite',\n 'markdow" }, { "char_end": 293, "char_start": 290, "chars": ".ex" }, { "char_end": 302, "char_start": 296, "chars": "sions." }, { "char_end": 321, "char_start": 303, "chars": "oc',\n ]" } ] }, "commit_link": "github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c", "file_name": "app/Index/views.py", "func_name": "get_queryset", "line_changes": { "added": [ { "char_end": 156, "char_start": 118, "line": " i.md = safe_md(i.content)\n", "line_no": 4 } ], "deleted": [ { "char_end": 170, "char_start": 118, "line": " i.md = markdown(i.content, extensions=[\n", "line_no": 4 }, { "char_end": 215, "char_start": 170, "line": " 'markdown.extensions.extra',\n", "line_no": 5 }, { "char_end": 265, "char_start": 215, "line": " 'markdown.extensions.codehilite',\n", "line_no": 6 }, { "char_end": 308, "char_start": 265, "line": " 'markdown.extensions.toc',\n", "line_no": 7 }, { "char_end": 323, "char_start": 308, "line": " ])\n", "line_no": 8 } ] }, "vul_type": "cwe-079" }
177
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@register.tag\n@basictag(takes_context=True)\ndef screenshotcommentcounts(context, screenshot):\n \"\"\"\n Returns a JSON array of current comments for a screenshot.", " Each entry in the array has a dictionary containing the following keys:", " =========== ==================================================\n Key Description\n =========== ==================================================\n text The text of the comment\n localdraft True if this is the current user's draft comment\n x The X location of the comment's region\n y The Y location of the comment's region\n w The width of the comment's region\n h The height of the comment's region\n =========== ==================================================\n \"\"\"\n comments = {}\n user = context.get('user', None)", " for comment in screenshot.comments.all():\n review = get_object_or_none(comment.review)", " if review and (review.public or review.user == user):\n position = '%dx%d+%d+%d' % (comment.w, comment.h, \\\n comment.x, comment.y)", " comments.setdefault(position, []).append({\n 'id': comment.id,", " 'text': comment.text,", " 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n 'url': comment.get_review_url(),\n 'localdraft' : review.user == user and \\\n not review.public,\n 'x' : comment.x,\n 'y' : comment.y,\n 'w' : comment.w,\n 'h' : comment.h,\n })", " return simplejson.dumps(comments)" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1280, "char_start": 1273, "chars": "escape(" }, { "char_end": 1293, "char_start": 1292, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d", "file_name": "reviewboard/reviews/templatetags/reviewtags.py", "func_name": "screenshotcommentcounts", "line_changes": { "added": [ { "char_end": 1295, "char_start": 1249, "line": " 'text': escape(comment.text),\n", "line_no": 32 } ], "deleted": [ { "char_end": 1287, "char_start": 1249, "line": " 'text': comment.text,\n", "line_no": 32 } ] }, "vul_type": "cwe-079" }
178
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@register.tag\n@basictag(takes_context=True)\ndef screenshotcommentcounts(context, screenshot):\n \"\"\"\n Returns a JSON array of current comments for a screenshot.", " Each entry in the array has a dictionary containing the following keys:", " =========== ==================================================\n Key Description\n =========== ==================================================\n text The text of the comment\n localdraft True if this is the current user's draft comment\n x The X location of the comment's region\n y The Y location of the comment's region\n w The width of the comment's region\n h The height of the comment's region\n =========== ==================================================\n \"\"\"\n comments = {}\n user = context.get('user', None)", " for comment in screenshot.comments.all():\n review = get_object_or_none(comment.review)", " if review and (review.public or review.user == user):\n position = '%dx%d+%d+%d' % (comment.w, comment.h, \\\n comment.x, comment.y)", " comments.setdefault(position, []).append({\n 'id': comment.id,", " 'text': escape(comment.text),", " 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n 'url': comment.get_review_url(),\n 'localdraft' : review.user == user and \\\n not review.public,\n 'x' : comment.x,\n 'y' : comment.y,\n 'w' : comment.w,\n 'h' : comment.h,\n })", " return simplejson.dumps(comments)" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1280, "char_start": 1273, "chars": "escape(" }, { "char_end": 1293, "char_start": 1292, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d", "file_name": "reviewboard/reviews/templatetags/reviewtags.py", "func_name": "screenshotcommentcounts", "line_changes": { "added": [ { "char_end": 1295, "char_start": 1249, "line": " 'text': escape(comment.text),\n", "line_no": 32 } ], "deleted": [ { "char_end": 1287, "char_start": 1249, "line": " 'text': comment.text,\n", "line_no": 32 } ] }, "vul_type": "cwe-079" }
178
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_input(self, request):\n \"\"\"\n This is called by render_POST when the client\n is sending data to the server.", " Args:\n request (Request): Incoming request.", " \"\"\"", " csessid = request.args.get('csessid')[0]\n", " self.last_alive[csessid] = (time.time(), False)\n sess = self.sessionhandler.sessions_from_csessid(csessid)\n if sess:\n sess = sess[0]", " cmdarray = json.loads(request.args.get('data')[0])", " sess.sessionhandler.data_in(sess, **{cmdarray[0]: [cmdarray[1], cmdarray[2]]})\n return '\"\"'" ]
[ 1, 1, 1, 0, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 246, "char_start": 235, "chars": "cgi.escape(" }, { "char_end": 259, "char_start": 258, "chars": "[" }, { "char_end": 269, "char_start": 268, "chars": "]" }, { "char_end": 273, "char_start": 272, "chars": ")" }, { "char_end": 485, "char_start": 474, "chars": "cgi.escape(" }, { "char_end": 513, "char_start": 512, "chars": ")" } ], "deleted": [ { "char_end": 252, "char_start": 247, "chars": ".get(" }, { "char_end": 262, "char_start": 261, "chars": ")" }, { "char_end": 266, "char_start": 265, "chars": "\n" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_input", "line_changes": { "added": [ { "char_end": 274, "char_start": 217, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 10 }, { "char_end": 515, "char_start": 440, "line": " cmdarray = json.loads(cgi.escape(request.args.get('data')[0]))\n", "line_no": 15 } ], "deleted": [ { "char_end": 266, "char_start": 217, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 10 }, { "char_end": 267, "char_start": 266, "line": "\n", "line_no": 11 }, { "char_end": 496, "char_start": 433, "line": " cmdarray = json.loads(request.args.get('data')[0])\n", "line_no": 16 } ] }, "vul_type": "cwe-079" }
179
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_input(self, request):\n \"\"\"\n This is called by render_POST when the client\n is sending data to the server.", " Args:\n request (Request): Incoming request.", " \"\"\"", " csessid = cgi.escape(request.args['csessid'][0])", " self.last_alive[csessid] = (time.time(), False)\n sess = self.sessionhandler.sessions_from_csessid(csessid)\n if sess:\n sess = sess[0]", " cmdarray = json.loads(cgi.escape(request.args.get('data')[0]))", " sess.sessionhandler.data_in(sess, **{cmdarray[0]: [cmdarray[1], cmdarray[2]]})\n return '\"\"'" ]
[ 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 246, "char_start": 235, "chars": "cgi.escape(" }, { "char_end": 259, "char_start": 258, "chars": "[" }, { "char_end": 269, "char_start": 268, "chars": "]" }, { "char_end": 273, "char_start": 272, "chars": ")" }, { "char_end": 485, "char_start": 474, "chars": "cgi.escape(" }, { "char_end": 513, "char_start": 512, "chars": ")" } ], "deleted": [ { "char_end": 252, "char_start": 247, "chars": ".get(" }, { "char_end": 262, "char_start": 261, "chars": ")" }, { "char_end": 266, "char_start": 265, "chars": "\n" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_input", "line_changes": { "added": [ { "char_end": 274, "char_start": 217, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 10 }, { "char_end": 515, "char_start": 440, "line": " cmdarray = json.loads(cgi.escape(request.args.get('data')[0]))\n", "line_no": 15 } ], "deleted": [ { "char_end": 266, "char_start": 217, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 10 }, { "char_end": 267, "char_start": 266, "line": "\n", "line_no": 11 }, { "char_end": 496, "char_start": 433, "line": " cmdarray = json.loads(request.args.get('data')[0])\n", "line_no": 16 } ] }, "vul_type": "cwe-079" }
179
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def get_list_context(context=None):\n\tlist_context = frappe._dict(\n\t\ttemplate = \"templates/includes/blog/blog.html\",\n\t\tget_list = get_blog_list,\n\t\thide_filters = True,\n\t\tchildren = get_children(),\n\t\t# show_search = True,\n\t\ttitle = _('Blog')\n\t)\n", "\tcategory = frappe.local.form_dict.blog_category or frappe.local.form_dict.category", "\tif category:\n\t\tcategory_title = get_blog_category(category)\n\t\tlist_context.sub_title = _(\"Posts filed under {0}\").format(category_title)\n\t\tlist_context.title = category_title", "\telif frappe.local.form_dict.blogger:\n\t\tblogger = frappe.db.get_value(\"Blogger\", {\"name\": frappe.local.form_dict.blogger}, \"full_name\")\n\t\tlist_context.sub_title = _(\"Posts by {0}\").format(blogger)\n\t\tlist_context.title = blogger", "\telif frappe.local.form_dict.txt:", "\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(frappe.local.form_dict.txt)", "\n\tif list_context.sub_title:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"},\n\t\t\t\t\t\t\t\t{\"name\": \"Blog\", \"route\": \"/blog\"}]\n\telse:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"}]", "\tlist_context.update(frappe.get_doc(\"Blog Settings\", \"Blog Settings\").as_dict(no_default_fields=True))\n\treturn list_context" ]
[ 1, 0, 1, 1, 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 270, "char_start": 256, "chars": "sanitize_html(" }, { "char_end": 342, "char_start": 341, "chars": ")" }, { "char_end": 854, "char_start": 840, "chars": "sanitize_html(" }, { "char_end": 881, "char_start": 880, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/omirajkar/bench_frappe/commit/2fa19c25066ed17478d683666895e3266936aee6", "file_name": "frappe/website/doctype/blog_post/blog_post.py", "func_name": "get_list_context", "line_changes": { "added": [ { "char_end": 343, "char_start": 244, "line": "\tcategory = sanitize_html(frappe.local.form_dict.blog_category or frappe.local.form_dict.category)\n", "line_no": 11 }, { "char_end": 883, "char_start": 783, "line": "\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(sanitize_html(frappe.local.form_dict.txt))\n", "line_no": 23 } ], "deleted": [ { "char_end": 328, "char_start": 244, "line": "\tcategory = frappe.local.form_dict.blog_category or frappe.local.form_dict.category\n", "line_no": 11 }, { "char_end": 853, "char_start": 768, "line": "\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(frappe.local.form_dict.txt)\n", "line_no": 23 } ] }, "vul_type": "cwe-079" }
180
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def get_list_context(context=None):\n\tlist_context = frappe._dict(\n\t\ttemplate = \"templates/includes/blog/blog.html\",\n\t\tget_list = get_blog_list,\n\t\thide_filters = True,\n\t\tchildren = get_children(),\n\t\t# show_search = True,\n\t\ttitle = _('Blog')\n\t)\n", "\tcategory = sanitize_html(frappe.local.form_dict.blog_category or frappe.local.form_dict.category)", "\tif category:\n\t\tcategory_title = get_blog_category(category)\n\t\tlist_context.sub_title = _(\"Posts filed under {0}\").format(category_title)\n\t\tlist_context.title = category_title", "\telif frappe.local.form_dict.blogger:\n\t\tblogger = frappe.db.get_value(\"Blogger\", {\"name\": frappe.local.form_dict.blogger}, \"full_name\")\n\t\tlist_context.sub_title = _(\"Posts by {0}\").format(blogger)\n\t\tlist_context.title = blogger", "\telif frappe.local.form_dict.txt:", "\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(sanitize_html(frappe.local.form_dict.txt))", "\n\tif list_context.sub_title:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"},\n\t\t\t\t\t\t\t\t{\"name\": \"Blog\", \"route\": \"/blog\"}]\n\telse:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"}]", "\tlist_context.update(frappe.get_doc(\"Blog Settings\", \"Blog Settings\").as_dict(no_default_fields=True))\n\treturn list_context" ]
[ 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 270, "char_start": 256, "chars": "sanitize_html(" }, { "char_end": 342, "char_start": 341, "chars": ")" }, { "char_end": 854, "char_start": 840, "chars": "sanitize_html(" }, { "char_end": 881, "char_start": 880, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/omirajkar/bench_frappe/commit/2fa19c25066ed17478d683666895e3266936aee6", "file_name": "frappe/website/doctype/blog_post/blog_post.py", "func_name": "get_list_context", "line_changes": { "added": [ { "char_end": 343, "char_start": 244, "line": "\tcategory = sanitize_html(frappe.local.form_dict.blog_category or frappe.local.form_dict.category)\n", "line_no": 11 }, { "char_end": 883, "char_start": 783, "line": "\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(sanitize_html(frappe.local.form_dict.txt))\n", "line_no": 23 } ], "deleted": [ { "char_end": 328, "char_start": 244, "line": "\tcategory = frappe.local.form_dict.blog_category or frappe.local.form_dict.category\n", "line_no": 11 }, { "char_end": 853, "char_start": 768, "line": "\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(frappe.local.form_dict.txt)\n", "line_no": 23 } ] }, "vul_type": "cwe-079" }
180
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_init(self, request):\n \"\"\"\n This is called by render_POST when the client requests an init\n mode operation (at startup)", " Args:\n request (Request): Incoming request.", " \"\"\"", " csessid = request.args.get('csessid')[0]", "\n remote_addr = request.getClientIP()\n host_string = \"%s (%s:%s)\" % (_SERVERNAME, request.getRequestHostname(), request.getHost().port)", " sess = AjaxWebClientSession()\n sess.client = self\n sess.init_session(\"ajax/comet\", remote_addr, self.sessionhandler)", " sess.csessid = csessid\n csession = _CLIENT_SESSIONS(session_key=sess.csessid)\n uid = csession and csession.get(\"webclient_authenticated_uid\", False)\n if uid:\n # the client session is already logged in\n sess.uid = uid\n sess.logged_in = True", " sess.sessionhandler.connect(sess)", " self.last_alive[csessid] = (time.time(), False)\n if not self.keep_alive:\n # the keepalive is not running; start it.\n self.keep_alive = LoopingCall(self._keepalive)\n self.keep_alive.start(_KEEPALIVE, now=False)", " return jsonify({'msg': host_string, 'csessid': csessid})" ]
[ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 259, "char_start": 248, "chars": "cgi.escape(" }, { "char_end": 272, "char_start": 271, "chars": "[" }, { "char_end": 282, "char_start": 281, "chars": "]" }, { "char_end": 286, "char_start": 285, "chars": ")" } ], "deleted": [ { "char_end": 265, "char_start": 260, "chars": ".get(" }, { "char_end": 275, "char_start": 274, "chars": ")" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_init", "line_changes": { "added": [ { "char_end": 287, "char_start": 230, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 10 } ], "deleted": [ { "char_end": 279, "char_start": 230, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 10 } ] }, "vul_type": "cwe-079" }
181
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def mode_init(self, request):\n \"\"\"\n This is called by render_POST when the client requests an init\n mode operation (at startup)", " Args:\n request (Request): Incoming request.", " \"\"\"", " csessid = cgi.escape(request.args['csessid'][0])", "\n remote_addr = request.getClientIP()\n host_string = \"%s (%s:%s)\" % (_SERVERNAME, request.getRequestHostname(), request.getHost().port)", " sess = AjaxWebClientSession()\n sess.client = self\n sess.init_session(\"ajax/comet\", remote_addr, self.sessionhandler)", " sess.csessid = csessid\n csession = _CLIENT_SESSIONS(session_key=sess.csessid)\n uid = csession and csession.get(\"webclient_authenticated_uid\", False)\n if uid:\n # the client session is already logged in\n sess.uid = uid\n sess.logged_in = True", " sess.sessionhandler.connect(sess)", " self.last_alive[csessid] = (time.time(), False)\n if not self.keep_alive:\n # the keepalive is not running; start it.\n self.keep_alive = LoopingCall(self._keepalive)\n self.keep_alive.start(_KEEPALIVE, now=False)", " return jsonify({'msg': host_string, 'csessid': csessid})" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 259, "char_start": 248, "chars": "cgi.escape(" }, { "char_end": 272, "char_start": 271, "chars": "[" }, { "char_end": 282, "char_start": 281, "chars": "]" }, { "char_end": 286, "char_start": 285, "chars": ")" } ], "deleted": [ { "char_end": 265, "char_start": 260, "chars": ".get(" }, { "char_end": 275, "char_start": 274, "chars": ")" } ] }, "commit_link": "github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93", "file_name": "evennia/server/portal/webclient_ajax.py", "func_name": "mode_init", "line_changes": { "added": [ { "char_end": 287, "char_start": 230, "line": " csessid = cgi.escape(request.args['csessid'][0])\n", "line_no": 10 } ], "deleted": [ { "char_end": 279, "char_start": 230, "line": " csessid = request.args.get('csessid')[0]\n", "line_no": 10 } ] }, "vul_type": "cwe-079" }
181
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def handle_file(u: Profile, headline: str, category: str, text: str, file):\n m: Media = Media()\n upload_base_path: str = 'uploads/' + str(date.today().year)\n high_res_file_name = upload_base_path + '/HIGHRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n low_res_file_name = upload_base_path + '/LOWRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n if not os.path.exists(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path):\n os.makedirs(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path)\n with open(high_res_file_name, 'wb+') as destination:\n for chunk in file.chunks():\n destination.write(chunk)\n # TODO crop image\n original = Image.open(high_res_file_name)\n width, height = original.size\n diameter = math.sqrt(math.pow(width, 2) + math.pow(height, 2))\n width /= diameter\n height /= diameter\n width *= IMAGE_SCALE\n height *= IMAGE_SCALE\n cropped = original.resize((int(width), int(height)), PIL.Image.LANCZOS)\n cropped.save(low_res_file_name)", " m.text = text\n m.cachedText = compile_markdown(text)\n m.category = category", " m.highResFile = \"/\" + high_res_file_name\n m.lowResFile = \"/\" + low_res_file_name", " m.headline = headline", " m.save()\n mu: MediaUpload = MediaUpload()\n mu.UID = u\n mu.MID = m\n mu.save()\n logging.info(\"Uploaded file '\" + str(file.name) + \"' and cropped it. The resulting PK is \" + str(m.pk))" ]
[ 1, 0, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1041, "char_start": 1034, "chars": "escape(" }, { "char_end": 1046, "char_start": 1045, "chars": ")" }, { "char_end": 1090, "char_start": 1083, "chars": "escape(" }, { "char_end": 1095, "char_start": 1094, "chars": ")" }, { "char_end": 1121, "char_start": 1114, "chars": "escape(" }, { "char_end": 1130, "char_start": 1129, "chars": ")" }, { "char_end": 1243, "char_start": 1236, "chars": "escape(" }, { "char_end": 1252, "char_start": 1251, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600", "file_name": "c3shop/frontpage/management/mediatools/media_actions.py", "func_name": "handle_file", "line_changes": { "added": [ { "char_end": 1047, "char_start": 1021, "line": " m.text = escape(text)\n", "line_no": 21 }, { "char_end": 1097, "char_start": 1047, "line": " m.cachedText = compile_markdown(escape(text))\n", "line_no": 22 }, { "char_end": 1131, "char_start": 1097, "line": " m.category = escape(category)\n", "line_no": 23 }, { "char_end": 1253, "char_start": 1219, "line": " m.headline = escape(headline)\n", "line_no": 26 } ], "deleted": [ { "char_end": 1039, "char_start": 1021, "line": " m.text = text\n", "line_no": 21 }, { "char_end": 1081, "char_start": 1039, "line": " m.cachedText = compile_markdown(text)\n", "line_no": 22 }, { "char_end": 1107, "char_start": 1081, "line": " m.category = category\n", "line_no": 23 }, { "char_end": 1221, "char_start": 1195, "line": " m.headline = headline\n", "line_no": 26 } ] }, "vul_type": "cwe-079" }
182
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def handle_file(u: Profile, headline: str, category: str, text: str, file):\n m: Media = Media()\n upload_base_path: str = 'uploads/' + str(date.today().year)\n high_res_file_name = upload_base_path + '/HIGHRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n low_res_file_name = upload_base_path + '/LOWRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n if not os.path.exists(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path):\n os.makedirs(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path)\n with open(high_res_file_name, 'wb+') as destination:\n for chunk in file.chunks():\n destination.write(chunk)\n # TODO crop image\n original = Image.open(high_res_file_name)\n width, height = original.size\n diameter = math.sqrt(math.pow(width, 2) + math.pow(height, 2))\n width /= diameter\n height /= diameter\n width *= IMAGE_SCALE\n height *= IMAGE_SCALE\n cropped = original.resize((int(width), int(height)), PIL.Image.LANCZOS)\n cropped.save(low_res_file_name)", " m.text = escape(text)\n m.cachedText = compile_markdown(escape(text))\n m.category = escape(category)", " m.highResFile = \"/\" + high_res_file_name\n m.lowResFile = \"/\" + low_res_file_name", " m.headline = escape(headline)", " m.save()\n mu: MediaUpload = MediaUpload()\n mu.UID = u\n mu.MID = m\n mu.save()\n logging.info(\"Uploaded file '\" + str(file.name) + \"' and cropped it. The resulting PK is \" + str(m.pk))" ]
[ 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1041, "char_start": 1034, "chars": "escape(" }, { "char_end": 1046, "char_start": 1045, "chars": ")" }, { "char_end": 1090, "char_start": 1083, "chars": "escape(" }, { "char_end": 1095, "char_start": 1094, "chars": ")" }, { "char_end": 1121, "char_start": 1114, "chars": "escape(" }, { "char_end": 1130, "char_start": 1129, "chars": ")" }, { "char_end": 1243, "char_start": 1236, "chars": "escape(" }, { "char_end": 1252, "char_start": 1251, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600", "file_name": "c3shop/frontpage/management/mediatools/media_actions.py", "func_name": "handle_file", "line_changes": { "added": [ { "char_end": 1047, "char_start": 1021, "line": " m.text = escape(text)\n", "line_no": 21 }, { "char_end": 1097, "char_start": 1047, "line": " m.cachedText = compile_markdown(escape(text))\n", "line_no": 22 }, { "char_end": 1131, "char_start": 1097, "line": " m.category = escape(category)\n", "line_no": 23 }, { "char_end": 1253, "char_start": 1219, "line": " m.headline = escape(headline)\n", "line_no": 26 } ], "deleted": [ { "char_end": 1039, "char_start": 1021, "line": " m.text = text\n", "line_no": 21 }, { "char_end": 1081, "char_start": 1039, "line": " m.cachedText = compile_markdown(text)\n", "line_no": 22 }, { "char_end": 1107, "char_start": 1081, "line": " m.category = category\n", "line_no": 23 }, { "char_end": 1221, "char_start": 1195, "line": " m.headline = headline\n", "line_no": 26 } ] }, "vul_type": "cwe-079" }
182
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@register.tag\n@basictag(takes_context=True)\ndef commentcounts(context, filediff, interfilediff=None):\n \"\"\"\n Returns a JSON array of current comments for a filediff, sorted by\n line number.", " Each entry in the array has a dictionary containing the following keys:", " =========== ==================================================\n Key Description\n =========== ==================================================\n comment_id The ID of the comment\n text The text of the comment\n line The first line number\n num_lines The number of lines this comment spans\n user A dictionary containing \"username\" and \"name\" keys\n for the user\n url The URL to the comment\n localdraft True if this is the current user's draft comment\n =========== ==================================================\n \"\"\"\n comment_dict = {}\n user = context.get('user', None)", " if interfilediff:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff=interfilediff)\n else:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff__isnull=True)", " for comment in query:\n review = get_object_or_none(comment.review)", " if review and (review.public or review.user == user):\n key = (comment.first_line, comment.num_lines)", " comment_dict.setdefault(key, []).append({\n 'comment_id': comment.id,", " 'text': comment.text,", " 'line': comment.first_line,\n 'num_lines': comment.num_lines,\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n #'timestamp': comment.timestamp,\n 'url': comment.get_review_url(),\n 'localdraft': review.user == user and \\\n not review.public,\n })", " comments_array = []", " for key, value in comment_dict.iteritems():\n comments_array.append({\n 'linenum': key[0],\n 'num_lines': key[1],\n 'comments': value,\n })", " comments_array.sort(cmp=lambda x, y: cmp(x['linenum'], y['linenum'] or\n cmp(x['num_lines'], y['num_lines'])))", " return simplejson.dumps(comments_array)" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1579, "char_start": 1572, "chars": "escape(" }, { "char_end": 1592, "char_start": 1591, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d", "file_name": "reviewboard/reviews/templatetags/reviewtags.py", "func_name": "commentcounts", "line_changes": { "added": [ { "char_end": 1594, "char_start": 1548, "line": " 'text': escape(comment.text),\n", "line_no": 41 } ], "deleted": [ { "char_end": 1586, "char_start": 1548, "line": " 'text': comment.text,\n", "line_no": 41 } ] }, "vul_type": "cwe-079" }
183
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@register.tag\n@basictag(takes_context=True)\ndef commentcounts(context, filediff, interfilediff=None):\n \"\"\"\n Returns a JSON array of current comments for a filediff, sorted by\n line number.", " Each entry in the array has a dictionary containing the following keys:", " =========== ==================================================\n Key Description\n =========== ==================================================\n comment_id The ID of the comment\n text The text of the comment\n line The first line number\n num_lines The number of lines this comment spans\n user A dictionary containing \"username\" and \"name\" keys\n for the user\n url The URL to the comment\n localdraft True if this is the current user's draft comment\n =========== ==================================================\n \"\"\"\n comment_dict = {}\n user = context.get('user', None)", " if interfilediff:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff=interfilediff)\n else:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff__isnull=True)", " for comment in query:\n review = get_object_or_none(comment.review)", " if review and (review.public or review.user == user):\n key = (comment.first_line, comment.num_lines)", " comment_dict.setdefault(key, []).append({\n 'comment_id': comment.id,", " 'text': escape(comment.text),", " 'line': comment.first_line,\n 'num_lines': comment.num_lines,\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n #'timestamp': comment.timestamp,\n 'url': comment.get_review_url(),\n 'localdraft': review.user == user and \\\n not review.public,\n })", " comments_array = []", " for key, value in comment_dict.iteritems():\n comments_array.append({\n 'linenum': key[0],\n 'num_lines': key[1],\n 'comments': value,\n })", " comments_array.sort(cmp=lambda x, y: cmp(x['linenum'], y['linenum'] or\n cmp(x['num_lines'], y['num_lines'])))", " return simplejson.dumps(comments_array)" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 1579, "char_start": 1572, "chars": "escape(" }, { "char_end": 1592, "char_start": 1591, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d", "file_name": "reviewboard/reviews/templatetags/reviewtags.py", "func_name": "commentcounts", "line_changes": { "added": [ { "char_end": 1594, "char_start": 1548, "line": " 'text': escape(comment.text),\n", "line_no": 41 } ], "deleted": [ { "char_end": 1586, "char_start": 1548, "line": " 'text': comment.text,\n", "line_no": 41 } ] }, "vul_type": "cwe-079" }
183
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c,\n\t\toidc_session_t *session, const char *client_id,\n\t\tconst char *check_session_iframe) {", "\toidc_debug(r, \"enter\");", "\tconst char *java_script =\n\t\t\t\" <script type=\\\"text/javascript\\\">\\n\"\n\t\t\t\" var targetOrigin = '%s';\\n\"\n\t\t\t\" var message = '%s' + ' ' + '%s';\\n\"\n\t\t\t\"\t var timerID;\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" function checkSession() {\\n\"\n\t\t\t\" console.debug('checkSession: posting ' + message + ' to ' + targetOrigin);\\n\"\n\t\t\t\" var win = window.parent.document.getElementById('%s').contentWindow;\\n\"\n\t\t\t\" win.postMessage( message, targetOrigin);\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" function setTimer() {\\n\"\n\t\t\t\" checkSession();\\n\"", "\t\t\t\" timerID = setInterval('checkSession()', %s);\\n\"", "\t\t\t\" }\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" function receiveMessage(e) {\\n\"\n\t\t\t\" console.debug('receiveMessage: ' + e.data + ' from ' + e.origin);\\n\"\n\t\t\t\" if (e.origin !== targetOrigin ) {\\n\"\n\t\t\t\" console.debug('receiveMessage: cross-site scripting attack?');\\n\"\n\t\t\t\" return;\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\" if (e.data != 'unchanged') {\\n\"\n\t\t\t\" clearInterval(timerID);\\n\"\n\t\t\t\" if (e.data == 'changed') {\\n\"\n\t\t\t\"\t\t window.location.href = '%s?session=check';\\n\"\n\t\t\t\" } else {\\n\"\n\t\t\t\"\t\t window.location.href = '%s?session=logout';\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" window.addEventListener('message', receiveMessage, false);\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" </script>\\n\";", "\t/* determine the origin for the check_session_iframe endpoint */\n\tchar *origin = apr_pstrdup(r->pool, check_session_iframe);\n\tapr_uri_t uri;\n\tapr_uri_parse(r->pool, check_session_iframe, &uri);\n\tchar *p = strstr(origin, uri.path);\n\t*p = '\\0';", "\t/* the element identifier for the OP iframe */\n\tconst char *op_iframe_id = \"openidc-op\";", "\t/* restore the OP session_state from the session */\n\tconst char *session_state = oidc_session_get_session_state(r, session);\n\tif (session_state == NULL) {\n\t\toidc_warn(r,\n\t\t\t\t\"no session_state found in the session; the OP does probably not support session management!?\");\n\t\treturn DONE;\n\t}", "\tchar *s_poll_interval = NULL;\n\toidc_util_get_request_parameter(r, \"poll\", &s_poll_interval);", "\tif (s_poll_interval == NULL)\n\t\ts_poll_interval = \"3000\";", "\n\tconst char *redirect_uri = oidc_get_redirect_uri(r, c);\n\tjava_script = apr_psprintf(r->pool, java_script, origin, client_id,", "\t\t\tsession_state, op_iframe_id, s_poll_interval, redirect_uri,", "\t\t\tredirect_uri);", "\treturn oidc_util_html_send(r, NULL, java_script, \"setTimer\", NULL, DONE);\n}" ]
[ 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 797, "char_start": 796, "chars": "d" }, { "char_end": 2291, "char_start": 2275, "chars": "nt poll_interval" }, { "char_end": 2294, "char_start": 2292, "chars": "= " }, { "char_end": 2335, "char_start": 2310, "chars": "? strtol(s_poll_interval," }, { "char_end": 2344, "char_start": 2340, "chars": ", 10" }, { "char_end": 2350, "char_start": 2345, "chars": " : 0;" }, { "char_end": 2361, "char_start": 2352, "chars": "if ((poll" }, { "char_end": 2411, "char_start": 2362, "chars": "interval <= 0) || (poll_interval > 3600 * 24))\n\t\t" } ], "deleted": [ { "char_end": 797, "char_start": 796, "chars": "s" }, { "char_end": 2276, "char_start": 2275, "chars": "f" }, { "char_end": 2296, "char_start": 2293, "chars": " ==" }, { "char_end": 2306, "char_start": 2304, "chars": "\ts" }, { "char_end": 2324, "char_start": 2323, "chars": "\"" }, { "char_end": 2329, "char_start": 2328, "chars": "\"" }, { "char_end": 2492, "char_start": 2490, "chars": "s_" } ] }, "commit_link": "github.com/zmartzone/mod_auth_openidc/commit/132a4111bf3791e76437619a66336dce2ce4c79b", "file_name": "src/mod_auth_openidc.c", "func_name": "oidc_handle_session_management_iframe_rp", "line_changes": { "added": [ { "char_end": 803, "char_start": 743, "line": "\t\t\t\" timerID = setInterval('checkSession()', %d);\\n\"\n", "line_no": 21 }, { "char_end": 2351, "char_start": 2273, "line": "\tint poll_interval = s_poll_interval ? strtol(s_poll_interval, NULL, 10) : 0;\n", "line_no": 64 }, { "char_end": 2409, "char_start": 2351, "line": "\tif ((poll_interval <= 0) || (poll_interval > 3600 * 24))\n", "line_no": 65 }, { "char_end": 2433, "char_start": 2409, "line": "\t\tpoll_interval = 3000;\n", "line_no": 66 }, { "char_end": 2621, "char_start": 2560, "line": "\t\t\tsession_state, op_iframe_id, poll_interval, redirect_uri,\n", "line_no": 70 } ], "deleted": [ { "char_end": 803, "char_start": 743, "line": "\t\t\t\" timerID = setInterval('checkSession()', %s);\\n\"\n", "line_no": 21 }, { "char_end": 2303, "char_start": 2273, "line": "\tif (s_poll_interval == NULL)\n", "line_no": 64 }, { "char_end": 2331, "char_start": 2303, "line": "\t\ts_poll_interval = \"3000\";\n", "line_no": 65 }, { "char_end": 2521, "char_start": 2458, "line": "\t\t\tsession_state, op_iframe_id, s_poll_interval, redirect_uri,\n", "line_no": 69 } ] }, "vul_type": "cwe-079" }
184
cwe-079
c
Determine whether the {function_name} code is vulnerable or not.
[ "static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c,\n\t\toidc_session_t *session, const char *client_id,\n\t\tconst char *check_session_iframe) {", "\toidc_debug(r, \"enter\");", "\tconst char *java_script =\n\t\t\t\" <script type=\\\"text/javascript\\\">\\n\"\n\t\t\t\" var targetOrigin = '%s';\\n\"\n\t\t\t\" var message = '%s' + ' ' + '%s';\\n\"\n\t\t\t\"\t var timerID;\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" function checkSession() {\\n\"\n\t\t\t\" console.debug('checkSession: posting ' + message + ' to ' + targetOrigin);\\n\"\n\t\t\t\" var win = window.parent.document.getElementById('%s').contentWindow;\\n\"\n\t\t\t\" win.postMessage( message, targetOrigin);\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" function setTimer() {\\n\"\n\t\t\t\" checkSession();\\n\"", "\t\t\t\" timerID = setInterval('checkSession()', %d);\\n\"", "\t\t\t\" }\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" function receiveMessage(e) {\\n\"\n\t\t\t\" console.debug('receiveMessage: ' + e.data + ' from ' + e.origin);\\n\"\n\t\t\t\" if (e.origin !== targetOrigin ) {\\n\"\n\t\t\t\" console.debug('receiveMessage: cross-site scripting attack?');\\n\"\n\t\t\t\" return;\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\" if (e.data != 'unchanged') {\\n\"\n\t\t\t\" clearInterval(timerID);\\n\"\n\t\t\t\" if (e.data == 'changed') {\\n\"\n\t\t\t\"\t\t window.location.href = '%s?session=check';\\n\"\n\t\t\t\" } else {\\n\"\n\t\t\t\"\t\t window.location.href = '%s?session=logout';\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\" }\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" window.addEventListener('message', receiveMessage, false);\\n\"\n\t\t\t\"\\n\"\n\t\t\t\" </script>\\n\";", "\t/* determine the origin for the check_session_iframe endpoint */\n\tchar *origin = apr_pstrdup(r->pool, check_session_iframe);\n\tapr_uri_t uri;\n\tapr_uri_parse(r->pool, check_session_iframe, &uri);\n\tchar *p = strstr(origin, uri.path);\n\t*p = '\\0';", "\t/* the element identifier for the OP iframe */\n\tconst char *op_iframe_id = \"openidc-op\";", "\t/* restore the OP session_state from the session */\n\tconst char *session_state = oidc_session_get_session_state(r, session);\n\tif (session_state == NULL) {\n\t\toidc_warn(r,\n\t\t\t\t\"no session_state found in the session; the OP does probably not support session management!?\");\n\t\treturn DONE;\n\t}", "\tchar *s_poll_interval = NULL;\n\toidc_util_get_request_parameter(r, \"poll\", &s_poll_interval);", "\tint poll_interval = s_poll_interval ? strtol(s_poll_interval, NULL, 10) : 0;\n\tif ((poll_interval <= 0) || (poll_interval > 3600 * 24))\n\t\tpoll_interval = 3000;", "\n\tconst char *redirect_uri = oidc_get_redirect_uri(r, c);\n\tjava_script = apr_psprintf(r->pool, java_script, origin, client_id,", "\t\t\tsession_state, op_iframe_id, poll_interval, redirect_uri,", "\t\t\tredirect_uri);", "\treturn oidc_util_html_send(r, NULL, java_script, \"setTimer\", NULL, DONE);\n}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 797, "char_start": 796, "chars": "d" }, { "char_end": 2291, "char_start": 2275, "chars": "nt poll_interval" }, { "char_end": 2294, "char_start": 2292, "chars": "= " }, { "char_end": 2335, "char_start": 2310, "chars": "? strtol(s_poll_interval," }, { "char_end": 2344, "char_start": 2340, "chars": ", 10" }, { "char_end": 2350, "char_start": 2345, "chars": " : 0;" }, { "char_end": 2361, "char_start": 2352, "chars": "if ((poll" }, { "char_end": 2411, "char_start": 2362, "chars": "interval <= 0) || (poll_interval > 3600 * 24))\n\t\t" } ], "deleted": [ { "char_end": 797, "char_start": 796, "chars": "s" }, { "char_end": 2276, "char_start": 2275, "chars": "f" }, { "char_end": 2296, "char_start": 2293, "chars": " ==" }, { "char_end": 2306, "char_start": 2304, "chars": "\ts" }, { "char_end": 2324, "char_start": 2323, "chars": "\"" }, { "char_end": 2329, "char_start": 2328, "chars": "\"" }, { "char_end": 2492, "char_start": 2490, "chars": "s_" } ] }, "commit_link": "github.com/zmartzone/mod_auth_openidc/commit/132a4111bf3791e76437619a66336dce2ce4c79b", "file_name": "src/mod_auth_openidc.c", "func_name": "oidc_handle_session_management_iframe_rp", "line_changes": { "added": [ { "char_end": 803, "char_start": 743, "line": "\t\t\t\" timerID = setInterval('checkSession()', %d);\\n\"\n", "line_no": 21 }, { "char_end": 2351, "char_start": 2273, "line": "\tint poll_interval = s_poll_interval ? strtol(s_poll_interval, NULL, 10) : 0;\n", "line_no": 64 }, { "char_end": 2409, "char_start": 2351, "line": "\tif ((poll_interval <= 0) || (poll_interval > 3600 * 24))\n", "line_no": 65 }, { "char_end": 2433, "char_start": 2409, "line": "\t\tpoll_interval = 3000;\n", "line_no": 66 }, { "char_end": 2621, "char_start": 2560, "line": "\t\t\tsession_state, op_iframe_id, poll_interval, redirect_uri,\n", "line_no": 70 } ], "deleted": [ { "char_end": 803, "char_start": 743, "line": "\t\t\t\" timerID = setInterval('checkSession()', %s);\\n\"\n", "line_no": 21 }, { "char_end": 2303, "char_start": 2273, "line": "\tif (s_poll_interval == NULL)\n", "line_no": 64 }, { "char_end": 2331, "char_start": 2303, "line": "\t\ts_poll_interval = \"3000\";\n", "line_no": 65 }, { "char_end": 2521, "char_start": 2458, "line": "\t\t\tsession_state, op_iframe_id, s_poll_interval, redirect_uri,\n", "line_no": 69 } ] }, "vul_type": "cwe-079" }
184
cwe-079
c
Determine whether the {function_name} code is vulnerable or not.
[ "void Logger::addMessage(const QString &message, const Log::MsgType &type)\n{\n QWriteLocker locker(&lock);\n", " Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, message };", " m_messages.push_back(temp);", " if (m_messages.size() >= MAX_LOG_MESSAGES)\n m_messages.pop_front();", " emit newLogMessage(temp);\n}" ]
[ 1, 0, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 217, "char_start": 188, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 225, "char_start": 224, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16", "file_name": "src/base/logger.cpp", "func_name": "Logger::addMessage", "line_changes": { "added": [ { "char_end": 229, "char_start": 109, "line": " Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, Utils::String::toHtmlEscaped(message) };\n", "line_no": 5 } ], "deleted": [ { "char_end": 199, "char_start": 109, "line": " Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, message };\n", "line_no": 5 } ] }, "vul_type": "cwe-079" }
185
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "void Logger::addMessage(const QString &message, const Log::MsgType &type)\n{\n QWriteLocker locker(&lock);\n", " Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, Utils::String::toHtmlEscaped(message) };", " m_messages.push_back(temp);", " if (m_messages.size() >= MAX_LOG_MESSAGES)\n m_messages.pop_front();", " emit newLogMessage(temp);\n}" ]
[ 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 217, "char_start": 188, "chars": "Utils::String::toHtmlEscaped(" }, { "char_end": 225, "char_start": 224, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16", "file_name": "src/base/logger.cpp", "func_name": "Logger::addMessage", "line_changes": { "added": [ { "char_end": 229, "char_start": 109, "line": " Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, Utils::String::toHtmlEscaped(message) };\n", "line_no": 5 } ], "deleted": [ { "char_end": 199, "char_start": 109, "line": " Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, message };\n", "line_no": 5 } ] }, "vul_type": "cwe-079" }
185
cwe-079
cpp
Determine whether the {function_name} code is vulnerable or not.
[ "@handler.unsupported_on_local_server\n @handler.get(handler.HTML)\n def get(self):\n \"\"\"Handle a get request.\"\"\"", "", " self.render(\n 'login.html', {\n 'apiKey': local_config.ProjectConfig().get('firebase.api_key'),\n 'authDomain': auth.auth_domain(),", " 'dest': self.request.get('dest'),", " })" ]
[ 1, 0, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 200, "char_start": 121, "chars": "dest = self.request.get('dest')\n base_handler.check_redirect_url(dest)\n\n " } ], "deleted": [ { "char_end": 318, "char_start": 300, "chars": "self.request.get('" }, { "char_end": 324, "char_start": 322, "chars": "')" } ] }, "commit_link": "github.com/google/clusterfuzz/commit/3d66c1146550eecd4e34d47332a8616b435a21fe", "file_name": "src/appengine/handlers/login.py", "func_name": "get", "line_changes": { "added": [ { "char_end": 153, "char_start": 117, "line": " dest = self.request.get('dest')\n", "line_no": 5 }, { "char_end": 195, "char_start": 153, "line": " base_handler.check_redirect_url(dest)\n", "line_no": 6 }, { "char_end": 196, "char_start": 195, "line": "\n", "line_no": 7 }, { "char_end": 385, "char_start": 359, "line": " 'dest': dest,\n", "line_no": 12 } ], "deleted": [ { "char_end": 326, "char_start": 280, "line": " 'dest': self.request.get('dest'),\n", "line_no": 9 } ] }, "vul_type": "cwe-079" }
186
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@handler.unsupported_on_local_server\n @handler.get(handler.HTML)\n def get(self):\n \"\"\"Handle a get request.\"\"\"", " dest = self.request.get('dest')\n base_handler.check_redirect_url(dest)\n", " self.render(\n 'login.html', {\n 'apiKey': local_config.ProjectConfig().get('firebase.api_key'),\n 'authDomain': auth.auth_domain(),", " 'dest': dest,", " })" ]
[ 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 200, "char_start": 121, "chars": "dest = self.request.get('dest')\n base_handler.check_redirect_url(dest)\n\n " } ], "deleted": [ { "char_end": 318, "char_start": 300, "chars": "self.request.get('" }, { "char_end": 324, "char_start": 322, "chars": "')" } ] }, "commit_link": "github.com/google/clusterfuzz/commit/3d66c1146550eecd4e34d47332a8616b435a21fe", "file_name": "src/appengine/handlers/login.py", "func_name": "get", "line_changes": { "added": [ { "char_end": 153, "char_start": 117, "line": " dest = self.request.get('dest')\n", "line_no": 5 }, { "char_end": 195, "char_start": 153, "line": " base_handler.check_redirect_url(dest)\n", "line_no": 6 }, { "char_end": 196, "char_start": 195, "line": "\n", "line_no": 7 }, { "char_end": 385, "char_start": 359, "line": " 'dest': dest,\n", "line_no": 12 } ], "deleted": [ { "char_end": 326, "char_start": 280, "line": " 'dest': self.request.get('dest'),\n", "line_no": 9 } ] }, "vul_type": "cwe-079" }
186
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def manipulate_reservation_action(request: HttpRequest, default_foreward_url: str):\n \"\"\"\n This function is used to alter the reservation beeing build inside\n a cookie. This function automatically crafts the required response.\n \"\"\"\n js_string: str = \"\"\n r: GroupReservation = None\n u: Profile = get_current_user(request)\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if \"srid\" in request.GET:\n if not request.GET.get(\"rid\"):\n return HttpResponseRedirect(\"/admin?error=missing%20primary%20reservation%20id\")\n srid: int = int(request.GET[\"srid\"])\n sr: SubReservation = None\n if srid == 0:\n sr = SubReservation()\n else:\n sr = SubReservation.objects.get(id=srid)\n if request.POST.get(\"notes\"):", " sr.notes = request.POST[\"notes\"]", " else:\n sr.notes = \" \"\n sr.primary_reservation = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n sr.save()\n print(request.POST)\n print(sr.notes)\n return HttpResponseRedirect(\"/admin/reservations/edit?rid=\" + str(int(request.GET[\"rid\"])) + \"&srid=\" + str(sr.id))\n if \"rid\" in request.GET:\n # update reservation\n r = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n elif u.number_of_allowed_reservations > GroupReservation.objects.all().filter(createdByUser=u).count():\n r = GroupReservation()\n r.createdByUser = u\n r.ready = False\n r.open = True\n r.pickupDate = datetime.datetime.now()\n else:\n return HttpResponseRedirect(\"/admin?error=Too%20Many%20reservations\")\n if request.POST.get(\"notes\"):", " r.notes = request.POST[\"notes\"]", " if request.POST.get(\"contact\"):", " r.responsiblePerson = str(request.POST[\"contact\"])", " if (r.createdByUser == u or o.rights > 1) and not r.submitted:\n r.save()\n else:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n response: HttpResponseRedirect = HttpResponseRedirect(forward_url + \"?rid=\" + str(r.id))\n return response" ]
[ 1, 0, 1, 0, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 899, "char_start": 892, "chars": "escape(" }, { "char_end": 921, "char_start": 920, "chars": ")" }, { "char_end": 1781, "char_start": 1774, "chars": "escape(" }, { "char_end": 1803, "char_start": 1802, "chars": ")" }, { "char_end": 1877, "char_start": 1870, "chars": "escape(" }, { "char_end": 1905, "char_start": 1904, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600", "file_name": "c3shop/frontpage/management/reservation_actions.py", "func_name": "manipulate_reservation_action", "line_changes": { "added": [ { "char_end": 922, "char_start": 869, "line": " sr.notes = escape(request.POST[\"notes\"])\n", "line_no": 22 }, { "char_end": 1804, "char_start": 1756, "line": " r.notes = escape(request.POST[\"notes\"])\n", "line_no": 42 }, { "char_end": 1907, "char_start": 1840, "line": " r.responsiblePerson = escape(str(request.POST[\"contact\"]))\n", "line_no": 44 } ], "deleted": [ { "char_end": 914, "char_start": 869, "line": " sr.notes = request.POST[\"notes\"]\n", "line_no": 22 }, { "char_end": 1788, "char_start": 1748, "line": " r.notes = request.POST[\"notes\"]\n", "line_no": 42 }, { "char_end": 1883, "char_start": 1824, "line": " r.responsiblePerson = str(request.POST[\"contact\"])\n", "line_no": 44 } ] }, "vul_type": "cwe-079" }
187
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def manipulate_reservation_action(request: HttpRequest, default_foreward_url: str):\n \"\"\"\n This function is used to alter the reservation beeing build inside\n a cookie. This function automatically crafts the required response.\n \"\"\"\n js_string: str = \"\"\n r: GroupReservation = None\n u: Profile = get_current_user(request)\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if \"srid\" in request.GET:\n if not request.GET.get(\"rid\"):\n return HttpResponseRedirect(\"/admin?error=missing%20primary%20reservation%20id\")\n srid: int = int(request.GET[\"srid\"])\n sr: SubReservation = None\n if srid == 0:\n sr = SubReservation()\n else:\n sr = SubReservation.objects.get(id=srid)\n if request.POST.get(\"notes\"):", " sr.notes = escape(request.POST[\"notes\"])", " else:\n sr.notes = \" \"\n sr.primary_reservation = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n sr.save()\n print(request.POST)\n print(sr.notes)\n return HttpResponseRedirect(\"/admin/reservations/edit?rid=\" + str(int(request.GET[\"rid\"])) + \"&srid=\" + str(sr.id))\n if \"rid\" in request.GET:\n # update reservation\n r = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n elif u.number_of_allowed_reservations > GroupReservation.objects.all().filter(createdByUser=u).count():\n r = GroupReservation()\n r.createdByUser = u\n r.ready = False\n r.open = True\n r.pickupDate = datetime.datetime.now()\n else:\n return HttpResponseRedirect(\"/admin?error=Too%20Many%20reservations\")\n if request.POST.get(\"notes\"):", " r.notes = escape(request.POST[\"notes\"])", " if request.POST.get(\"contact\"):", " r.responsiblePerson = escape(str(request.POST[\"contact\"]))", " if (r.createdByUser == u or o.rights > 1) and not r.submitted:\n r.save()\n else:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n response: HttpResponseRedirect = HttpResponseRedirect(forward_url + \"?rid=\" + str(r.id))\n return response" ]
[ 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 899, "char_start": 892, "chars": "escape(" }, { "char_end": 921, "char_start": 920, "chars": ")" }, { "char_end": 1781, "char_start": 1774, "chars": "escape(" }, { "char_end": 1803, "char_start": 1802, "chars": ")" }, { "char_end": 1877, "char_start": 1870, "chars": "escape(" }, { "char_end": 1905, "char_start": 1904, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600", "file_name": "c3shop/frontpage/management/reservation_actions.py", "func_name": "manipulate_reservation_action", "line_changes": { "added": [ { "char_end": 922, "char_start": 869, "line": " sr.notes = escape(request.POST[\"notes\"])\n", "line_no": 22 }, { "char_end": 1804, "char_start": 1756, "line": " r.notes = escape(request.POST[\"notes\"])\n", "line_no": 42 }, { "char_end": 1907, "char_start": 1840, "line": " r.responsiblePerson = escape(str(request.POST[\"contact\"]))\n", "line_no": 44 } ], "deleted": [ { "char_end": 914, "char_start": 869, "line": " sr.notes = request.POST[\"notes\"]\n", "line_no": 22 }, { "char_end": 1788, "char_start": 1748, "line": " r.notes = request.POST[\"notes\"]\n", "line_no": 42 }, { "char_end": 1883, "char_start": 1824, "line": " r.responsiblePerson = str(request.POST[\"contact\"])\n", "line_no": 44 } ] }, "vul_type": "cwe-079" }
187
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@property\n async def html_content(self):", " content = await self.content", " if not content:\n return ''\n return markdown(content)" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 84, "char_start": 66, "chars": "markupsafe.escape(" }, { "char_end": 103, "char_start": 102, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/dongweiming/lyanna/commit/fcefac79e4b7601e81a3b3fe0ad26ab18ee95d7d", "file_name": "models/comment.py", "func_name": "html_content", "line_changes": { "added": [ { "char_end": 104, "char_start": 48, "line": " content = markupsafe.escape(await self.content)\n", "line_no": 3 } ], "deleted": [ { "char_end": 85, "char_start": 48, "line": " content = await self.content\n", "line_no": 3 } ] }, "vul_type": "cwe-079" }
188
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "@property\n async def html_content(self):", " content = markupsafe.escape(await self.content)", " if not content:\n return ''\n return markdown(content)" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 84, "char_start": 66, "chars": "markupsafe.escape(" }, { "char_end": 103, "char_start": 102, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/dongweiming/lyanna/commit/fcefac79e4b7601e81a3b3fe0ad26ab18ee95d7d", "file_name": "models/comment.py", "func_name": "html_content", "line_changes": { "added": [ { "char_end": 104, "char_start": 48, "line": " content = markupsafe.escape(await self.content)\n", "line_no": 3 } ], "deleted": [ { "char_end": 85, "char_start": 48, "line": " content = await self.content\n", "line_no": 3 } ] }, "vul_type": "cwe-079" }
188
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def get_context_data(self, *args, **kwargs):\n data = super().get_context_data(*args, **kwargs)\n", " if self.request.GET.get('back', None) is not None:\n data['back_link'] = self.request.GET['back']", "\n return data" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 121, "char_start": 115, "chars": "back =" }, { "char_end": 307, "char_start": 156, "chars": "\n parsed_back_url = urllib.parse.urlparse(back)\n\n # We only allow blank scheme, e.g. relative urls to avoid reflected XSS\n if back" }, { "char_end": 352, "char_start": 319, "chars": " and parsed_back_url.scheme == \"\"" } ], "deleted": [ { "char_end": 117, "char_start": 115, "chars": "if" }, { "char_end": 216, "char_start": 198, "chars": "self.request.GET['" }, { "char_end": 222, "char_start": 220, "chars": "']" } ] }, "commit_link": "github.com/pirati-web/socialnisystem.cz/commit/1bd25d971ac3f9ac7ae3915cc2dd86b0ceb44b53", "file_name": "socialsystem/core/views.py", "func_name": "get_context_data", "line_changes": { "added": [ { "char_end": 157, "char_start": 107, "line": " back = self.request.GET.get('back', None)\n", "line_no": 4 }, { "char_end": 211, "char_start": 157, "line": " parsed_back_url = urllib.parse.urlparse(back)\n", "line_no": 5 }, { "char_end": 212, "char_start": 211, "line": "\n", "line_no": 6 }, { "char_end": 354, "char_start": 292, "line": " if back is not None and parsed_back_url.scheme == \"\":\n", "line_no": 8 }, { "char_end": 391, "char_start": 354, "line": " data['back_link'] = back\n", "line_no": 9 } ], "deleted": [ { "char_end": 166, "char_start": 107, "line": " if self.request.GET.get('back', None) is not None:\n", "line_no": 4 }, { "char_end": 223, "char_start": 166, "line": " data['back_link'] = self.request.GET['back']\n", "line_no": 5 } ] }, "vul_type": "cwe-079" }
189
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def get_context_data(self, *args, **kwargs):\n data = super().get_context_data(*args, **kwargs)\n", " back = self.request.GET.get('back', None)\n parsed_back_url = urllib.parse.urlparse(back)", " # We only allow blank scheme, e.g. relative urls to avoid reflected XSS\n if back is not None and parsed_back_url.scheme == \"\":\n data['back_link'] = back", "\n return data" ]
[ 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 121, "char_start": 115, "chars": "back =" }, { "char_end": 307, "char_start": 156, "chars": "\n parsed_back_url = urllib.parse.urlparse(back)\n\n # We only allow blank scheme, e.g. relative urls to avoid reflected XSS\n if back" }, { "char_end": 352, "char_start": 319, "chars": " and parsed_back_url.scheme == \"\"" } ], "deleted": [ { "char_end": 117, "char_start": 115, "chars": "if" }, { "char_end": 216, "char_start": 198, "chars": "self.request.GET['" }, { "char_end": 222, "char_start": 220, "chars": "']" } ] }, "commit_link": "github.com/pirati-web/socialnisystem.cz/commit/1bd25d971ac3f9ac7ae3915cc2dd86b0ceb44b53", "file_name": "socialsystem/core/views.py", "func_name": "get_context_data", "line_changes": { "added": [ { "char_end": 157, "char_start": 107, "line": " back = self.request.GET.get('back', None)\n", "line_no": 4 }, { "char_end": 211, "char_start": 157, "line": " parsed_back_url = urllib.parse.urlparse(back)\n", "line_no": 5 }, { "char_end": 212, "char_start": 211, "line": "\n", "line_no": 6 }, { "char_end": 354, "char_start": 292, "line": " if back is not None and parsed_back_url.scheme == \"\":\n", "line_no": 8 }, { "char_end": 391, "char_start": 354, "line": " data['back_link'] = back\n", "line_no": 9 } ], "deleted": [ { "char_end": 166, "char_start": 107, "line": " if self.request.GET.get('back', None) is not None:\n", "line_no": 4 }, { "char_end": 223, "char_start": 166, "line": " data['back_link'] = self.request.GET['back']\n", "line_no": 5 } ] }, "vul_type": "cwe-079" }
189
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def add_article_action(request: HttpRequest, default_foreward_url: str):\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n else:\n forward_url = \"/admin\"\n if \"rid\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=Missing%20reservation%20id%20in%20request\")\n u: Profile = get_current_user(request)\n current_reservation = GroupReservation.objects.get(id=str(request.GET[\"rid\"]))\n if current_reservation.createdByUser != u and u.rights < 2:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n if current_reservation.submitted == True:\n return HttpResponseRedirect(\"/admin?error=Already%20submitted\")\n # Test for multiple or single article\n if \"article_id\" in request.POST:\n # Actual adding of article\n aid: int = int(request.GET.get(\"article_id\"))\n quantity: int = int(request.POST[\"quantity\"])", " notes: str = request.POST[\"notes\"]", " ar = ArticleRequested()\n ar.AID = Article.objects.get(id=aid)\n ar.RID = current_reservation\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.amount = quantity\n ar.notes = notes\n ar.save()\n # Actual adding of multiple articles\n else:\n if \"group_id\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=missing%20group%20id\")\n g: ArticleGroup = ArticleGroup.objects.get(id=int(request.GET[\"group_id\"]))\n for art in Article.objects.all().filter(group=g):\n if str(\"quantity_\" + str(art.id)) not in request.POST or str(\"notes_\" + str(art.id)) not in request.POST:\n return HttpResponseRedirect(\"/admin?error=Missing%20article%20data%20in%20request\")\n amount = int(request.POST[\"quantity_\" + str(art.id)])\n if amount > 0:\n ar = ArticleRequested()\n ar.AID = art\n ar.RID = current_reservation\n ar.amount = amount\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))", " ar.notes = str(request.POST[str(\"notes_\" + str(art.id))])", " ar.save()\n if \"srid\" in request.GET:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id) + \"&srid=\" + request.GET[\"srid\"])\n else:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id))\n return response" ]
[ 1, 0, 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 982, "char_start": 975, "chars": "escape(" }, { "char_end": 1004, "char_start": 1003, "chars": ")" }, { "char_end": 2237, "char_start": 2230, "chars": "escape(" }, { "char_end": 2283, "char_start": 2282, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600", "file_name": "c3shop/frontpage/management/reservation_actions.py", "func_name": "add_article_action", "line_changes": { "added": [ { "char_end": 1005, "char_start": 954, "line": " notes: str = escape(request.POST[\"notes\"])\n", "line_no": 20 }, { "char_end": 2285, "char_start": 2203, "line": " ar.notes = escape(str(request.POST[str(\"notes_\" + str(art.id))]))\n", "line_no": 45 } ], "deleted": [ { "char_end": 997, "char_start": 954, "line": " notes: str = request.POST[\"notes\"]\n", "line_no": 20 }, { "char_end": 2269, "char_start": 2195, "line": " ar.notes = str(request.POST[str(\"notes_\" + str(art.id))])\n", "line_no": 45 } ] }, "vul_type": "cwe-079" }
190
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def add_article_action(request: HttpRequest, default_foreward_url: str):\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n else:\n forward_url = \"/admin\"\n if \"rid\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=Missing%20reservation%20id%20in%20request\")\n u: Profile = get_current_user(request)\n current_reservation = GroupReservation.objects.get(id=str(request.GET[\"rid\"]))\n if current_reservation.createdByUser != u and u.rights < 2:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n if current_reservation.submitted == True:\n return HttpResponseRedirect(\"/admin?error=Already%20submitted\")\n # Test for multiple or single article\n if \"article_id\" in request.POST:\n # Actual adding of article\n aid: int = int(request.GET.get(\"article_id\"))\n quantity: int = int(request.POST[\"quantity\"])", " notes: str = escape(request.POST[\"notes\"])", " ar = ArticleRequested()\n ar.AID = Article.objects.get(id=aid)\n ar.RID = current_reservation\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.amount = quantity\n ar.notes = notes\n ar.save()\n # Actual adding of multiple articles\n else:\n if \"group_id\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=missing%20group%20id\")\n g: ArticleGroup = ArticleGroup.objects.get(id=int(request.GET[\"group_id\"]))\n for art in Article.objects.all().filter(group=g):\n if str(\"quantity_\" + str(art.id)) not in request.POST or str(\"notes_\" + str(art.id)) not in request.POST:\n return HttpResponseRedirect(\"/admin?error=Missing%20article%20data%20in%20request\")\n amount = int(request.POST[\"quantity_\" + str(art.id)])\n if amount > 0:\n ar = ArticleRequested()\n ar.AID = art\n ar.RID = current_reservation\n ar.amount = amount\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))", " ar.notes = escape(str(request.POST[str(\"notes_\" + str(art.id))]))", " ar.save()\n if \"srid\" in request.GET:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id) + \"&srid=\" + request.GET[\"srid\"])\n else:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id))\n return response" ]
[ 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 982, "char_start": 975, "chars": "escape(" }, { "char_end": 1004, "char_start": 1003, "chars": ")" }, { "char_end": 2237, "char_start": 2230, "chars": "escape(" }, { "char_end": 2283, "char_start": 2282, "chars": ")" } ], "deleted": [] }, "commit_link": "github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600", "file_name": "c3shop/frontpage/management/reservation_actions.py", "func_name": "add_article_action", "line_changes": { "added": [ { "char_end": 1005, "char_start": 954, "line": " notes: str = escape(request.POST[\"notes\"])\n", "line_no": 20 }, { "char_end": 2285, "char_start": 2203, "line": " ar.notes = escape(str(request.POST[str(\"notes_\" + str(art.id))]))\n", "line_no": 45 } ], "deleted": [ { "char_end": 997, "char_start": 954, "line": " notes: str = request.POST[\"notes\"]\n", "line_no": 20 }, { "char_end": 2269, "char_start": 2195, "line": " ar.notes = str(request.POST[str(\"notes_\" + str(art.id))])\n", "line_no": 45 } ] }, "vul_type": "cwe-079" }
190
cwe-079
py
Determine whether the {function_name} code is vulnerable or not.
[ "def build_board(conn, game,size):\n # we'll build the empty board, and then fill in with the move list that\n # we get from the DB.\n board = []\n for i in range(size):\n board.append([\"\"]*size)", "\n # search for all moves that have happenend during this game.\n cursor = conn.cursor()", " cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\" % game)", "\n counts = {\"X\":0, \"O\":0}\n for move in cursor.fetchall():\n (x,y,letter) = move", " x = int(x)\n y = int(y)\n assert x >= 0 and x < size\n assert y >= 0 and y < size", " assert letter in \"XO\"", " assert board[x][y] == \"\"\n board[x][y] = letter", " counts[letter] += 1", " cursor.close()", " assert counts[\"X\"] >= counts[\"O\"]\n assert counts[\"X\"] <= counts[\"O\"]+1", " if counts[\"X\"] == counts[\"O\"]:\n nextPlayer = 0\n else:\n nextPlayer = 1\n letter = \"XO\"[nextPlayer]", " return (board,nextPlayer,letter)" ]
[ 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 372, "char_start": 371, "chars": "," }, { "char_end": 374, "char_start": 373, "chars": "(" }, { "char_end": 380, "char_start": 378, "chars": ",)" } ], "deleted": [ { "char_end": 373, "char_start": 371, "chars": " %" } ] }, "commit_link": "github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da", "file_name": "cgi/common.py", "func_name": "build_board", "line_changes": { "added": [ { "char_end": 382, "char_start": 303, "line": " cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\", (game,))\n", "line_no": 11 } ], "deleted": [ { "char_end": 380, "char_start": 303, "line": " cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\" % game)\n", "line_no": 11 } ] }, "vul_type": "cwe-089" }
191
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def build_board(conn, game,size):\n # we'll build the empty board, and then fill in with the move list that\n # we get from the DB.\n board = []\n for i in range(size):\n board.append([\"\"]*size)", "\n # search for all moves that have happenend during this game.\n cursor = conn.cursor()", " cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\", (game,))", "\n counts = {\"X\":0, \"O\":0}\n for move in cursor.fetchall():\n (x,y,letter) = move", " x = int(x)\n y = int(y)\n assert x >= 0 and x < size\n assert y >= 0 and y < size", " assert letter in \"XO\"", " assert board[x][y] == \"\"\n board[x][y] = letter", " counts[letter] += 1", " cursor.close()", " assert counts[\"X\"] >= counts[\"O\"]\n assert counts[\"X\"] <= counts[\"O\"]+1", " if counts[\"X\"] == counts[\"O\"]:\n nextPlayer = 0\n else:\n nextPlayer = 1\n letter = \"XO\"[nextPlayer]", " return (board,nextPlayer,letter)" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 372, "char_start": 371, "chars": "," }, { "char_end": 374, "char_start": 373, "chars": "(" }, { "char_end": 380, "char_start": 378, "chars": ",)" } ], "deleted": [ { "char_end": 373, "char_start": 371, "chars": " %" } ] }, "commit_link": "github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da", "file_name": "cgi/common.py", "func_name": "build_board", "line_changes": { "added": [ { "char_end": 382, "char_start": 303, "line": " cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\", (game,))\n", "line_no": 11 } ], "deleted": [ { "char_end": 380, "char_start": 303, "line": " cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\" % game)\n", "line_no": 11 } ] }, "vul_type": "cwe-089" }
191
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def check_and_update_ranks(self, scene):\n # There are 2 cases here:\n # 1) Ranks have never been calculated for this scene before\n # - This means we need to calculate what the ranks were every month of this scenes history\n # - We should only do this if ranks don't already exist for this scene\n # 2) Ranks have been calculated for this scene before\n # - We already have bulk ranks. We should check if it has been more than 1 month since we last\n # calculated ranks. If so, calculate again with the brackets that have come out this month", " LOG.info('About to check if ranks need updating for {}'.format(scene))\n # First, do we have any ranks for this scene already?", " sql = 'select count(*) from ranks where scene=\"{}\";'.format(scene)\n res = self.db.exec(sql)", " count = res[0][0]", " n = 5 if (scene == 'pro' or scene == 'pro_wiiu') else constants.TOURNAMENTS_PER_RANK\n if count == 0:\n LOG.info('Detected that we need to bulk update ranks for {}'.format(scene))\n # Alright, we have nothing. Bulk update ranks\n first_month = bracket_utils.get_first_month(self.db, scene)\n last_month = bracket_utils.get_last_month(self.db, scene)\n \n # Iterate through all tournaments going month by month, and calculate ranks\n months = bracket_utils.iter_months(first_month, last_month, include_first=False, include_last=True)\n for month in months:\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n else:", " # Get the date of the last time we calculated ranks", " sql = \"select date from ranks where scene='{}' order by date desc limit 1;\".format(scene)\n res = self.db.exec(sql)", " last_rankings_date = res[0][0]", " # Check to see if it's been more than 1 month since we last calculated ranks\n more_than_one_month = bracket_utils.has_month_passed(last_rankings_date)\n if more_than_one_month:\n # Get only the last n tournaments, so it doesn't take too long to process\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n msg = 'Detected that we need up update monthly ranks for {}, on {}'.format(scene, today)\n LOG.info(msg)", " # We should only ever calculate ranks on the 1st. If today is not the first, log error\n if not today.split('-')[-1] == '1':\n LOG.exc('We are calculating ranks today, {}, but it isnt the first'.format(today))", " months = bracket_utils.iter_months(last_rankings_date, today, include_first=False, include_last=True)\n for month in months:\n # Make sure that we actually have matches during this month\n # Say we are trying to calculate ranks for 2018-05-01, the player would need to have matches during 2018-04-01, 2018-04-30\n prev_date = bracket_utils.get_previous_month(month)\n brackets_during_month = bracket_utils.get_tournaments_during_month(self.db, scene, prev_date)", " if len(brackets_during_month) > 0:\n tweet('Calculating {} ranks for {}'.format(month, scene))\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)", " else:\n LOG.info('It has not yet been 1 month since we calculated ranks for {}. Skipping'.format(scene))" ]
[ 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 824, "char_start": 819, "chars": "scene" }, { "char_end": 837, "char_start": 828, "chars": "\n " }, { "char_end": 846, "char_start": 838, "chars": "rgs = {'" }, { "char_end": 860, "char_start": 851, "chars": "': scene}" }, { "char_end": 897, "char_start": 891, "chars": ", args" }, { "char_end": 1867, "char_start": 1862, "chars": "scene" }, { "char_end": 1911, "char_start": 1898, "chars": "\n " }, { "char_end": 1920, "char_start": 1912, "chars": "rgs = {'" }, { "char_end": 1934, "char_start": 1925, "chars": "': scene}" }, { "char_end": 1975, "char_start": 1969, "chars": ", args" } ], "deleted": [ { "char_end": 826, "char_start": 823, "chars": ".fo" }, { "char_end": 831, "char_start": 827, "chars": "mat(" }, { "char_end": 837, "char_start": 836, "chars": ")" }, { "char_end": 1867, "char_start": 1864, "chars": ".fo" }, { "char_end": 1872, "char_start": 1868, "chars": "mat(" }, { "char_end": 1878, "char_start": 1877, "chars": ")" } ] }, "commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63", "file_name": "process_data.py", "func_name": "check_and_update_ranks", "line_changes": { "added": [ { "char_end": 829, "char_start": 763, "line": " sql = 'select count(*) from ranks where scene=\"{scene}\";'\n", "line_no": 12 }, { "char_end": 861, "char_start": 829, "line": " args = {'scene': scene}\n", "line_no": 13 }, { "char_end": 899, "char_start": 861, "line": " res = self.db.exec(sql, args)\n", "line_no": 14 }, { "char_end": 1899, "char_start": 1806, "line": " sql = \"select date from ranks where scene='{scene}' order by date desc limit 1;\"\n", "line_no": 32 }, { "char_end": 1935, "char_start": 1899, "line": " args = {'scene': scene}\n", "line_no": 33 }, { "char_end": 1977, "char_start": 1935, "line": " res = self.db.exec(sql, args)\n", "line_no": 34 } ], "deleted": [ { "char_end": 838, "char_start": 763, "line": " sql = 'select count(*) from ranks where scene=\"{}\";'.format(scene)\n", "line_no": 12 }, { "char_end": 870, "char_start": 838, "line": " res = self.db.exec(sql)\n", "line_no": 13 }, { "char_end": 1879, "char_start": 1777, "line": " sql = \"select date from ranks where scene='{}' order by date desc limit 1;\".format(scene)\n", "line_no": 31 }, { "char_end": 1915, "char_start": 1879, "line": " res = self.db.exec(sql)\n", "line_no": 32 } ] }, "vul_type": "cwe-089" }
192
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def check_and_update_ranks(self, scene):\n # There are 2 cases here:\n # 1) Ranks have never been calculated for this scene before\n # - This means we need to calculate what the ranks were every month of this scenes history\n # - We should only do this if ranks don't already exist for this scene\n # 2) Ranks have been calculated for this scene before\n # - We already have bulk ranks. We should check if it has been more than 1 month since we last\n # calculated ranks. If so, calculate again with the brackets that have come out this month", " LOG.info('About to check if ranks need updating for {}'.format(scene))\n # First, do we have any ranks for this scene already?", " sql = 'select count(*) from ranks where scene=\"{scene}\";'\n args = {'scene': scene}\n res = self.db.exec(sql, args)", " count = res[0][0]", " n = 5 if (scene == 'pro' or scene == 'pro_wiiu') else constants.TOURNAMENTS_PER_RANK\n if count == 0:\n LOG.info('Detected that we need to bulk update ranks for {}'.format(scene))\n # Alright, we have nothing. Bulk update ranks\n first_month = bracket_utils.get_first_month(self.db, scene)\n last_month = bracket_utils.get_last_month(self.db, scene)\n \n # Iterate through all tournaments going month by month, and calculate ranks\n months = bracket_utils.iter_months(first_month, last_month, include_first=False, include_last=True)\n for month in months:\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n else:", " # Get the date of the last time we calculated ranks", " sql = \"select date from ranks where scene='{scene}' order by date desc limit 1;\"\n args = {'scene': scene}\n res = self.db.exec(sql, args)", " last_rankings_date = res[0][0]", " # Check to see if it's been more than 1 month since we last calculated ranks\n more_than_one_month = bracket_utils.has_month_passed(last_rankings_date)\n if more_than_one_month:\n # Get only the last n tournaments, so it doesn't take too long to process\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n msg = 'Detected that we need up update monthly ranks for {}, on {}'.format(scene, today)\n LOG.info(msg)", " # We should only ever calculate ranks on the 1st. If today is not the first, log error\n if not today.split('-')[-1] == '1':\n LOG.exc('We are calculating ranks today, {}, but it isnt the first'.format(today))", " months = bracket_utils.iter_months(last_rankings_date, today, include_first=False, include_last=True)\n for month in months:\n # Make sure that we actually have matches during this month\n # Say we are trying to calculate ranks for 2018-05-01, the player would need to have matches during 2018-04-01, 2018-04-30\n prev_date = bracket_utils.get_previous_month(month)\n brackets_during_month = bracket_utils.get_tournaments_during_month(self.db, scene, prev_date)", " if len(brackets_during_month) > 0:\n tweet('Calculating {} ranks for {}'.format(month, scene))\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)", " else:\n LOG.info('It has not yet been 1 month since we calculated ranks for {}. Skipping'.format(scene))" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 824, "char_start": 819, "chars": "scene" }, { "char_end": 837, "char_start": 828, "chars": "\n " }, { "char_end": 846, "char_start": 838, "chars": "rgs = {'" }, { "char_end": 860, "char_start": 851, "chars": "': scene}" }, { "char_end": 897, "char_start": 891, "chars": ", args" }, { "char_end": 1867, "char_start": 1862, "chars": "scene" }, { "char_end": 1911, "char_start": 1898, "chars": "\n " }, { "char_end": 1920, "char_start": 1912, "chars": "rgs = {'" }, { "char_end": 1934, "char_start": 1925, "chars": "': scene}" }, { "char_end": 1975, "char_start": 1969, "chars": ", args" } ], "deleted": [ { "char_end": 826, "char_start": 823, "chars": ".fo" }, { "char_end": 831, "char_start": 827, "chars": "mat(" }, { "char_end": 837, "char_start": 836, "chars": ")" }, { "char_end": 1867, "char_start": 1864, "chars": ".fo" }, { "char_end": 1872, "char_start": 1868, "chars": "mat(" }, { "char_end": 1878, "char_start": 1877, "chars": ")" } ] }, "commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63", "file_name": "process_data.py", "func_name": "check_and_update_ranks", "line_changes": { "added": [ { "char_end": 829, "char_start": 763, "line": " sql = 'select count(*) from ranks where scene=\"{scene}\";'\n", "line_no": 12 }, { "char_end": 861, "char_start": 829, "line": " args = {'scene': scene}\n", "line_no": 13 }, { "char_end": 899, "char_start": 861, "line": " res = self.db.exec(sql, args)\n", "line_no": 14 }, { "char_end": 1899, "char_start": 1806, "line": " sql = \"select date from ranks where scene='{scene}' order by date desc limit 1;\"\n", "line_no": 32 }, { "char_end": 1935, "char_start": 1899, "line": " args = {'scene': scene}\n", "line_no": 33 }, { "char_end": 1977, "char_start": 1935, "line": " res = self.db.exec(sql, args)\n", "line_no": 34 } ], "deleted": [ { "char_end": 838, "char_start": 763, "line": " sql = 'select count(*) from ranks where scene=\"{}\";'.format(scene)\n", "line_no": 12 }, { "char_end": 870, "char_start": 838, "line": " res = self.db.exec(sql)\n", "line_no": 13 }, { "char_end": 1879, "char_start": 1777, "line": " sql = \"select date from ranks where scene='{}' order by date desc limit 1;\".format(scene)\n", "line_no": 31 }, { "char_end": 1915, "char_start": 1879, "line": " res = self.db.exec(sql)\n", "line_no": 32 } ] }, "vul_type": "cwe-089" }
192
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def tag_num_to_tag(self, tag_num):\n ''' Returns tag given tag_num. '''\n", " q = \"SELECT tag FROM tags WHERE rowid = '\" + str(tag_num) + \"'\"\n self.query(q)", " return self.c.fetchone()[0]" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 132, "char_start": 131, "chars": "?" }, { "char_end": 163, "char_start": 154, "chars": ", tag_num" } ], "deleted": [ { "char_end": 153, "char_start": 131, "chars": "'\" + str(tag_num) + \"'" } ] }, "commit_link": "github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b", "file_name": "modules/query_lastfm.py", "func_name": "tag_num_to_tag", "line_changes": { "added": [ { "char_end": 134, "char_start": 83, "line": " q = \"SELECT tag FROM tags WHERE rowid = ?\"\n", "line_no": 4 }, { "char_end": 165, "char_start": 134, "line": " self.query(q, tag_num)\n", "line_no": 5 } ], "deleted": [ { "char_end": 155, "char_start": 83, "line": " q = \"SELECT tag FROM tags WHERE rowid = '\" + str(tag_num) + \"'\"\n", "line_no": 4 }, { "char_end": 177, "char_start": 155, "line": " self.query(q)\n", "line_no": 5 } ] }, "vul_type": "cwe-089" }
193
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def tag_num_to_tag(self, tag_num):\n ''' Returns tag given tag_num. '''\n", " q = \"SELECT tag FROM tags WHERE rowid = ?\"\n self.query(q, tag_num)", " return self.c.fetchone()[0]" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 132, "char_start": 131, "chars": "?" }, { "char_end": 163, "char_start": 154, "chars": ", tag_num" } ], "deleted": [ { "char_end": 153, "char_start": 131, "chars": "'\" + str(tag_num) + \"'" } ] }, "commit_link": "github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b", "file_name": "modules/query_lastfm.py", "func_name": "tag_num_to_tag", "line_changes": { "added": [ { "char_end": 134, "char_start": 83, "line": " q = \"SELECT tag FROM tags WHERE rowid = ?\"\n", "line_no": 4 }, { "char_end": 165, "char_start": 134, "line": " self.query(q, tag_num)\n", "line_no": 5 } ], "deleted": [ { "char_end": 155, "char_start": 83, "line": " q = \"SELECT tag FROM tags WHERE rowid = '\" + str(tag_num) + \"'\"\n", "line_no": 4 }, { "char_end": 177, "char_start": 155, "line": " self.query(q)\n", "line_no": 5 } ] }, "vul_type": "cwe-089" }
193
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "@api.route('/items/<int:item_id>', methods=['GET'])\ndef get_item(item_id):", " sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)", " cursor = mysql.connection.cursor()", " cursor.execute(sql)", " data = cursor.fetchone()", " if data:\n item = {}\n for tup in zip([column[0] for column in cursor.description], data):\n item[tup[0]] = tup[1]\n else:\n return jsonify({\"error\": \"item not found\"}), 404", " return jsonify(item)" ]
[ 1, 0, 1, 0, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 138, "char_start": 136, "chars": "%s" }, { "char_end": 238, "char_start": 227, "chars": ", [item_id]" } ], "deleted": [ { "char_end": 138, "char_start": 136, "chars": "{}" }, { "char_end": 181, "char_start": 165, "chars": ".format(item_id)" } ] }, "commit_link": "github.com/cosileone/TimeIsMoneyFriend-API/commit/3d3b5defd26ef7d205915bf643b6b1df90a15e44", "file_name": "timf/api/views.py", "func_name": "get_item", "line_changes": { "added": [ { "char_end": 166, "char_start": 75, "line": " sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = %s AND auctionable = true;'''\n", "line_no": 3 }, { "char_end": 240, "char_start": 205, "line": " cursor.execute(sql, [item_id])\n", "line_no": 5 } ], "deleted": [ { "char_end": 182, "char_start": 75, "line": " sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)\n", "line_no": 3 }, { "char_end": 245, "char_start": 221, "line": " cursor.execute(sql)\n", "line_no": 5 } ] }, "vul_type": "cwe-089" }
194
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "@api.route('/items/<int:item_id>', methods=['GET'])\ndef get_item(item_id):", " sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = %s AND auctionable = true;'''", " cursor = mysql.connection.cursor()", " cursor.execute(sql, [item_id])", " data = cursor.fetchone()", " if data:\n item = {}\n for tup in zip([column[0] for column in cursor.description], data):\n item[tup[0]] = tup[1]\n else:\n return jsonify({\"error\": \"item not found\"}), 404", " return jsonify(item)" ]
[ 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 138, "char_start": 136, "chars": "%s" }, { "char_end": 238, "char_start": 227, "chars": ", [item_id]" } ], "deleted": [ { "char_end": 138, "char_start": 136, "chars": "{}" }, { "char_end": 181, "char_start": 165, "chars": ".format(item_id)" } ] }, "commit_link": "github.com/cosileone/TimeIsMoneyFriend-API/commit/3d3b5defd26ef7d205915bf643b6b1df90a15e44", "file_name": "timf/api/views.py", "func_name": "get_item", "line_changes": { "added": [ { "char_end": 166, "char_start": 75, "line": " sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = %s AND auctionable = true;'''\n", "line_no": 3 }, { "char_end": 240, "char_start": 205, "line": " cursor.execute(sql, [item_id])\n", "line_no": 5 } ], "deleted": [ { "char_end": 182, "char_start": 75, "line": " sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)\n", "line_no": 3 }, { "char_end": 245, "char_start": 221, "line": " cursor.execute(sql)\n", "line_no": 5 } ] }, "vul_type": "cwe-089" }
194
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def getPostsByPostid(self,postid):\n sqlText=\"select users.name,post.comment from users,post where \\", " users.userid=post.userid and post.postid=%d\"%(postid)\n result=sql.queryDB(self.conn,sqlText)", " return result;" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 170, "char_start": 169, "chars": "s" }, { "char_end": 188, "char_start": 171, "chars": "\n params=[" }, { "char_end": 195, "char_start": 194, "chars": "]" }, { "char_end": 247, "char_start": 240, "chars": ",params" } ], "deleted": [ { "char_end": 170, "char_start": 169, "chars": "d" }, { "char_end": 173, "char_start": 171, "chars": "%(" }, { "char_end": 180, "char_start": 179, "chars": ")" } ] }, "commit_link": "github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9", "file_name": "modules/post.py", "func_name": "getPostsByPostid", "line_changes": { "added": [ { "char_end": 172, "char_start": 111, "line": " users.userid=post.userid and post.postid=%s\"\n", "line_no": 3 }, { "char_end": 196, "char_start": 172, "line": " params=[postid]\n", "line_no": 4 }, { "char_end": 249, "char_start": 196, "line": " result=sql.queryDB(self.conn,sqlText,params)\n", "line_no": 5 } ], "deleted": [ { "char_end": 181, "char_start": 111, "line": " users.userid=post.userid and post.postid=%d\"%(postid)\n", "line_no": 3 }, { "char_end": 227, "char_start": 181, "line": " result=sql.queryDB(self.conn,sqlText)\n", "line_no": 4 } ] }, "vul_type": "cwe-089" }
195
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def getPostsByPostid(self,postid):\n sqlText=\"select users.name,post.comment from users,post where \\", " users.userid=post.userid and post.postid=%s\"\n params=[postid]\n result=sql.queryDB(self.conn,sqlText,params)", " return result;" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 170, "char_start": 169, "chars": "s" }, { "char_end": 188, "char_start": 171, "chars": "\n params=[" }, { "char_end": 195, "char_start": 194, "chars": "]" }, { "char_end": 247, "char_start": 240, "chars": ",params" } ], "deleted": [ { "char_end": 170, "char_start": 169, "chars": "d" }, { "char_end": 173, "char_start": 171, "chars": "%(" }, { "char_end": 180, "char_start": 179, "chars": ")" } ] }, "commit_link": "github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9", "file_name": "modules/post.py", "func_name": "getPostsByPostid", "line_changes": { "added": [ { "char_end": 172, "char_start": 111, "line": " users.userid=post.userid and post.postid=%s\"\n", "line_no": 3 }, { "char_end": 196, "char_start": 172, "line": " params=[postid]\n", "line_no": 4 }, { "char_end": 249, "char_start": 196, "line": " result=sql.queryDB(self.conn,sqlText,params)\n", "line_no": 5 } ], "deleted": [ { "char_end": 181, "char_start": 111, "line": " users.userid=post.userid and post.postid=%d\"%(postid)\n", "line_no": 3 }, { "char_end": 227, "char_start": 181, "line": " result=sql.queryDB(self.conn,sqlText)\n", "line_no": 4 } ] }, "vul_type": "cwe-089" }
195
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def getFileCacheID(self, pth):\n\t\t\"\"\"\n\t\tReturns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.\n\t\t:param pth:\n\t\t:return:\n\t\t\"\"\"", "\t\tcommand = \"SELECT file_id FROM {0} WHERE path='{1}'\".format(TABLE_NAME, pth)\n\t\tdata = self._run_command(command)", "\n\t\ttry:\n\t\t\tdata = data[0][0]\n\t\texcept IndexError:\n\t\t\tdata = None", "\t\treturn data" ]
[ 1, 0, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 218, "char_start": 216, "chars": "?;" }, { "char_end": 247, "char_start": 237, "chars": ")\n\t\tparams" }, { "char_end": 251, "char_start": 248, "chars": "= (" }, { "char_end": 255, "char_start": 254, "chars": "," }, { "char_end": 299, "char_start": 291, "chars": ", params" } ], "deleted": [ { "char_end": 221, "char_start": 216, "chars": "'{1}'" }, { "char_end": 241, "char_start": 240, "chars": "," } ] }, "commit_link": "github.com/Highstaker/Picture-sender-telegram-bot/commit/db4bc6adb41e086418761426ff4958a81c30adca", "file_name": "file_db.py", "func_name": "getFileCacheID", "line_changes": { "added": [ { "char_end": 239, "char_start": 168, "line": "\t\tcommand = \"SELECT file_id FROM {0} WHERE path=?;\".format(TABLE_NAME)\n", "line_no": 7 }, { "char_end": 257, "char_start": 239, "line": "\t\tparams = (pth,)\n", "line_no": 8 }, { "char_end": 301, "char_start": 257, "line": "\t\tdata = self._run_command(command, params)\n", "line_no": 9 } ], "deleted": [ { "char_end": 247, "char_start": 168, "line": "\t\tcommand = \"SELECT file_id FROM {0} WHERE path='{1}'\".format(TABLE_NAME, pth)\n", "line_no": 7 }, { "char_end": 283, "char_start": 247, "line": "\t\tdata = self._run_command(command)\n", "line_no": 8 } ] }, "vul_type": "cwe-089" }
196
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def getFileCacheID(self, pth):\n\t\t\"\"\"\n\t\tReturns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.\n\t\t:param pth:\n\t\t:return:\n\t\t\"\"\"", "\t\tcommand = \"SELECT file_id FROM {0} WHERE path=?;\".format(TABLE_NAME)\n\t\tparams = (pth,)\n\t\tdata = self._run_command(command, params)", "\n\t\ttry:\n\t\t\tdata = data[0][0]\n\t\texcept IndexError:\n\t\t\tdata = None", "\t\treturn data" ]
[ 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 218, "char_start": 216, "chars": "?;" }, { "char_end": 247, "char_start": 237, "chars": ")\n\t\tparams" }, { "char_end": 251, "char_start": 248, "chars": "= (" }, { "char_end": 255, "char_start": 254, "chars": "," }, { "char_end": 299, "char_start": 291, "chars": ", params" } ], "deleted": [ { "char_end": 221, "char_start": 216, "chars": "'{1}'" }, { "char_end": 241, "char_start": 240, "chars": "," } ] }, "commit_link": "github.com/Highstaker/Picture-sender-telegram-bot/commit/db4bc6adb41e086418761426ff4958a81c30adca", "file_name": "file_db.py", "func_name": "getFileCacheID", "line_changes": { "added": [ { "char_end": 239, "char_start": 168, "line": "\t\tcommand = \"SELECT file_id FROM {0} WHERE path=?;\".format(TABLE_NAME)\n", "line_no": 7 }, { "char_end": 257, "char_start": 239, "line": "\t\tparams = (pth,)\n", "line_no": 8 }, { "char_end": 301, "char_start": 257, "line": "\t\tdata = self._run_command(command, params)\n", "line_no": 9 } ], "deleted": [ { "char_end": 247, "char_start": 168, "line": "\t\tcommand = \"SELECT file_id FROM {0} WHERE path='{1}'\".format(TABLE_NAME, pth)\n", "line_no": 7 }, { "char_end": 283, "char_start": 247, "line": "\t\tdata = self._run_command(command)\n", "line_no": 8 } ] }, "vul_type": "cwe-089" }
196
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n db = psycopg2.connect(database=DBNAME)\n c = db.cursor()", " c.execute(\"insert into posts values('%s')\" % content)", " db.commit()\n db.close()" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 191, "char_start": 189, "chars": ",(" }, { "char_end": 200, "char_start": 198, "chars": ",)" } ], "deleted": [ { "char_end": 186, "char_start": 185, "chars": "'" }, { "char_end": 189, "char_start": 188, "chars": "'" }, { "char_end": 194, "char_start": 191, "chars": " % " } ] }, "commit_link": "github.com/tfalbo/SuzyMakeup/commit/1a5d6ccf02bec303d454f87a6bb39baed30c205f", "file_name": "vagrant/forum/forumdb.py", "func_name": "add_post", "line_changes": { "added": [ { "char_end": 202, "char_start": 147, "line": " c.execute(\"insert into posts values(%s)\",(content,))\n", "line_no": 5 } ], "deleted": [ { "char_end": 203, "char_start": 147, "line": " c.execute(\"insert into posts values('%s')\" % content)\n", "line_no": 5 } ] }, "vul_type": "cwe-089" }
197
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n db = psycopg2.connect(database=DBNAME)\n c = db.cursor()", " c.execute(\"insert into posts values(%s)\",(content,))", " db.commit()\n db.close()" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 191, "char_start": 189, "chars": ",(" }, { "char_end": 200, "char_start": 198, "chars": ",)" } ], "deleted": [ { "char_end": 186, "char_start": 185, "chars": "'" }, { "char_end": 189, "char_start": 188, "chars": "'" }, { "char_end": 194, "char_start": 191, "chars": " % " } ] }, "commit_link": "github.com/tfalbo/SuzyMakeup/commit/1a5d6ccf02bec303d454f87a6bb39baed30c205f", "file_name": "vagrant/forum/forumdb.py", "func_name": "add_post", "line_changes": { "added": [ { "char_end": 202, "char_start": 147, "line": " c.execute(\"insert into posts values(%s)\",(content,))\n", "line_no": 5 } ], "deleted": [ { "char_end": 203, "char_start": 147, "line": " c.execute(\"insert into posts values('%s')\" % content)\n", "line_no": 5 } ] }, "vul_type": "cwe-089" }
197
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def getSubmissionDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()", " return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = '\" + str(submission.id) + \"'\").fetchone()[0]", " database.close()" ]
[ 1, 0, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 208, "char_start": 207, "chars": "?" }, { "char_end": 210, "char_start": 209, "chars": "," }, { "char_end": 212, "char_start": 211, "chars": "[" }, { "char_end": 231, "char_start": 230, "chars": "]" } ], "deleted": [ { "char_end": 208, "char_start": 207, "chars": "'" }, { "char_end": 211, "char_start": 209, "chars": " +" }, { "char_end": 236, "char_start": 230, "chars": " + \"'\"" } ] }, "commit_link": "github.com/LiquidFun/Reddit-GeoGuessr-Tracking-Bot/commit/0cad2d52e24b05da32789fbc8face7a9999a71f9", "file_name": "CheckAndPostForSeriesSubmissions.py", "func_name": "getSubmissionDateFromDatabase", "line_changes": { "added": [ { "char_end": 247, "char_start": 124, "line": " return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = ?\", [str(submission.id)]).fetchone()[0]\n", "line_no": 4 } ], "deleted": [ { "char_end": 252, "char_start": 124, "line": " return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = '\" + str(submission.id) + \"'\").fetchone()[0]\n", "line_no": 4 } ] }, "vul_type": "cwe-089" }
198
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "def getSubmissionDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()", " return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = ?\", [str(submission.id)]).fetchone()[0]", " database.close()" ]
[ 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 208, "char_start": 207, "chars": "?" }, { "char_end": 210, "char_start": 209, "chars": "," }, { "char_end": 212, "char_start": 211, "chars": "[" }, { "char_end": 231, "char_start": 230, "chars": "]" } ], "deleted": [ { "char_end": 208, "char_start": 207, "chars": "'" }, { "char_end": 211, "char_start": 209, "chars": " +" }, { "char_end": 236, "char_start": 230, "chars": " + \"'\"" } ] }, "commit_link": "github.com/LiquidFun/Reddit-GeoGuessr-Tracking-Bot/commit/0cad2d52e24b05da32789fbc8face7a9999a71f9", "file_name": "CheckAndPostForSeriesSubmissions.py", "func_name": "getSubmissionDateFromDatabase", "line_changes": { "added": [ { "char_end": 247, "char_start": 124, "line": " return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = ?\", [str(submission.id)]).fetchone()[0]\n", "line_no": 4 } ], "deleted": [ { "char_end": 252, "char_start": 124, "line": " return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = '\" + str(submission.id) + \"'\").fetchone()[0]\n", "line_no": 4 } ] }, "vul_type": "cwe-089" }
198
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "@endpoints.route(\"/ranks\")\ndef ranks():\n if db == None:\n init()", " scene = request.args.get('scene', default='austin')\n date = request.args.get('date')\n \n # If no date was provided, pick the date of the latest tournament\n if date == None:", " sql = \"SELECT distinct date FROM ranks WHERE scene='{}' ORDER BY date DESC LIMIT 1;\".format(scene)\n res = db.exec(sql)", " date = res[0][0]", " # Get all the urls that this player has participated in", " sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, date)\n res = db.exec(sql)", "\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n cur_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]", " cur_ranks[tag] = rank", " # Now get the ranks from last month, so we know if these players went up or down\n y, m, d = date.split('-')\n prev_date = bracket_utils.get_previous_month(date)", " # Get all the urls that this player has participated in", " sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, prev_date)\n res = db.exec(sql)", "\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n prev_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]", " prev_ranks[tag] = rank", " return render_template('libraries/html/ranks.html', cur_ranks=cur_ranks, prev_ranks=prev_ranks, scene=scene, date=date)" ]
[ 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 326, "char_start": 321, "chars": "scene" }, { "char_end": 366, "char_start": 357, "chars": "\n " }, { "char_end": 375, "char_start": 367, "chars": "rgs = {'" }, { "char_end": 389, "char_start": 380, "chars": "': scene}" }, { "char_end": 421, "char_start": 415, "chars": ", args" }, { "char_end": 561, "char_start": 556, "chars": "scene" }, { "char_end": 579, "char_start": 575, "chars": "date" }, { "char_end": 587, "char_start": 582, "chars": "\n " }, { "char_end": 604, "char_start": 588, "chars": "rgs = {'scene': " }, { "char_end": 612, "char_start": 611, "chars": "'" }, { "char_end": 624, "char_start": 616, "chars": "': date}" }, { "char_end": 652, "char_start": 646, "chars": ", args" }, { "char_end": 1112, "char_start": 1107, "chars": "scene" }, { "char_end": 1130, "char_start": 1126, "chars": "date" }, { "char_end": 1138, "char_start": 1133, "chars": "\n " }, { "char_end": 1155, "char_start": 1139, "chars": "rgs = {'scene': " }, { "char_end": 1170, "char_start": 1162, "chars": "'date': " }, { "char_end": 1180, "char_start": 1179, "chars": "}" }, { "char_end": 1208, "char_start": 1202, "chars": ", args" } ], "deleted": [ { "char_end": 355, "char_start": 352, "chars": ".fo" }, { "char_end": 360, "char_start": 356, "chars": "mat(" }, { "char_end": 366, "char_start": 365, "chars": ")" }, { "char_end": 547, "char_start": 544, "chars": ".fo" }, { "char_end": 552, "char_start": 548, "chars": "mat(" }, { "char_end": 564, "char_start": 563, "chars": ")" }, { "char_end": 1061, "char_start": 1058, "chars": ".fo" }, { "char_end": 1066, "char_start": 1062, "chars": "mat(" }, { "char_end": 1083, "char_start": 1082, "chars": ")" } ] }, "commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63", "file_name": "endpoints.py", "func_name": "ranks", "line_changes": { "added": [ { "char_end": 358, "char_start": 260, "line": " sql = \"SELECT distinct date FROM ranks WHERE scene='{scene}' ORDER BY date DESC LIMIT 1;\"\n", "line_no": 11 }, { "char_end": 390, "char_start": 358, "line": " args = {'scene': scene}\n", "line_no": 12 }, { "char_end": 423, "char_start": 390, "line": " res = db.exec(sql, args)\n", "line_no": 13 }, { "char_end": 583, "char_start": 509, "line": " sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n", "line_no": 17 }, { "char_end": 625, "char_start": 583, "line": " args = {'scene': scene, 'date': date}\n", "line_no": 18 }, { "char_end": 654, "char_start": 625, "line": " res = db.exec(sql, args)\n", "line_no": 19 }, { "char_end": 1134, "char_start": 1060, "line": " sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n", "line_no": 35 }, { "char_end": 1181, "char_start": 1134, "line": " args = {'scene': scene, 'date': prev_date}\n", "line_no": 36 }, { "char_end": 1210, "char_start": 1181, "line": " res = db.exec(sql, args)\n", "line_no": 37 } ], "deleted": [ { "char_end": 367, "char_start": 260, "line": " sql = \"SELECT distinct date FROM ranks WHERE scene='{}' ORDER BY date DESC LIMIT 1;\".format(scene)\n", "line_no": 11 }, { "char_end": 394, "char_start": 367, "line": " res = db.exec(sql)\n", "line_no": 12 }, { "char_end": 565, "char_start": 480, "line": " sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, date)\n", "line_no": 16 }, { "char_end": 588, "char_start": 565, "line": " res = db.exec(sql)\n", "line_no": 17 }, { "char_end": 1084, "char_start": 994, "line": " sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, prev_date)\n", "line_no": 33 }, { "char_end": 1107, "char_start": 1084, "line": " res = db.exec(sql)\n", "line_no": 34 } ] }, "vul_type": "cwe-089" }
199
cwe-089
py
Determine whether the {function_name} code is vulnerable or not.
[ "@endpoints.route(\"/ranks\")\ndef ranks():\n if db == None:\n init()", " scene = request.args.get('scene', default='austin')\n date = request.args.get('date')\n \n # If no date was provided, pick the date of the latest tournament\n if date == None:", " sql = \"SELECT distinct date FROM ranks WHERE scene='{scene}' ORDER BY date DESC LIMIT 1;\"\n args = {'scene': scene}\n res = db.exec(sql, args)", " date = res[0][0]", " # Get all the urls that this player has participated in", " sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n args = {'scene': scene, 'date': date}\n res = db.exec(sql, args)", "\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n cur_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]", " cur_ranks[tag] = rank", " # Now get the ranks from last month, so we know if these players went up or down\n y, m, d = date.split('-')\n prev_date = bracket_utils.get_previous_month(date)", " # Get all the urls that this player has participated in", " sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n args = {'scene': scene, 'date': prev_date}\n res = db.exec(sql, args)", "\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n prev_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]", " prev_ranks[tag] = rank", " return render_template('libraries/html/ranks.html', cur_ranks=cur_ranks, prev_ranks=prev_ranks, scene=scene, date=date)" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
SVEN
{ "char_changes": { "added": [ { "char_end": 326, "char_start": 321, "chars": "scene" }, { "char_end": 366, "char_start": 357, "chars": "\n " }, { "char_end": 375, "char_start": 367, "chars": "rgs = {'" }, { "char_end": 389, "char_start": 380, "chars": "': scene}" }, { "char_end": 421, "char_start": 415, "chars": ", args" }, { "char_end": 561, "char_start": 556, "chars": "scene" }, { "char_end": 579, "char_start": 575, "chars": "date" }, { "char_end": 587, "char_start": 582, "chars": "\n " }, { "char_end": 604, "char_start": 588, "chars": "rgs = {'scene': " }, { "char_end": 612, "char_start": 611, "chars": "'" }, { "char_end": 624, "char_start": 616, "chars": "': date}" }, { "char_end": 652, "char_start": 646, "chars": ", args" }, { "char_end": 1112, "char_start": 1107, "chars": "scene" }, { "char_end": 1130, "char_start": 1126, "chars": "date" }, { "char_end": 1138, "char_start": 1133, "chars": "\n " }, { "char_end": 1155, "char_start": 1139, "chars": "rgs = {'scene': " }, { "char_end": 1170, "char_start": 1162, "chars": "'date': " }, { "char_end": 1180, "char_start": 1179, "chars": "}" }, { "char_end": 1208, "char_start": 1202, "chars": ", args" } ], "deleted": [ { "char_end": 355, "char_start": 352, "chars": ".fo" }, { "char_end": 360, "char_start": 356, "chars": "mat(" }, { "char_end": 366, "char_start": 365, "chars": ")" }, { "char_end": 547, "char_start": 544, "chars": ".fo" }, { "char_end": 552, "char_start": 548, "chars": "mat(" }, { "char_end": 564, "char_start": 563, "chars": ")" }, { "char_end": 1061, "char_start": 1058, "chars": ".fo" }, { "char_end": 1066, "char_start": 1062, "chars": "mat(" }, { "char_end": 1083, "char_start": 1082, "chars": ")" } ] }, "commit_link": "github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63", "file_name": "endpoints.py", "func_name": "ranks", "line_changes": { "added": [ { "char_end": 358, "char_start": 260, "line": " sql = \"SELECT distinct date FROM ranks WHERE scene='{scene}' ORDER BY date DESC LIMIT 1;\"\n", "line_no": 11 }, { "char_end": 390, "char_start": 358, "line": " args = {'scene': scene}\n", "line_no": 12 }, { "char_end": 423, "char_start": 390, "line": " res = db.exec(sql, args)\n", "line_no": 13 }, { "char_end": 583, "char_start": 509, "line": " sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n", "line_no": 17 }, { "char_end": 625, "char_start": 583, "line": " args = {'scene': scene, 'date': date}\n", "line_no": 18 }, { "char_end": 654, "char_start": 625, "line": " res = db.exec(sql, args)\n", "line_no": 19 }, { "char_end": 1134, "char_start": 1060, "line": " sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n", "line_no": 35 }, { "char_end": 1181, "char_start": 1134, "line": " args = {'scene': scene, 'date': prev_date}\n", "line_no": 36 }, { "char_end": 1210, "char_start": 1181, "line": " res = db.exec(sql, args)\n", "line_no": 37 } ], "deleted": [ { "char_end": 367, "char_start": 260, "line": " sql = \"SELECT distinct date FROM ranks WHERE scene='{}' ORDER BY date DESC LIMIT 1;\".format(scene)\n", "line_no": 11 }, { "char_end": 394, "char_start": 367, "line": " res = db.exec(sql)\n", "line_no": 12 }, { "char_end": 565, "char_start": 480, "line": " sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, date)\n", "line_no": 16 }, { "char_end": 588, "char_start": 565, "line": " res = db.exec(sql)\n", "line_no": 17 }, { "char_end": 1084, "char_start": 994, "line": " sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, prev_date)\n", "line_no": 33 }, { "char_end": 1107, "char_start": 1084, "line": " res = db.exec(sql)\n", "line_no": 34 } ] }, "vul_type": "cwe-089" }
199
cwe-089
py