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 _find_host_exhaustive(self, connector, hosts):\n for host in hosts:",
" ssh_cmd = 'svcinfo lshost -delim ! %s' % host",
" out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()),\n '_find_host_exhaustive',\n ssh_cmd, out, err)\n for attr_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attr_name, foo, attr_val = attr_line.partition('!')\n if (attr_name == 'iscsi_name' and\n 'initiator' in connector and\n attr_val == connector['initiator']):\n return host\n elif (attr_name == 'WWPN' and\n 'wwpns' in connector and\n attr_val.lower() in\n map(str.lower, map(str, connector['wwpns']))):\n return host\n return None"
] |
[
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 105,
"char_start": 104,
"chars": "["
},
{
"char_end": 115,
"char_start": 113,
"chars": "',"
},
{
"char_end": 117,
"char_start": 116,
"chars": "'"
},
{
"char_end": 125,
"char_start": 123,
"chars": "',"
},
{
"char_end": 127,
"char_start": 126,
"chars": "'"
},
{
"char_end": 135,
"char_start": 133,
"chars": "',"
},
{
"char_end": 137,
"char_start": 136,
"chars": "'"
},
{
"char_end": 140,
"char_start": 139,
"chars": ","
},
{
"char_end": 146,
"char_start": 145,
"chars": "]"
}
],
"deleted": [
{
"char_end": 131,
"char_start": 128,
"chars": " %s"
},
{
"char_end": 134,
"char_start": 132,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_find_host_exhaustive",
"line_changes": {
"added": [
{
"char_end": 147,
"char_start": 82,
"line": " ssh_cmd = ['svcinfo', 'lshost', '-delim', '!', host]\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 140,
"char_start": 82,
"line": " ssh_cmd = 'svcinfo lshost -delim ! %s' % host\n",
"line_no": 3
}
]
},
"vul_type": "cwe-078"
}
| 100
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _find_host_exhaustive(self, connector, hosts):\n for host in hosts:",
" ssh_cmd = ['svcinfo', 'lshost', '-delim', '!', host]",
" out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()),\n '_find_host_exhaustive',\n ssh_cmd, out, err)\n for attr_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attr_name, foo, attr_val = attr_line.partition('!')\n if (attr_name == 'iscsi_name' and\n 'initiator' in connector and\n attr_val == connector['initiator']):\n return host\n elif (attr_name == 'WWPN' and\n 'wwpns' in connector and\n attr_val.lower() in\n map(str.lower, map(str, connector['wwpns']))):\n return host\n return None"
] |
[
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 105,
"char_start": 104,
"chars": "["
},
{
"char_end": 115,
"char_start": 113,
"chars": "',"
},
{
"char_end": 117,
"char_start": 116,
"chars": "'"
},
{
"char_end": 125,
"char_start": 123,
"chars": "',"
},
{
"char_end": 127,
"char_start": 126,
"chars": "'"
},
{
"char_end": 135,
"char_start": 133,
"chars": "',"
},
{
"char_end": 137,
"char_start": 136,
"chars": "'"
},
{
"char_end": 140,
"char_start": 139,
"chars": ","
},
{
"char_end": 146,
"char_start": 145,
"chars": "]"
}
],
"deleted": [
{
"char_end": 131,
"char_start": 128,
"chars": " %s"
},
{
"char_end": 134,
"char_start": 132,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_find_host_exhaustive",
"line_changes": {
"added": [
{
"char_end": 147,
"char_start": 82,
"line": " ssh_cmd = ['svcinfo', 'lshost', '-delim', '!', host]\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 140,
"char_start": 82,
"line": " ssh_cmd = 'svcinfo lshost -delim ! %s' % host\n",
"line_no": 3
}
]
},
"vul_type": "cwe-078"
}
| 100
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _create_vdisk(self, name, size, units, opts):\n \"\"\"Create a new vdisk.\"\"\"",
" LOG.debug(_('enter: _create_vdisk: vdisk %s ') % name)",
" model_update = None",
" autoex = '-autoexpand' if opts['autoexpand'] else ''\n easytier = '-easytier on' if opts['easytier'] else '-easytier off'",
"\n # Set space-efficient options\n if opts['rsize'] == -1:",
" ssh_cmd_se_opt = ''",
" else:",
" ssh_cmd_se_opt = (\n '-rsize %(rsize)d%% %(autoex)s -warning %(warn)d%%' %\n {'rsize': opts['rsize'],\n 'autoex': autoex,\n 'warn': opts['warning']})",
" if opts['compression']:",
" ssh_cmd_se_opt = ssh_cmd_se_opt + ' -compressed'",
" else:",
" ssh_cmd_se_opt = ssh_cmd_se_opt + (\n ' -grainsize %d' % opts['grainsize'])",
"",
" ssh_cmd = ('svctask mkvdisk -name %(name)s -mdiskgrp %(mdiskgrp)s '\n '-iogrp 0 -size %(size)s -unit '\n '%(unit)s %(easytier)s %(ssh_cmd_se_opt)s'\n % {'name': name,\n 'mdiskgrp': self.configuration.storwize_svc_volpool_name,\n 'size': size, 'unit': units, 'easytier': easytier,\n 'ssh_cmd_se_opt': ssh_cmd_se_opt})",
" out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), '_create_vdisk',\n ssh_cmd, out, err)",
" # Ensure that the output is as expected\n match_obj = re.search('Virtual Disk, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('_create_vdisk %(name)s - did not find '\n 'success message in CLI output.\\n '\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'name': name, 'out': str(out), 'err': str(err)})",
" LOG.debug(_('leave: _create_vdisk: volume %s ') % name)"
] |
[
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 338,
"char_start": 336,
"chars": "[]"
},
{
"char_end": 405,
"char_start": 382,
"chars": "['-rsize', '%s%%' % str"
},
{
"char_end": 421,
"char_start": 406,
"chars": "opts['rsize']),"
},
{
"char_end": 440,
"char_start": 439,
"chars": " "
},
{
"char_end": 454,
"char_start": 441,
"chars": " '-"
},
{
"char_end": 466,
"char_start": 460,
"chars": "pand',"
},
{
"char_end": 468,
"char_start": 467,
"chars": "'"
},
{
"char_end": 478,
"char_start": 477,
"chars": ","
},
{
"char_end": 509,
"char_start": 495,
"chars": " "
},
{
"char_end": 511,
"char_start": 510,
"chars": "%"
},
{
"char_end": 514,
"char_start": 512,
"chars": "%%"
},
{
"char_end": 517,
"char_start": 515,
"chars": " %"
},
{
"char_end": 522,
"char_start": 518,
"chars": "str("
},
{
"char_end": 530,
"char_start": 528,
"chars": "wa"
},
{
"char_end": 532,
"char_start": 531,
"chars": "n"
},
{
"char_end": 535,
"char_start": 533,
"chars": "ng"
},
{
"char_end": 539,
"char_start": 537,
"chars": ")]"
},
{
"char_end": 554,
"char_start": 552,
"chars": "if"
},
{
"char_end": 558,
"char_start": 555,
"chars": "not"
},
{
"char_end": 564,
"char_start": 559,
"chars": "opts["
},
{
"char_end": 575,
"char_start": 571,
"chars": "pand"
},
{
"char_end": 577,
"char_start": 576,
"chars": "]"
},
{
"char_end": 606,
"char_start": 595,
"chars": "ssh_cmd_se_"
},
{
"char_end": 617,
"char_start": 609,
"chars": ".remove("
},
{
"char_end": 619,
"char_start": 618,
"chars": "-"
},
{
"char_end": 627,
"char_start": 620,
"chars": "utoexpa"
},
{
"char_end": 629,
"char_start": 628,
"chars": "d"
},
{
"char_end": 632,
"char_start": 631,
"chars": "\n"
},
{
"char_end": 705,
"char_start": 699,
"chars": ".appen"
},
{
"char_end": 707,
"char_start": 706,
"chars": "("
},
{
"char_end": 721,
"char_start": 720,
"chars": ")"
},
{
"char_end": 771,
"char_start": 770,
"chars": "."
},
{
"char_end": 773,
"char_start": 772,
"chars": "x"
},
{
"char_end": 777,
"char_start": 774,
"chars": "end"
},
{
"char_end": 779,
"char_start": 778,
"chars": "["
},
{
"char_end": 792,
"char_start": 791,
"chars": ","
},
{
"char_end": 797,
"char_start": 793,
"chars": "str("
},
{
"char_end": 815,
"char_start": 813,
"chars": "])"
},
{
"char_end": 838,
"char_start": 837,
"chars": "["
},
{
"char_end": 848,
"char_start": 846,
"chars": "',"
},
{
"char_end": 850,
"char_start": 849,
"chars": "'"
},
{
"char_end": 859,
"char_start": 857,
"chars": "',"
},
{
"char_end": 861,
"char_start": 860,
"chars": "'"
},
{
"char_end": 868,
"char_start": 866,
"chars": "',"
},
{
"char_end": 874,
"char_start": 873,
"chars": ","
},
{
"char_end": 876,
"char_start": 875,
"chars": "'"
},
{
"char_end": 989,
"char_start": 973,
"chars": "-iogrp', '0', '-"
},
{
"char_end": 995,
"char_start": 994,
"chars": ","
},
{
"char_end": 1004,
"char_start": 1003,
"chars": "-"
},
{
"char_end": 1029,
"char_start": 1009,
"chars": ",\n "
},
{
"char_end": 1039,
"char_start": 1038,
"chars": "-"
},
{
"char_end": 1049,
"char_start": 1048,
"chars": ","
},
{
"char_end": 1059,
"char_start": 1058,
"chars": "]"
},
{
"char_end": 1061,
"char_start": 1060,
"chars": "+"
}
],
"deleted": [
{
"char_end": 250,
"char_start": 189,
"chars": "autoex = '-autoexpand' if opts['autoexpand'] else ''\n "
},
{
"char_end": 272,
"char_start": 262,
"chars": "-easytier "
},
{
"char_end": 312,
"char_start": 302,
"chars": "-easytier "
},
{
"char_end": 419,
"char_start": 417,
"chars": "''"
},
{
"char_end": 503,
"char_start": 483,
"chars": "rsize %(rsize)d%% %("
},
{
"char_end": 511,
"char_start": 509,
"chars": ")s"
},
{
"char_end": 535,
"char_start": 521,
"chars": "%(warn)d%%' %\n"
},
{
"char_end": 552,
"char_start": 551,
"chars": "{"
},
{
"char_end": 554,
"char_start": 553,
"chars": "r"
},
{
"char_end": 558,
"char_start": 555,
"chars": "ize"
},
{
"char_end": 560,
"char_start": 559,
"chars": ":"
},
{
"char_end": 569,
"char_start": 568,
"chars": "s"
},
{
"char_end": 572,
"char_start": 570,
"chars": "ze"
},
{
"char_end": 575,
"char_start": 574,
"chars": ","
},
{
"char_end": 593,
"char_start": 590,
"chars": " "
},
{
"char_end": 610,
"char_start": 602,
"chars": " autoex,"
},
{
"char_end": 628,
"char_start": 627,
"chars": " "
},
{
"char_end": 630,
"char_start": 629,
"chars": "w"
},
{
"char_end": 636,
"char_start": 631,
"chars": "rn': "
},
{
"char_end": 643,
"char_start": 638,
"chars": "ts['w"
},
{
"char_end": 645,
"char_start": 644,
"chars": "r"
},
{
"char_end": 649,
"char_start": 646,
"chars": "ing"
},
{
"char_end": 652,
"char_start": 650,
"chars": "]}"
},
{
"char_end": 735,
"char_start": 720,
"chars": " = ssh_cmd_se_o"
},
{
"char_end": 740,
"char_start": 736,
"chars": "t + "
},
{
"char_end": 742,
"char_start": 741,
"chars": " "
},
{
"char_end": 815,
"char_start": 803,
"chars": " = ssh_cmd_s"
},
{
"char_end": 819,
"char_start": 816,
"chars": "_op"
},
{
"char_end": 823,
"char_start": 820,
"chars": " + "
},
{
"char_end": 845,
"char_start": 824,
"chars": "\n "
},
{
"char_end": 847,
"char_start": 846,
"chars": " "
},
{
"char_end": 860,
"char_start": 857,
"chars": " %d"
},
{
"char_end": 864,
"char_start": 862,
"chars": "% "
},
{
"char_end": 903,
"char_start": 902,
"chars": "("
},
{
"char_end": 928,
"char_start": 926,
"chars": "%("
},
{
"char_end": 934,
"char_start": 932,
"chars": ")s"
},
{
"char_end": 958,
"char_start": 944,
"chars": " %(mdiskgrp)s "
},
{
"char_end": 1108,
"char_start": 959,
"chars": "\n '-iogrp 0 -size %(size)s -unit '\n '%(unit)s %(easytier)s %(ssh_cmd_se_opt)s'\n % {'name': name"
},
{
"char_end": 1140,
"char_start": 1128,
"chars": " 'mdiskgrp':"
},
{
"char_end": 1213,
"char_start": 1212,
"chars": ":"
},
{
"char_end": 1227,
"char_start": 1226,
"chars": ":"
},
{
"char_end": 1246,
"char_start": 1245,
"chars": ":"
},
{
"char_end": 1275,
"char_start": 1255,
"chars": ",\n "
},
{
"char_end": 1293,
"char_start": 1276,
"chars": "'ssh_cmd_se_opt':"
},
{
"char_end": 1310,
"char_start": 1308,
"chars": "})"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_create_vdisk",
"line_changes": {
"added": [
{
"char_end": 236,
"char_start": 181,
"line": " easytier = 'on' if opts['easytier'] else 'off'\n",
"line_no": 7
},
{
"char_end": 339,
"char_start": 307,
"line": " ssh_cmd_se_opt = []\n",
"line_no": 11
},
{
"char_end": 422,
"char_start": 353,
"line": " ssh_cmd_se_opt = ['-rsize', '%s%%' % str(opts['rsize']),\n",
"line_no": 13
},
{
"char_end": 479,
"char_start": 422,
"line": " '-autoexpand', '-warning',\n",
"line_no": 14
},
{
"char_end": 540,
"char_start": 479,
"line": " '%s%%' % str(opts['warning'])]\n",
"line_no": 15
},
{
"char_end": 579,
"char_start": 540,
"line": " if not opts['autoexpand']:\n",
"line_no": 16
},
{
"char_end": 632,
"char_start": 579,
"line": " ssh_cmd_se_opt.remove('-autoexpand')\n",
"line_no": 17
},
{
"char_end": 633,
"char_start": 632,
"line": "\n",
"line_no": 18
},
{
"char_end": 722,
"char_start": 669,
"line": " ssh_cmd_se_opt.append('-compressed')\n",
"line_no": 20
},
{
"char_end": 818,
"char_start": 740,
"line": " ssh_cmd_se_opt.extend(['-grainsize', str(opts['grainsize'])])\n",
"line_no": 22
},
{
"char_end": 819,
"char_start": 818,
"line": "\n",
"line_no": 23
},
{
"char_end": 888,
"char_start": 819,
"line": " ssh_cmd = ['svctask', 'mkvdisk', '-name', name, '-mdiskgrp',\n",
"line_no": 24
},
{
"char_end": 953,
"char_start": 888,
"line": " self.configuration.storwize_svc_volpool_name,\n",
"line_no": 25
},
{
"char_end": 1011,
"char_start": 953,
"line": " '-iogrp', '0', '-size', size, '-unit',\n",
"line_no": 26
},
{
"char_end": 1077,
"char_start": 1011,
"line": " units, '-easytier', easytier] + ssh_cmd_se_opt\n",
"line_no": 27
}
],
"deleted": [
{
"char_end": 242,
"char_start": 181,
"line": " autoex = '-autoexpand' if opts['autoexpand'] else ''\n",
"line_no": 7
},
{
"char_end": 317,
"char_start": 242,
"line": " easytier = '-easytier on' if opts['easytier'] else '-easytier off'\n",
"line_no": 8
},
{
"char_end": 420,
"char_start": 388,
"line": " ssh_cmd_se_opt = ''\n",
"line_no": 12
},
{
"char_end": 465,
"char_start": 434,
"line": " ssh_cmd_se_opt = (\n",
"line_no": 14
},
{
"char_end": 535,
"char_start": 465,
"line": " '-rsize %(rsize)d%% %(autoex)s -warning %(warn)d%%' %\n",
"line_no": 15
},
{
"char_end": 576,
"char_start": 535,
"line": " {'rsize': opts['rsize'],\n",
"line_no": 16
},
{
"char_end": 611,
"char_start": 576,
"line": " 'autoex': autoex,\n",
"line_no": 17
},
{
"char_end": 654,
"char_start": 611,
"line": " 'warn': opts['warning']})\n",
"line_no": 18
},
{
"char_end": 755,
"char_start": 690,
"line": " ssh_cmd_se_opt = ssh_cmd_se_opt + ' -compressed'\n",
"line_no": 20
},
{
"char_end": 825,
"char_start": 773,
"line": " ssh_cmd_se_opt = ssh_cmd_se_opt + (\n",
"line_no": 22
},
{
"char_end": 883,
"char_start": 825,
"line": " ' -grainsize %d' % opts['grainsize'])\n",
"line_no": 23
},
{
"char_end": 884,
"char_start": 883,
"line": "\n",
"line_no": 24
},
{
"char_end": 960,
"char_start": 884,
"line": " ssh_cmd = ('svctask mkvdisk -name %(name)s -mdiskgrp %(mdiskgrp)s '\n",
"line_no": 25
},
{
"char_end": 1012,
"char_start": 960,
"line": " '-iogrp 0 -size %(size)s -unit '\n",
"line_no": 26
},
{
"char_end": 1074,
"char_start": 1012,
"line": " '%(unit)s %(easytier)s %(ssh_cmd_se_opt)s'\n",
"line_no": 27
},
{
"char_end": 1110,
"char_start": 1074,
"line": " % {'name': name,\n",
"line_no": 28
},
{
"char_end": 1187,
"char_start": 1110,
"line": " 'mdiskgrp': self.configuration.storwize_svc_volpool_name,\n",
"line_no": 29
},
{
"char_end": 1257,
"char_start": 1187,
"line": " 'size': size, 'unit': units, 'easytier': easytier,\n",
"line_no": 30
},
{
"char_end": 1311,
"char_start": 1257,
"line": " 'ssh_cmd_se_opt': ssh_cmd_se_opt})\n",
"line_no": 31
}
]
},
"vul_type": "cwe-078"
}
| 101
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _create_vdisk(self, name, size, units, opts):\n \"\"\"Create a new vdisk.\"\"\"",
" LOG.debug(_('enter: _create_vdisk: vdisk %s ') % name)",
" model_update = None",
" easytier = 'on' if opts['easytier'] else 'off'",
"\n # Set space-efficient options\n if opts['rsize'] == -1:",
" ssh_cmd_se_opt = []",
" else:",
" ssh_cmd_se_opt = ['-rsize', '%s%%' % str(opts['rsize']),\n '-autoexpand', '-warning',\n '%s%%' % str(opts['warning'])]\n if not opts['autoexpand']:\n ssh_cmd_se_opt.remove('-autoexpand')\n",
" if opts['compression']:",
" ssh_cmd_se_opt.append('-compressed')",
" else:",
" ssh_cmd_se_opt.extend(['-grainsize', str(opts['grainsize'])])",
"",
" ssh_cmd = ['svctask', 'mkvdisk', '-name', name, '-mdiskgrp',\n self.configuration.storwize_svc_volpool_name,\n '-iogrp', '0', '-size', size, '-unit',\n units, '-easytier', easytier] + ssh_cmd_se_opt",
" out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), '_create_vdisk',\n ssh_cmd, out, err)",
" # Ensure that the output is as expected\n match_obj = re.search('Virtual Disk, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('_create_vdisk %(name)s - did not find '\n 'success message in CLI output.\\n '\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'name': name, 'out': str(out), 'err': str(err)})",
" LOG.debug(_('leave: _create_vdisk: volume %s ') % name)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 338,
"char_start": 336,
"chars": "[]"
},
{
"char_end": 405,
"char_start": 382,
"chars": "['-rsize', '%s%%' % str"
},
{
"char_end": 421,
"char_start": 406,
"chars": "opts['rsize']),"
},
{
"char_end": 440,
"char_start": 439,
"chars": " "
},
{
"char_end": 454,
"char_start": 441,
"chars": " '-"
},
{
"char_end": 466,
"char_start": 460,
"chars": "pand',"
},
{
"char_end": 468,
"char_start": 467,
"chars": "'"
},
{
"char_end": 478,
"char_start": 477,
"chars": ","
},
{
"char_end": 509,
"char_start": 495,
"chars": " "
},
{
"char_end": 511,
"char_start": 510,
"chars": "%"
},
{
"char_end": 514,
"char_start": 512,
"chars": "%%"
},
{
"char_end": 517,
"char_start": 515,
"chars": " %"
},
{
"char_end": 522,
"char_start": 518,
"chars": "str("
},
{
"char_end": 530,
"char_start": 528,
"chars": "wa"
},
{
"char_end": 532,
"char_start": 531,
"chars": "n"
},
{
"char_end": 535,
"char_start": 533,
"chars": "ng"
},
{
"char_end": 539,
"char_start": 537,
"chars": ")]"
},
{
"char_end": 554,
"char_start": 552,
"chars": "if"
},
{
"char_end": 558,
"char_start": 555,
"chars": "not"
},
{
"char_end": 564,
"char_start": 559,
"chars": "opts["
},
{
"char_end": 575,
"char_start": 571,
"chars": "pand"
},
{
"char_end": 577,
"char_start": 576,
"chars": "]"
},
{
"char_end": 606,
"char_start": 595,
"chars": "ssh_cmd_se_"
},
{
"char_end": 617,
"char_start": 609,
"chars": ".remove("
},
{
"char_end": 619,
"char_start": 618,
"chars": "-"
},
{
"char_end": 627,
"char_start": 620,
"chars": "utoexpa"
},
{
"char_end": 629,
"char_start": 628,
"chars": "d"
},
{
"char_end": 632,
"char_start": 631,
"chars": "\n"
},
{
"char_end": 705,
"char_start": 699,
"chars": ".appen"
},
{
"char_end": 707,
"char_start": 706,
"chars": "("
},
{
"char_end": 721,
"char_start": 720,
"chars": ")"
},
{
"char_end": 771,
"char_start": 770,
"chars": "."
},
{
"char_end": 773,
"char_start": 772,
"chars": "x"
},
{
"char_end": 777,
"char_start": 774,
"chars": "end"
},
{
"char_end": 779,
"char_start": 778,
"chars": "["
},
{
"char_end": 792,
"char_start": 791,
"chars": ","
},
{
"char_end": 797,
"char_start": 793,
"chars": "str("
},
{
"char_end": 815,
"char_start": 813,
"chars": "])"
},
{
"char_end": 838,
"char_start": 837,
"chars": "["
},
{
"char_end": 848,
"char_start": 846,
"chars": "',"
},
{
"char_end": 850,
"char_start": 849,
"chars": "'"
},
{
"char_end": 859,
"char_start": 857,
"chars": "',"
},
{
"char_end": 861,
"char_start": 860,
"chars": "'"
},
{
"char_end": 868,
"char_start": 866,
"chars": "',"
},
{
"char_end": 874,
"char_start": 873,
"chars": ","
},
{
"char_end": 876,
"char_start": 875,
"chars": "'"
},
{
"char_end": 989,
"char_start": 973,
"chars": "-iogrp', '0', '-"
},
{
"char_end": 995,
"char_start": 994,
"chars": ","
},
{
"char_end": 1004,
"char_start": 1003,
"chars": "-"
},
{
"char_end": 1029,
"char_start": 1009,
"chars": ",\n "
},
{
"char_end": 1039,
"char_start": 1038,
"chars": "-"
},
{
"char_end": 1049,
"char_start": 1048,
"chars": ","
},
{
"char_end": 1059,
"char_start": 1058,
"chars": "]"
},
{
"char_end": 1061,
"char_start": 1060,
"chars": "+"
}
],
"deleted": [
{
"char_end": 250,
"char_start": 189,
"chars": "autoex = '-autoexpand' if opts['autoexpand'] else ''\n "
},
{
"char_end": 272,
"char_start": 262,
"chars": "-easytier "
},
{
"char_end": 312,
"char_start": 302,
"chars": "-easytier "
},
{
"char_end": 419,
"char_start": 417,
"chars": "''"
},
{
"char_end": 503,
"char_start": 483,
"chars": "rsize %(rsize)d%% %("
},
{
"char_end": 511,
"char_start": 509,
"chars": ")s"
},
{
"char_end": 535,
"char_start": 521,
"chars": "%(warn)d%%' %\n"
},
{
"char_end": 552,
"char_start": 551,
"chars": "{"
},
{
"char_end": 554,
"char_start": 553,
"chars": "r"
},
{
"char_end": 558,
"char_start": 555,
"chars": "ize"
},
{
"char_end": 560,
"char_start": 559,
"chars": ":"
},
{
"char_end": 569,
"char_start": 568,
"chars": "s"
},
{
"char_end": 572,
"char_start": 570,
"chars": "ze"
},
{
"char_end": 575,
"char_start": 574,
"chars": ","
},
{
"char_end": 593,
"char_start": 590,
"chars": " "
},
{
"char_end": 610,
"char_start": 602,
"chars": " autoex,"
},
{
"char_end": 628,
"char_start": 627,
"chars": " "
},
{
"char_end": 630,
"char_start": 629,
"chars": "w"
},
{
"char_end": 636,
"char_start": 631,
"chars": "rn': "
},
{
"char_end": 643,
"char_start": 638,
"chars": "ts['w"
},
{
"char_end": 645,
"char_start": 644,
"chars": "r"
},
{
"char_end": 649,
"char_start": 646,
"chars": "ing"
},
{
"char_end": 652,
"char_start": 650,
"chars": "]}"
},
{
"char_end": 735,
"char_start": 720,
"chars": " = ssh_cmd_se_o"
},
{
"char_end": 740,
"char_start": 736,
"chars": "t + "
},
{
"char_end": 742,
"char_start": 741,
"chars": " "
},
{
"char_end": 815,
"char_start": 803,
"chars": " = ssh_cmd_s"
},
{
"char_end": 819,
"char_start": 816,
"chars": "_op"
},
{
"char_end": 823,
"char_start": 820,
"chars": " + "
},
{
"char_end": 845,
"char_start": 824,
"chars": "\n "
},
{
"char_end": 847,
"char_start": 846,
"chars": " "
},
{
"char_end": 860,
"char_start": 857,
"chars": " %d"
},
{
"char_end": 864,
"char_start": 862,
"chars": "% "
},
{
"char_end": 903,
"char_start": 902,
"chars": "("
},
{
"char_end": 928,
"char_start": 926,
"chars": "%("
},
{
"char_end": 934,
"char_start": 932,
"chars": ")s"
},
{
"char_end": 958,
"char_start": 944,
"chars": " %(mdiskgrp)s "
},
{
"char_end": 1108,
"char_start": 959,
"chars": "\n '-iogrp 0 -size %(size)s -unit '\n '%(unit)s %(easytier)s %(ssh_cmd_se_opt)s'\n % {'name': name"
},
{
"char_end": 1140,
"char_start": 1128,
"chars": " 'mdiskgrp':"
},
{
"char_end": 1213,
"char_start": 1212,
"chars": ":"
},
{
"char_end": 1227,
"char_start": 1226,
"chars": ":"
},
{
"char_end": 1246,
"char_start": 1245,
"chars": ":"
},
{
"char_end": 1275,
"char_start": 1255,
"chars": ",\n "
},
{
"char_end": 1293,
"char_start": 1276,
"chars": "'ssh_cmd_se_opt':"
},
{
"char_end": 1310,
"char_start": 1308,
"chars": "})"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_create_vdisk",
"line_changes": {
"added": [
{
"char_end": 236,
"char_start": 181,
"line": " easytier = 'on' if opts['easytier'] else 'off'\n",
"line_no": 7
},
{
"char_end": 339,
"char_start": 307,
"line": " ssh_cmd_se_opt = []\n",
"line_no": 11
},
{
"char_end": 422,
"char_start": 353,
"line": " ssh_cmd_se_opt = ['-rsize', '%s%%' % str(opts['rsize']),\n",
"line_no": 13
},
{
"char_end": 479,
"char_start": 422,
"line": " '-autoexpand', '-warning',\n",
"line_no": 14
},
{
"char_end": 540,
"char_start": 479,
"line": " '%s%%' % str(opts['warning'])]\n",
"line_no": 15
},
{
"char_end": 579,
"char_start": 540,
"line": " if not opts['autoexpand']:\n",
"line_no": 16
},
{
"char_end": 632,
"char_start": 579,
"line": " ssh_cmd_se_opt.remove('-autoexpand')\n",
"line_no": 17
},
{
"char_end": 633,
"char_start": 632,
"line": "\n",
"line_no": 18
},
{
"char_end": 722,
"char_start": 669,
"line": " ssh_cmd_se_opt.append('-compressed')\n",
"line_no": 20
},
{
"char_end": 818,
"char_start": 740,
"line": " ssh_cmd_se_opt.extend(['-grainsize', str(opts['grainsize'])])\n",
"line_no": 22
},
{
"char_end": 819,
"char_start": 818,
"line": "\n",
"line_no": 23
},
{
"char_end": 888,
"char_start": 819,
"line": " ssh_cmd = ['svctask', 'mkvdisk', '-name', name, '-mdiskgrp',\n",
"line_no": 24
},
{
"char_end": 953,
"char_start": 888,
"line": " self.configuration.storwize_svc_volpool_name,\n",
"line_no": 25
},
{
"char_end": 1011,
"char_start": 953,
"line": " '-iogrp', '0', '-size', size, '-unit',\n",
"line_no": 26
},
{
"char_end": 1077,
"char_start": 1011,
"line": " units, '-easytier', easytier] + ssh_cmd_se_opt\n",
"line_no": 27
}
],
"deleted": [
{
"char_end": 242,
"char_start": 181,
"line": " autoex = '-autoexpand' if opts['autoexpand'] else ''\n",
"line_no": 7
},
{
"char_end": 317,
"char_start": 242,
"line": " easytier = '-easytier on' if opts['easytier'] else '-easytier off'\n",
"line_no": 8
},
{
"char_end": 420,
"char_start": 388,
"line": " ssh_cmd_se_opt = ''\n",
"line_no": 12
},
{
"char_end": 465,
"char_start": 434,
"line": " ssh_cmd_se_opt = (\n",
"line_no": 14
},
{
"char_end": 535,
"char_start": 465,
"line": " '-rsize %(rsize)d%% %(autoex)s -warning %(warn)d%%' %\n",
"line_no": 15
},
{
"char_end": 576,
"char_start": 535,
"line": " {'rsize': opts['rsize'],\n",
"line_no": 16
},
{
"char_end": 611,
"char_start": 576,
"line": " 'autoex': autoex,\n",
"line_no": 17
},
{
"char_end": 654,
"char_start": 611,
"line": " 'warn': opts['warning']})\n",
"line_no": 18
},
{
"char_end": 755,
"char_start": 690,
"line": " ssh_cmd_se_opt = ssh_cmd_se_opt + ' -compressed'\n",
"line_no": 20
},
{
"char_end": 825,
"char_start": 773,
"line": " ssh_cmd_se_opt = ssh_cmd_se_opt + (\n",
"line_no": 22
},
{
"char_end": 883,
"char_start": 825,
"line": " ' -grainsize %d' % opts['grainsize'])\n",
"line_no": 23
},
{
"char_end": 884,
"char_start": 883,
"line": "\n",
"line_no": 24
},
{
"char_end": 960,
"char_start": 884,
"line": " ssh_cmd = ('svctask mkvdisk -name %(name)s -mdiskgrp %(mdiskgrp)s '\n",
"line_no": 25
},
{
"char_end": 1012,
"char_start": 960,
"line": " '-iogrp 0 -size %(size)s -unit '\n",
"line_no": 26
},
{
"char_end": 1074,
"char_start": 1012,
"line": " '%(unit)s %(easytier)s %(ssh_cmd_se_opt)s'\n",
"line_no": 27
},
{
"char_end": 1110,
"char_start": 1074,
"line": " % {'name': name,\n",
"line_no": 28
},
{
"char_end": 1187,
"char_start": 1110,
"line": " 'mdiskgrp': self.configuration.storwize_svc_volpool_name,\n",
"line_no": 29
},
{
"char_end": 1257,
"char_start": 1187,
"line": " 'size': size, 'unit': units, 'easytier': easytier,\n",
"line_no": 30
},
{
"char_end": 1311,
"char_start": 1257,
"line": " 'ssh_cmd_se_opt': ssh_cmd_se_opt})\n",
"line_no": 31
}
]
},
"vul_type": "cwe-078"
}
| 101
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_invalid_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)",
" #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n",
" show_port_cmd = 'showport'",
" _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n",
" show_port_i_cmd = 'showport -iscsi'",
" _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n",
" show_port_i_cmd = 'showport -iscsiname'",
" _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])",
" config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.250', '10.10.220.251']\n config.iscsi_ip_address = '10.10.10.10'\n self.mox.ReplayAll()",
" # no valid ip addr should be configured.\n self.assertRaises(exception.InvalidInput,\n self.setup_driver,\n config,\n set_up_fakes=False)"
] |
[
1,
1,
0,
1,
0,
1,
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 319,
"char_start": 318,
"chars": "["
},
{
"char_end": 330,
"char_start": 329,
"chars": "]"
},
{
"char_end": 430,
"char_start": 429,
"chars": "["
},
{
"char_end": 441,
"char_start": 439,
"chars": "',"
},
{
"char_end": 443,
"char_start": 442,
"chars": "'"
},
{
"char_end": 451,
"char_start": 450,
"chars": "]"
},
{
"char_end": 617,
"char_start": 616,
"chars": "["
},
{
"char_end": 628,
"char_start": 626,
"chars": "',"
},
{
"char_end": 630,
"char_start": 629,
"chars": "'"
},
{
"char_end": 642,
"char_start": 641,
"chars": "]"
}
],
"deleted": []
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/tests/test_hp3par.py",
"func_name": "test_invalid_iscsi_ip",
"line_changes": {
"added": [
{
"char_end": 331,
"char_start": 294,
"line": " show_port_cmd = ['showport']\n",
"line_no": 9
},
{
"char_end": 452,
"char_start": 403,
"line": " show_port_i_cmd = ['showport', '-iscsi']\n",
"line_no": 12
},
{
"char_end": 643,
"char_start": 590,
"line": " show_port_i_cmd = ['showport', '-iscsiname']\n",
"line_no": 16
}
],
"deleted": [
{
"char_end": 329,
"char_start": 294,
"line": " show_port_cmd = 'showport'\n",
"line_no": 9
},
{
"char_end": 445,
"char_start": 401,
"line": " show_port_i_cmd = 'showport -iscsi'\n",
"line_no": 12
},
{
"char_end": 631,
"char_start": 583,
"line": " show_port_i_cmd = 'showport -iscsiname'\n",
"line_no": 16
}
]
},
"vul_type": "cwe-078"
}
| 102
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_invalid_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)",
" #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n",
" show_port_cmd = ['showport']",
" _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n",
" show_port_i_cmd = ['showport', '-iscsi']",
" _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n",
" show_port_i_cmd = ['showport', '-iscsiname']",
" _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])",
" config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.250', '10.10.220.251']\n config.iscsi_ip_address = '10.10.10.10'\n self.mox.ReplayAll()",
" # no valid ip addr should be configured.\n self.assertRaises(exception.InvalidInput,\n self.setup_driver,\n config,\n set_up_fakes=False)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 319,
"char_start": 318,
"chars": "["
},
{
"char_end": 330,
"char_start": 329,
"chars": "]"
},
{
"char_end": 430,
"char_start": 429,
"chars": "["
},
{
"char_end": 441,
"char_start": 439,
"chars": "',"
},
{
"char_end": 443,
"char_start": 442,
"chars": "'"
},
{
"char_end": 451,
"char_start": 450,
"chars": "]"
},
{
"char_end": 617,
"char_start": 616,
"chars": "["
},
{
"char_end": 628,
"char_start": 626,
"chars": "',"
},
{
"char_end": 630,
"char_start": 629,
"chars": "'"
},
{
"char_end": 642,
"char_start": 641,
"chars": "]"
}
],
"deleted": []
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/tests/test_hp3par.py",
"func_name": "test_invalid_iscsi_ip",
"line_changes": {
"added": [
{
"char_end": 331,
"char_start": 294,
"line": " show_port_cmd = ['showport']\n",
"line_no": 9
},
{
"char_end": 452,
"char_start": 403,
"line": " show_port_i_cmd = ['showport', '-iscsi']\n",
"line_no": 12
},
{
"char_end": 643,
"char_start": 590,
"line": " show_port_i_cmd = ['showport', '-iscsiname']\n",
"line_no": 16
}
],
"deleted": [
{
"char_end": 329,
"char_start": 294,
"line": " show_port_cmd = 'showport'\n",
"line_no": 9
},
{
"char_end": 445,
"char_start": 401,
"line": " show_port_i_cmd = 'showport -iscsi'\n",
"line_no": 12
},
{
"char_end": 631,
"char_start": 583,
"line": " show_port_i_cmd = 'showport -iscsiname'\n",
"line_no": 16
}
]
},
"vul_type": "cwe-078"
}
| 102
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def get_output(command: str) -> bytes:",
" \"\"\"\n Run a command and return raw output",
" :param str command: the command to run\n :returns: the stdout output of the command\n \"\"\"",
" return subprocess.check_output(command.split())"
] |
[
0,
1,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 29,
"char_start": 24,
"chars": "List["
},
{
"char_end": 33,
"char_start": 32,
"chars": "]"
},
{
"char_end": 39,
"char_start": 38,
"chars": "s"
},
{
"char_end": 41,
"char_start": 40,
"chars": "r"
},
{
"char_end": 199,
"char_start": 196,
"chars": "sul"
},
{
"char_end": 204,
"char_start": 200,
"chars": " = s"
},
{
"char_end": 207,
"char_start": 205,
"chars": "bp"
},
{
"char_end": 216,
"char_start": 208,
"chars": "ocess.ru"
},
{
"char_end": 226,
"char_start": 217,
"chars": "(command,"
},
{
"char_end": 234,
"char_start": 227,
"chars": "stdout="
},
{
"char_end": 251,
"char_start": 245,
"chars": "PIPE, "
},
{
"char_end": 259,
"char_start": 256,
"chars": "=Tr"
},
{
"char_end": 269,
"char_start": 260,
"chars": "e)\n re"
},
{
"char_end": 285,
"char_start": 270,
"chars": "urn result.stdo"
},
{
"char_end": 290,
"char_start": 287,
"chars": ".de"
},
{
"char_end": 294,
"char_start": 293,
"chars": "e"
}
],
"deleted": [
{
"char_end": 36,
"char_start": 32,
"chars": "byte"
},
{
"char_end": 215,
"char_start": 213,
"chars": "_o"
},
{
"char_end": 218,
"char_start": 217,
"chars": "p"
},
{
"char_end": 221,
"char_start": 220,
"chars": "("
},
{
"char_end": 227,
"char_start": 223,
"chars": "mman"
},
{
"char_end": 234,
"char_start": 228,
"chars": ".split"
},
{
"char_end": 237,
"char_start": 236,
"chars": ")"
}
]
},
"commit_link": "github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76",
"file_name": "isort/hooks.py",
"func_name": "get_output",
"line_changes": {
"added": [
{
"char_end": 43,
"char_start": 0,
"line": "def get_output(command: List[str]) -> str:\n",
"line_no": 1
},
{
"char_end": 263,
"char_start": 190,
"line": " result = subprocess.run(command, stdout=subprocess.PIPE, check=True)\n",
"line_no": 8
},
{
"char_end": 296,
"char_start": 263,
"line": " return result.stdout.decode()\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 39,
"char_start": 0,
"line": "def get_output(command: str) -> bytes:\n",
"line_no": 1
},
{
"char_end": 237,
"char_start": 186,
"line": " return subprocess.check_output(command.split())\n",
"line_no": 8
}
]
},
"vul_type": "cwe-078"
}
| 103
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def get_output(command: List[str]) -> str:",
" \"\"\"\n Run a command and return raw output",
" :param str command: the command to run\n :returns: the stdout output of the command\n \"\"\"",
" result = subprocess.run(command, stdout=subprocess.PIPE, check=True)\n return result.stdout.decode()"
] |
[
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 29,
"char_start": 24,
"chars": "List["
},
{
"char_end": 33,
"char_start": 32,
"chars": "]"
},
{
"char_end": 39,
"char_start": 38,
"chars": "s"
},
{
"char_end": 41,
"char_start": 40,
"chars": "r"
},
{
"char_end": 199,
"char_start": 196,
"chars": "sul"
},
{
"char_end": 204,
"char_start": 200,
"chars": " = s"
},
{
"char_end": 207,
"char_start": 205,
"chars": "bp"
},
{
"char_end": 216,
"char_start": 208,
"chars": "ocess.ru"
},
{
"char_end": 226,
"char_start": 217,
"chars": "(command,"
},
{
"char_end": 234,
"char_start": 227,
"chars": "stdout="
},
{
"char_end": 251,
"char_start": 245,
"chars": "PIPE, "
},
{
"char_end": 259,
"char_start": 256,
"chars": "=Tr"
},
{
"char_end": 269,
"char_start": 260,
"chars": "e)\n re"
},
{
"char_end": 285,
"char_start": 270,
"chars": "urn result.stdo"
},
{
"char_end": 290,
"char_start": 287,
"chars": ".de"
},
{
"char_end": 294,
"char_start": 293,
"chars": "e"
}
],
"deleted": [
{
"char_end": 36,
"char_start": 32,
"chars": "byte"
},
{
"char_end": 215,
"char_start": 213,
"chars": "_o"
},
{
"char_end": 218,
"char_start": 217,
"chars": "p"
},
{
"char_end": 221,
"char_start": 220,
"chars": "("
},
{
"char_end": 227,
"char_start": 223,
"chars": "mman"
},
{
"char_end": 234,
"char_start": 228,
"chars": ".split"
},
{
"char_end": 237,
"char_start": 236,
"chars": ")"
}
]
},
"commit_link": "github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76",
"file_name": "isort/hooks.py",
"func_name": "get_output",
"line_changes": {
"added": [
{
"char_end": 43,
"char_start": 0,
"line": "def get_output(command: List[str]) -> str:\n",
"line_no": 1
},
{
"char_end": 263,
"char_start": 190,
"line": " result = subprocess.run(command, stdout=subprocess.PIPE, check=True)\n",
"line_no": 8
},
{
"char_end": 296,
"char_start": 263,
"line": " return result.stdout.decode()\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 39,
"char_start": 0,
"line": "def get_output(command: str) -> bytes:\n",
"line_no": 1
},
{
"char_end": 237,
"char_start": 186,
"line": " return subprocess.check_output(command.split())\n",
"line_no": 8
}
]
},
"vul_type": "cwe-078"
}
| 103
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"openscript(\n char_u\t*name,\n int\t\tdirectly)\t/* when TRUE execute directly */\n{\n if (curscript + 1 == NSCRIPT)\n {\n\temsg(_(e_nesting));\n\treturn;\n }",
"",
"#ifdef FEAT_EVAL\n if (ignore_script)\n\t/* Not reading from script, also don't open one. Warning message? */\n\treturn;\n#endif",
" if (scriptin[curscript] != NULL)\t/* already reading script */\n\t++curscript;\n\t\t\t\t/* use NameBuff for expanded name */\n expand_env(name, NameBuff, MAXPATHL);\n if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL)\n {\n\tsemsg(_(e_notopen), name);\n\tif (curscript)\n\t --curscript;\n\treturn;\n }\n if (save_typebuf() == FAIL)\n\treturn;",
" /*\n * Execute the commands from the file right now when using \":source!\"\n * after \":global\" or \":argdo\" or in a loop. Also when another command\n * follows. This means the display won't be updated. Don't do this\n * always, \"make test\" would fail.\n */\n if (directly)\n {\n\toparg_T\toa;\n\tint\toldcurscript;\n\tint\tsave_State = State;\n\tint\tsave_restart_edit = restart_edit;\n\tint\tsave_insertmode = p_im;\n\tint\tsave_finish_op = finish_op;\n\tint\tsave_msg_scroll = msg_scroll;",
"\tState = NORMAL;\n\tmsg_scroll = FALSE;\t/* no msg scrolling in Normal mode */\n\trestart_edit = 0;\t/* don't go to Insert mode */\n\tp_im = FALSE;\t\t/* don't use 'insertmode' */\n\tclear_oparg(&oa);\n\tfinish_op = FALSE;",
"\toldcurscript = curscript;\n\tdo\n\t{\n\t update_topline_cursor();\t// update cursor position and topline\n\t normal_cmd(&oa, FALSE);\t// execute one command\n\t vpeekc();\t\t\t// check for end of file\n\t}\n\twhile (scriptin[oldcurscript] != NULL);",
"\tState = save_State;\n\tmsg_scroll = save_msg_scroll;\n\trestart_edit = save_restart_edit;\n\tp_im = save_insertmode;\n\tfinish_op = save_finish_op;\n }\n}"
] |
[
1,
0,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 321,
"char_start": 160,
"chars": "\n // Disallow sourcing a file in the sandbox, the commands would be executed\n // later, possibly outside of the sandbox.\n if (check_secure())\n\treturn;\n\n"
}
],
"deleted": []
},
"commit_link": "github.com/vim/vim/commit/53575521406739cf20bbe4e384d88e7dca11f040",
"file_name": "src/getchar.c",
"func_name": "openscript",
"line_changes": {
"added": [
{
"char_end": 161,
"char_start": 160,
"line": "\n",
"line_no": 10
},
{
"char_end": 311,
"char_start": 287,
"line": " if (check_secure())\n",
"line_no": 13
},
{
"char_end": 320,
"char_start": 311,
"line": "\treturn;\n",
"line_no": 14
},
{
"char_end": 321,
"char_start": 320,
"line": "\n",
"line_no": 15
}
],
"deleted": []
},
"vul_type": "cwe-078"
}
| 104
|
cwe-078
|
c
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"openscript(\n char_u\t*name,\n int\t\tdirectly)\t/* when TRUE execute directly */\n{\n if (curscript + 1 == NSCRIPT)\n {\n\temsg(_(e_nesting));\n\treturn;\n }",
"\n // Disallow sourcing a file in the sandbox, the commands would be executed\n // later, possibly outside of the sandbox.\n if (check_secure())\n\treturn;\n",
"#ifdef FEAT_EVAL\n if (ignore_script)\n\t/* Not reading from script, also don't open one. Warning message? */\n\treturn;\n#endif",
" if (scriptin[curscript] != NULL)\t/* already reading script */\n\t++curscript;\n\t\t\t\t/* use NameBuff for expanded name */\n expand_env(name, NameBuff, MAXPATHL);\n if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL)\n {\n\tsemsg(_(e_notopen), name);\n\tif (curscript)\n\t --curscript;\n\treturn;\n }\n if (save_typebuf() == FAIL)\n\treturn;",
" /*\n * Execute the commands from the file right now when using \":source!\"\n * after \":global\" or \":argdo\" or in a loop. Also when another command\n * follows. This means the display won't be updated. Don't do this\n * always, \"make test\" would fail.\n */\n if (directly)\n {\n\toparg_T\toa;\n\tint\toldcurscript;\n\tint\tsave_State = State;\n\tint\tsave_restart_edit = restart_edit;\n\tint\tsave_insertmode = p_im;\n\tint\tsave_finish_op = finish_op;\n\tint\tsave_msg_scroll = msg_scroll;",
"\tState = NORMAL;\n\tmsg_scroll = FALSE;\t/* no msg scrolling in Normal mode */\n\trestart_edit = 0;\t/* don't go to Insert mode */\n\tp_im = FALSE;\t\t/* don't use 'insertmode' */\n\tclear_oparg(&oa);\n\tfinish_op = FALSE;",
"\toldcurscript = curscript;\n\tdo\n\t{\n\t update_topline_cursor();\t// update cursor position and topline\n\t normal_cmd(&oa, FALSE);\t// execute one command\n\t vpeekc();\t\t\t// check for end of file\n\t}\n\twhile (scriptin[oldcurscript] != NULL);",
"\tState = save_State;\n\tmsg_scroll = save_msg_scroll;\n\trestart_edit = save_restart_edit;\n\tp_im = save_insertmode;\n\tfinish_op = save_finish_op;\n }\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 321,
"char_start": 160,
"chars": "\n // Disallow sourcing a file in the sandbox, the commands would be executed\n // later, possibly outside of the sandbox.\n if (check_secure())\n\treturn;\n\n"
}
],
"deleted": []
},
"commit_link": "github.com/vim/vim/commit/53575521406739cf20bbe4e384d88e7dca11f040",
"file_name": "src/getchar.c",
"func_name": "openscript",
"line_changes": {
"added": [
{
"char_end": 161,
"char_start": 160,
"line": "\n",
"line_no": 10
},
{
"char_end": 311,
"char_start": 287,
"line": " if (check_secure())\n",
"line_no": 13
},
{
"char_end": 320,
"char_start": 311,
"line": "\treturn;\n",
"line_no": 14
},
{
"char_end": 321,
"char_start": 320,
"line": "\n",
"line_no": 15
}
],
"deleted": []
},
"vul_type": "cwe-078"
}
| 104
|
cwe-078
|
c
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def add_user(username, password):\n encPass = crypt.crypt(password,\"22\")",
" os.system(\"useradd -G docker,wheel -p \"+encPass+\" \"+username)"
] |
[
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 85,
"char_start": 79,
"chars": "#subpr"
},
{
"char_end": 88,
"char_start": 86,
"chars": "ce"
},
{
"char_end": 92,
"char_start": 90,
"chars": " e"
},
{
"char_end": 99,
"char_start": 93,
"chars": "capes "
},
{
"char_end": 101,
"char_start": 100,
"chars": "h"
},
{
"char_end": 109,
"char_start": 102,
"chars": " userna"
},
{
"char_end": 155,
"char_start": 110,
"chars": "e stopping code injection\n subprocess.call"
},
{
"char_end": 158,
"char_start": 156,
"chars": "['"
},
{
"char_end": 168,
"char_start": 165,
"chars": "','"
},
{
"char_end": 173,
"char_start": 170,
"chars": "','"
},
{
"char_end": 188,
"char_start": 185,
"chars": "','"
},
{
"char_end": 192,
"char_start": 190,
"chars": "',"
},
{
"char_end": 200,
"char_start": 199,
"chars": ","
},
{
"char_end": 209,
"char_start": 208,
"chars": "]"
}
],
"deleted": [
{
"char_end": 82,
"char_start": 81,
"chars": "."
},
{
"char_end": 84,
"char_start": 83,
"chars": "y"
},
{
"char_end": 90,
"char_start": 89,
"chars": "\""
},
{
"char_end": 98,
"char_start": 97,
"chars": " "
},
{
"char_end": 101,
"char_start": 100,
"chars": " "
},
{
"char_end": 114,
"char_start": 113,
"chars": " "
},
{
"char_end": 119,
"char_start": 116,
"chars": " \"+"
},
{
"char_end": 131,
"char_start": 126,
"chars": "+\" \"+"
}
]
},
"commit_link": "github.com/Internet-of-People/titania-os/commit/9b7805119938343fcac9dc929d8882f1d97cf14a",
"file_name": "vuedj/configtitania/views.py",
"func_name": "add_user",
"line_changes": {
"added": [
{
"char_end": 210,
"char_start": 136,
"line": " subprocess.call(['useradd','-G','docker,wheel','-p',encPass,username])\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 140,
"char_start": 75,
"line": " os.system(\"useradd -G docker,wheel -p \"+encPass+\" \"+username)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-078"
}
| 105
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def add_user(username, password):\n encPass = crypt.crypt(password,\"22\")",
" #subprocess escapes the username stopping code injection\n subprocess.call(['useradd','-G','docker,wheel','-p',encPass,username])"
] |
[
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 85,
"char_start": 79,
"chars": "#subpr"
},
{
"char_end": 88,
"char_start": 86,
"chars": "ce"
},
{
"char_end": 92,
"char_start": 90,
"chars": " e"
},
{
"char_end": 99,
"char_start": 93,
"chars": "capes "
},
{
"char_end": 101,
"char_start": 100,
"chars": "h"
},
{
"char_end": 109,
"char_start": 102,
"chars": " userna"
},
{
"char_end": 155,
"char_start": 110,
"chars": "e stopping code injection\n subprocess.call"
},
{
"char_end": 158,
"char_start": 156,
"chars": "['"
},
{
"char_end": 168,
"char_start": 165,
"chars": "','"
},
{
"char_end": 173,
"char_start": 170,
"chars": "','"
},
{
"char_end": 188,
"char_start": 185,
"chars": "','"
},
{
"char_end": 192,
"char_start": 190,
"chars": "',"
},
{
"char_end": 200,
"char_start": 199,
"chars": ","
},
{
"char_end": 209,
"char_start": 208,
"chars": "]"
}
],
"deleted": [
{
"char_end": 82,
"char_start": 81,
"chars": "."
},
{
"char_end": 84,
"char_start": 83,
"chars": "y"
},
{
"char_end": 90,
"char_start": 89,
"chars": "\""
},
{
"char_end": 98,
"char_start": 97,
"chars": " "
},
{
"char_end": 101,
"char_start": 100,
"chars": " "
},
{
"char_end": 114,
"char_start": 113,
"chars": " "
},
{
"char_end": 119,
"char_start": 116,
"chars": " \"+"
},
{
"char_end": 131,
"char_start": 126,
"chars": "+\" \"+"
}
]
},
"commit_link": "github.com/Internet-of-People/titania-os/commit/9b7805119938343fcac9dc929d8882f1d97cf14a",
"file_name": "vuedj/configtitania/views.py",
"func_name": "add_user",
"line_changes": {
"added": [
{
"char_end": 210,
"char_start": 136,
"line": " subprocess.call(['useradd','-G','docker,wheel','-p',encPass,username])\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 140,
"char_start": 75,
"line": " os.system(\"useradd -G docker,wheel -p \"+encPass+\" \"+username)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-078"
}
| 105
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def write_section(self, section_name, section_data):\n self.write_line(\"\")\n self.write_line(\"define %s {\" % section_name)\n sorted_keys = section_data.keys()\n sorted_keys.sort()\n for key in sorted_keys:",
" value = section_data[key]\n self.icinga_lines.append((\"%s%-45s%s\" % (self.indent, key, self.value_to_icinga(value))))",
" self.write_line(\"}\")"
] |
[
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 283,
"char_start": 262,
"chars": "lf.value_to_icinga(se"
},
{
"char_end": 299,
"char_start": 298,
"chars": ")"
},
{
"char_end": 326,
"char_start": 323,
"chars": " = "
},
{
"char_end": 442,
"char_start": 359,
"chars": "value)\n\n if \"\\n\" in icinga_line or \"}\" in icinga_line:\n m"
},
{
"char_end": 461,
"char_start": 443,
"chars": "g = \"Found forbidd"
},
{
"char_end": 467,
"char_start": 462,
"chars": "n new"
},
{
"char_end": 502,
"char_start": 468,
"chars": "ine or '}' character in section %r"
},
{
"char_end": 522,
"char_start": 503,
"chars": "\"\n r"
},
{
"char_end": 525,
"char_start": 523,
"chars": "is"
},
{
"char_end": 532,
"char_start": 526,
"chars": " Excep"
},
{
"char_end": 548,
"char_start": 533,
"chars": "ion(msg % secti"
},
{
"char_end": 550,
"char_start": 549,
"chars": "n"
},
{
"char_end": 575,
"char_start": 551,
"chars": "name)\n\n self."
},
{
"char_end": 594,
"char_start": 581,
"chars": "_lines.append"
},
{
"char_end": 600,
"char_start": 595,
"chars": "icing"
},
{
"char_end": 602,
"char_start": 601,
"chars": "_"
},
{
"char_end": 605,
"char_start": 603,
"chars": "in"
}
],
"deleted": [
{
"char_end": 295,
"char_start": 290,
"chars": "self."
},
{
"char_end": 316,
"char_start": 306,
"chars": "s.append(("
},
{
"char_end": 350,
"char_start": 349,
"chars": "s"
},
{
"char_end": 352,
"char_start": 351,
"chars": "l"
},
{
"char_end": 355,
"char_start": 353,
"chars": ".v"
},
{
"char_end": 358,
"char_start": 357,
"chars": "u"
},
{
"char_end": 371,
"char_start": 370,
"chars": "v"
},
{
"char_end": 374,
"char_start": 373,
"chars": "u"
},
{
"char_end": 378,
"char_start": 375,
"chars": ")))"
}
]
},
"commit_link": "github.com/Scout24/monitoring-config-generator/commit/a4b01b72d2e3d6ec2600c384a77f675fa9bbf6b7",
"file_name": "src/main/python/monitoring_config_generator/MonitoringConfigGenerator.py",
"func_name": "write_section",
"line_changes": {
"added": [
{
"char_end": 300,
"char_start": 240,
"line": " value = self.value_to_icinga(section_data[key])\n",
"line_no": 7
},
{
"char_end": 366,
"char_start": 300,
"line": " icinga_line = \"%s%-45s%s\" % (self.indent, key, value)\n",
"line_no": 8
},
{
"char_end": 367,
"char_start": 366,
"line": "\n",
"line_no": 9
},
{
"char_end": 425,
"char_start": 367,
"line": " if \"\\n\" in icinga_line or \"}\" in icinga_line:\n",
"line_no": 10
},
{
"char_end": 505,
"char_start": 425,
"line": " msg = \"Found forbidden newline or '}' character in section %r.\"\n",
"line_no": 11
},
{
"char_end": 557,
"char_start": 505,
"line": " raise Exception(msg % section_name)\n",
"line_no": 12
},
{
"char_end": 558,
"char_start": 557,
"line": "\n",
"line_no": 13
},
{
"char_end": 608,
"char_start": 558,
"line": " self.icinga_lines.append(icinga_line)\n",
"line_no": 14
}
],
"deleted": [
{
"char_end": 278,
"char_start": 240,
"line": " value = section_data[key]\n",
"line_no": 7
},
{
"char_end": 380,
"char_start": 278,
"line": " self.icinga_lines.append((\"%s%-45s%s\" % (self.indent, key, self.value_to_icinga(value))))\n",
"line_no": 8
}
]
},
"vul_type": "cwe-078"
}
| 106
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def write_section(self, section_name, section_data):\n self.write_line(\"\")\n self.write_line(\"define %s {\" % section_name)\n sorted_keys = section_data.keys()\n sorted_keys.sort()\n for key in sorted_keys:",
" value = self.value_to_icinga(section_data[key])\n icinga_line = \"%s%-45s%s\" % (self.indent, key, value)",
" if \"\\n\" in icinga_line or \"}\" in icinga_line:\n msg = \"Found forbidden newline or '}' character in section %r.\"\n raise Exception(msg % section_name)",
" self.icinga_lines.append(icinga_line)",
" self.write_line(\"}\")"
] |
[
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 283,
"char_start": 262,
"chars": "lf.value_to_icinga(se"
},
{
"char_end": 299,
"char_start": 298,
"chars": ")"
},
{
"char_end": 326,
"char_start": 323,
"chars": " = "
},
{
"char_end": 442,
"char_start": 359,
"chars": "value)\n\n if \"\\n\" in icinga_line or \"}\" in icinga_line:\n m"
},
{
"char_end": 461,
"char_start": 443,
"chars": "g = \"Found forbidd"
},
{
"char_end": 467,
"char_start": 462,
"chars": "n new"
},
{
"char_end": 502,
"char_start": 468,
"chars": "ine or '}' character in section %r"
},
{
"char_end": 522,
"char_start": 503,
"chars": "\"\n r"
},
{
"char_end": 525,
"char_start": 523,
"chars": "is"
},
{
"char_end": 532,
"char_start": 526,
"chars": " Excep"
},
{
"char_end": 548,
"char_start": 533,
"chars": "ion(msg % secti"
},
{
"char_end": 550,
"char_start": 549,
"chars": "n"
},
{
"char_end": 575,
"char_start": 551,
"chars": "name)\n\n self."
},
{
"char_end": 594,
"char_start": 581,
"chars": "_lines.append"
},
{
"char_end": 600,
"char_start": 595,
"chars": "icing"
},
{
"char_end": 602,
"char_start": 601,
"chars": "_"
},
{
"char_end": 605,
"char_start": 603,
"chars": "in"
}
],
"deleted": [
{
"char_end": 295,
"char_start": 290,
"chars": "self."
},
{
"char_end": 316,
"char_start": 306,
"chars": "s.append(("
},
{
"char_end": 350,
"char_start": 349,
"chars": "s"
},
{
"char_end": 352,
"char_start": 351,
"chars": "l"
},
{
"char_end": 355,
"char_start": 353,
"chars": ".v"
},
{
"char_end": 358,
"char_start": 357,
"chars": "u"
},
{
"char_end": 371,
"char_start": 370,
"chars": "v"
},
{
"char_end": 374,
"char_start": 373,
"chars": "u"
},
{
"char_end": 378,
"char_start": 375,
"chars": ")))"
}
]
},
"commit_link": "github.com/Scout24/monitoring-config-generator/commit/a4b01b72d2e3d6ec2600c384a77f675fa9bbf6b7",
"file_name": "src/main/python/monitoring_config_generator/MonitoringConfigGenerator.py",
"func_name": "write_section",
"line_changes": {
"added": [
{
"char_end": 300,
"char_start": 240,
"line": " value = self.value_to_icinga(section_data[key])\n",
"line_no": 7
},
{
"char_end": 366,
"char_start": 300,
"line": " icinga_line = \"%s%-45s%s\" % (self.indent, key, value)\n",
"line_no": 8
},
{
"char_end": 367,
"char_start": 366,
"line": "\n",
"line_no": 9
},
{
"char_end": 425,
"char_start": 367,
"line": " if \"\\n\" in icinga_line or \"}\" in icinga_line:\n",
"line_no": 10
},
{
"char_end": 505,
"char_start": 425,
"line": " msg = \"Found forbidden newline or '}' character in section %r.\"\n",
"line_no": 11
},
{
"char_end": 557,
"char_start": 505,
"line": " raise Exception(msg % section_name)\n",
"line_no": 12
},
{
"char_end": 558,
"char_start": 557,
"line": "\n",
"line_no": 13
},
{
"char_end": 608,
"char_start": 558,
"line": " self.icinga_lines.append(icinga_line)\n",
"line_no": 14
}
],
"deleted": [
{
"char_end": 278,
"char_start": 240,
"line": " value = section_data[key]\n",
"line_no": 7
},
{
"char_end": 380,
"char_start": 278,
"line": " self.icinga_lines.append((\"%s%-45s%s\" % (self.indent, key, self.value_to_icinga(value))))\n",
"line_no": 8
}
]
},
"vul_type": "cwe-078"
}
| 106
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _update_volume_stats(self):\n \"\"\"Retrieve stats info from volume group.\"\"\"",
" LOG.debug(_(\"Updating volume stats\"))\n data = {}",
" data['vendor_name'] = 'IBM'\n data['driver_version'] = '1.1'\n data['storage_protocol'] = list(self._enabled_protocols)",
" data['total_capacity_gb'] = 0 # To be overwritten\n data['free_capacity_gb'] = 0 # To be overwritten\n data['reserved_percentage'] = 0\n data['QoS_support'] = False",
" pool = self.configuration.storwize_svc_volpool_name\n #Get storage system name",
" ssh_cmd = 'svcinfo lssystem -delim !'",
" attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes or not attributes['name']:\n exception_message = (_('_update_volume_stats: '\n 'Could not get system name'))\n raise exception.VolumeBackendAPIException(data=exception_message)",
" backend_name = self.configuration.safe_get('volume_backend_name')\n if not backend_name:\n backend_name = '%s_%s' % (attributes['name'], pool)\n data['volume_backend_name'] = backend_name\n",
" ssh_cmd = 'svcinfo lsmdiskgrp -bytes -delim ! %s' % pool",
" attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes:\n LOG.error(_('Could not get pool data from the storage'))\n exception_message = (_('_update_volume_stats: '\n 'Could not get storage pool data'))\n raise exception.VolumeBackendAPIException(data=exception_message)",
" data['total_capacity_gb'] = (float(attributes['capacity']) /\n (1024 ** 3))\n data['free_capacity_gb'] = (float(attributes['free_capacity']) /\n (1024 ** 3))\n data['easytier_support'] = attributes['easy_tier'] in ['on', 'auto']\n data['compression_support'] = self._compression_enabled",
" self._stats = data"
] |
[
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 603,
"char_start": 602,
"chars": "["
},
{
"char_end": 613,
"char_start": 611,
"chars": "',"
},
{
"char_end": 615,
"char_start": 614,
"chars": "'"
},
{
"char_end": 625,
"char_start": 623,
"chars": "',"
},
{
"char_end": 627,
"char_start": 626,
"chars": "'"
},
{
"char_end": 635,
"char_start": 633,
"chars": "',"
},
{
"char_end": 637,
"char_start": 636,
"chars": "'"
},
{
"char_end": 640,
"char_start": 639,
"chars": "]"
},
{
"char_end": 1209,
"char_start": 1208,
"chars": "["
},
{
"char_end": 1219,
"char_start": 1217,
"chars": "',"
},
{
"char_end": 1221,
"char_start": 1220,
"chars": "'"
},
{
"char_end": 1233,
"char_start": 1231,
"chars": "',"
},
{
"char_end": 1235,
"char_start": 1234,
"chars": "'"
},
{
"char_end": 1243,
"char_start": 1241,
"chars": "',"
},
{
"char_end": 1245,
"char_start": 1244,
"chars": "'"
},
{
"char_end": 1253,
"char_start": 1251,
"chars": "',"
},
{
"char_end": 1255,
"char_start": 1254,
"chars": "'"
},
{
"char_end": 1258,
"char_start": 1257,
"chars": ","
},
{
"char_end": 1264,
"char_start": 1263,
"chars": "]"
}
],
"deleted": [
{
"char_end": 1235,
"char_start": 1232,
"chars": " %s"
},
{
"char_end": 1238,
"char_start": 1236,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_update_volume_stats",
"line_changes": {
"added": [
{
"char_end": 641,
"char_start": 584,
"line": " ssh_cmd = ['svcinfo', 'lssystem', '-delim', '!']\n",
"line_no": 18
},
{
"char_end": 1265,
"char_start": 1190,
"line": " ssh_cmd = ['svcinfo', 'lsmdiskgrp', '-bytes', '-delim', '!', pool]\n",
"line_no": 30
}
],
"deleted": [
{
"char_end": 630,
"char_start": 584,
"line": " ssh_cmd = 'svcinfo lssystem -delim !'\n",
"line_no": 18
},
{
"char_end": 1244,
"char_start": 1179,
"line": " ssh_cmd = 'svcinfo lsmdiskgrp -bytes -delim ! %s' % pool\n",
"line_no": 30
}
]
},
"vul_type": "cwe-078"
}
| 107
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _update_volume_stats(self):\n \"\"\"Retrieve stats info from volume group.\"\"\"",
" LOG.debug(_(\"Updating volume stats\"))\n data = {}",
" data['vendor_name'] = 'IBM'\n data['driver_version'] = '1.1'\n data['storage_protocol'] = list(self._enabled_protocols)",
" data['total_capacity_gb'] = 0 # To be overwritten\n data['free_capacity_gb'] = 0 # To be overwritten\n data['reserved_percentage'] = 0\n data['QoS_support'] = False",
" pool = self.configuration.storwize_svc_volpool_name\n #Get storage system name",
" ssh_cmd = ['svcinfo', 'lssystem', '-delim', '!']",
" attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes or not attributes['name']:\n exception_message = (_('_update_volume_stats: '\n 'Could not get system name'))\n raise exception.VolumeBackendAPIException(data=exception_message)",
" backend_name = self.configuration.safe_get('volume_backend_name')\n if not backend_name:\n backend_name = '%s_%s' % (attributes['name'], pool)\n data['volume_backend_name'] = backend_name\n",
" ssh_cmd = ['svcinfo', 'lsmdiskgrp', '-bytes', '-delim', '!', pool]",
" attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes:\n LOG.error(_('Could not get pool data from the storage'))\n exception_message = (_('_update_volume_stats: '\n 'Could not get storage pool data'))\n raise exception.VolumeBackendAPIException(data=exception_message)",
" data['total_capacity_gb'] = (float(attributes['capacity']) /\n (1024 ** 3))\n data['free_capacity_gb'] = (float(attributes['free_capacity']) /\n (1024 ** 3))\n data['easytier_support'] = attributes['easy_tier'] in ['on', 'auto']\n data['compression_support'] = self._compression_enabled",
" self._stats = data"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 603,
"char_start": 602,
"chars": "["
},
{
"char_end": 613,
"char_start": 611,
"chars": "',"
},
{
"char_end": 615,
"char_start": 614,
"chars": "'"
},
{
"char_end": 625,
"char_start": 623,
"chars": "',"
},
{
"char_end": 627,
"char_start": 626,
"chars": "'"
},
{
"char_end": 635,
"char_start": 633,
"chars": "',"
},
{
"char_end": 637,
"char_start": 636,
"chars": "'"
},
{
"char_end": 640,
"char_start": 639,
"chars": "]"
},
{
"char_end": 1209,
"char_start": 1208,
"chars": "["
},
{
"char_end": 1219,
"char_start": 1217,
"chars": "',"
},
{
"char_end": 1221,
"char_start": 1220,
"chars": "'"
},
{
"char_end": 1233,
"char_start": 1231,
"chars": "',"
},
{
"char_end": 1235,
"char_start": 1234,
"chars": "'"
},
{
"char_end": 1243,
"char_start": 1241,
"chars": "',"
},
{
"char_end": 1245,
"char_start": 1244,
"chars": "'"
},
{
"char_end": 1253,
"char_start": 1251,
"chars": "',"
},
{
"char_end": 1255,
"char_start": 1254,
"chars": "'"
},
{
"char_end": 1258,
"char_start": 1257,
"chars": ","
},
{
"char_end": 1264,
"char_start": 1263,
"chars": "]"
}
],
"deleted": [
{
"char_end": 1235,
"char_start": 1232,
"chars": " %s"
},
{
"char_end": 1238,
"char_start": 1236,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_update_volume_stats",
"line_changes": {
"added": [
{
"char_end": 641,
"char_start": 584,
"line": " ssh_cmd = ['svcinfo', 'lssystem', '-delim', '!']\n",
"line_no": 18
},
{
"char_end": 1265,
"char_start": 1190,
"line": " ssh_cmd = ['svcinfo', 'lsmdiskgrp', '-bytes', '-delim', '!', pool]\n",
"line_no": 30
}
],
"deleted": [
{
"char_end": 630,
"char_start": 584,
"line": " ssh_cmd = 'svcinfo lssystem -delim !'\n",
"line_no": 18
},
{
"char_end": 1244,
"char_start": 1179,
"line": " ssh_cmd = 'svcinfo lsmdiskgrp -bytes -delim ! %s' % pool\n",
"line_no": 30
}
]
},
"vul_type": "cwe-078"
}
| 107
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)",
" #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n",
" show_host_cmd = 'showhost -verbose fakehost'",
" _run_ssh(show_host_cmd, False).AndReturn([pack(NO_FC_HOST_RET), ''])\n",
" create_host_cmd = ('createhost -add fakehost '\n '123456789012345 123456789054321')",
" _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n",
" show_host_cmd = 'showhost -verbose fakehost'",
" _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()",
" host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)"
] |
[
1,
1,
0,
1,
0,
1,
0,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 529,
"char_start": 528,
"chars": "["
},
{
"char_end": 540,
"char_start": 538,
"chars": "',"
},
{
"char_end": 542,
"char_start": 541,
"chars": "'"
},
{
"char_end": 552,
"char_start": 550,
"chars": "',"
},
{
"char_end": 554,
"char_start": 553,
"chars": "'"
},
{
"char_end": 564,
"char_start": 563,
"chars": "]"
},
{
"char_end": 670,
"char_start": 669,
"chars": "["
},
{
"char_end": 683,
"char_start": 681,
"chars": "',"
},
{
"char_end": 685,
"char_start": 684,
"chars": "'"
},
{
"char_end": 691,
"char_start": 689,
"chars": "',"
},
{
"char_end": 693,
"char_start": 692,
"chars": "'"
},
{
"char_end": 703,
"char_start": 701,
"chars": "',"
},
{
"char_end": 722,
"char_start": 705,
"chars": "123456789012345',"
},
{
"char_end": 768,
"char_start": 767,
"chars": "]"
},
{
"char_end": 860,
"char_start": 859,
"chars": "["
},
{
"char_end": 871,
"char_start": 869,
"chars": "',"
},
{
"char_end": 873,
"char_start": 872,
"chars": "'"
},
{
"char_end": 883,
"char_start": 881,
"chars": "',"
},
{
"char_end": 885,
"char_start": 884,
"chars": "'"
},
{
"char_end": 895,
"char_start": 894,
"chars": "]"
}
],
"deleted": [
{
"char_end": 662,
"char_start": 661,
"chars": "("
},
{
"char_end": 744,
"char_start": 728,
"chars": "12345 1234567890"
},
{
"char_end": 751,
"char_start": 750,
"chars": ")"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/tests/test_hp3par.py",
"func_name": "test_create_modify_host",
"line_changes": {
"added": [
{
"char_end": 565,
"char_start": 504,
"line": " show_host_cmd = ['showhost', '-verbose', 'fakehost']\n",
"line_no": 13
},
{
"char_end": 723,
"char_start": 643,
"line": " create_host_cmd = ['createhost', '-add', 'fakehost', '123456789012345',\n",
"line_no": 16
},
{
"char_end": 769,
"char_start": 723,
"line": " '123456789054321']\n",
"line_no": 17
},
{
"char_end": 896,
"char_start": 835,
"line": " show_host_cmd = ['showhost', '-verbose', 'fakehost']\n",
"line_no": 20
}
],
"deleted": [
{
"char_end": 557,
"char_start": 504,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n",
"line_no": 13
},
{
"char_end": 690,
"char_start": 635,
"line": " create_host_cmd = ('createhost -add fakehost '\n",
"line_no": 16
},
{
"char_end": 752,
"char_start": 690,
"line": " '123456789012345 123456789054321')\n",
"line_no": 17
},
{
"char_end": 871,
"char_start": 818,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n",
"line_no": 20
}
]
},
"vul_type": "cwe-078"
}
| 108
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)",
" #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n",
" show_host_cmd = ['showhost', '-verbose', 'fakehost']",
" _run_ssh(show_host_cmd, False).AndReturn([pack(NO_FC_HOST_RET), ''])\n",
" create_host_cmd = ['createhost', '-add', 'fakehost', '123456789012345',\n '123456789054321']",
" _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n",
" show_host_cmd = ['showhost', '-verbose', 'fakehost']",
" _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()",
" host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 529,
"char_start": 528,
"chars": "["
},
{
"char_end": 540,
"char_start": 538,
"chars": "',"
},
{
"char_end": 542,
"char_start": 541,
"chars": "'"
},
{
"char_end": 552,
"char_start": 550,
"chars": "',"
},
{
"char_end": 554,
"char_start": 553,
"chars": "'"
},
{
"char_end": 564,
"char_start": 563,
"chars": "]"
},
{
"char_end": 670,
"char_start": 669,
"chars": "["
},
{
"char_end": 683,
"char_start": 681,
"chars": "',"
},
{
"char_end": 685,
"char_start": 684,
"chars": "'"
},
{
"char_end": 691,
"char_start": 689,
"chars": "',"
},
{
"char_end": 693,
"char_start": 692,
"chars": "'"
},
{
"char_end": 703,
"char_start": 701,
"chars": "',"
},
{
"char_end": 722,
"char_start": 705,
"chars": "123456789012345',"
},
{
"char_end": 768,
"char_start": 767,
"chars": "]"
},
{
"char_end": 860,
"char_start": 859,
"chars": "["
},
{
"char_end": 871,
"char_start": 869,
"chars": "',"
},
{
"char_end": 873,
"char_start": 872,
"chars": "'"
},
{
"char_end": 883,
"char_start": 881,
"chars": "',"
},
{
"char_end": 885,
"char_start": 884,
"chars": "'"
},
{
"char_end": 895,
"char_start": 894,
"chars": "]"
}
],
"deleted": [
{
"char_end": 662,
"char_start": 661,
"chars": "("
},
{
"char_end": 744,
"char_start": 728,
"chars": "12345 1234567890"
},
{
"char_end": 751,
"char_start": 750,
"chars": ")"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/tests/test_hp3par.py",
"func_name": "test_create_modify_host",
"line_changes": {
"added": [
{
"char_end": 565,
"char_start": 504,
"line": " show_host_cmd = ['showhost', '-verbose', 'fakehost']\n",
"line_no": 13
},
{
"char_end": 723,
"char_start": 643,
"line": " create_host_cmd = ['createhost', '-add', 'fakehost', '123456789012345',\n",
"line_no": 16
},
{
"char_end": 769,
"char_start": 723,
"line": " '123456789054321']\n",
"line_no": 17
},
{
"char_end": 896,
"char_start": 835,
"line": " show_host_cmd = ['showhost', '-verbose', 'fakehost']\n",
"line_no": 20
}
],
"deleted": [
{
"char_end": 557,
"char_start": 504,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n",
"line_no": 13
},
{
"char_end": 690,
"char_start": 635,
"line": " create_host_cmd = ('createhost -add fakehost '\n",
"line_no": 16
},
{
"char_end": 752,
"char_start": 690,
"line": " '123456789012345 123456789054321')\n",
"line_no": 17
},
{
"char_end": 871,
"char_start": 818,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n",
"line_no": 20
}
]
},
"vul_type": "cwe-078"
}
| 108
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def install(filename, target):\n '''Run a package's installer script against the given target directory.'''\n print(' Unpacking %s...' % filename)",
" os.system('tar xf ' + filename)",
" basename = filename.split('.tar')[0]\n print(' Installing %s...' % basename)",
" install_opts = '--prefix=${PWD}/%s --disable-ldconfig' % target\n os.system('%s/install.sh %s' % (basename, install_opts))",
" print(' Cleaning %s...' % basename)",
" os.system('rm -rf %s' % basename)"
] |
[
1,
0,
1,
0,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 154,
"char_start": 149,
"chars": "subpr"
},
{
"char_end": 158,
"char_start": 155,
"chars": "ces"
},
{
"char_end": 162,
"char_start": 160,
"chars": "ch"
},
{
"char_end": 170,
"char_start": 163,
"chars": "ck_call"
},
{
"char_end": 172,
"char_start": 171,
"chars": "["
},
{
"char_end": 178,
"char_start": 176,
"chars": "',"
},
{
"char_end": 180,
"char_start": 179,
"chars": "'"
},
{
"char_end": 184,
"char_start": 183,
"chars": ","
},
{
"char_end": 194,
"char_start": 193,
"chars": "]"
},
{
"char_end": 292,
"char_start": 285,
"chars": "cmd = ["
},
{
"char_end": 295,
"char_start": 293,
"chars": "s."
},
{
"char_end": 297,
"char_start": 296,
"chars": "a"
},
{
"char_end": 307,
"char_start": 298,
"chars": "h.join(ba"
},
{
"char_end": 314,
"char_start": 308,
"chars": "ename,"
},
{
"char_end": 345,
"char_start": 315,
"chars": "'install.sh')]\n install_cmd +"
},
{
"char_end": 348,
"char_start": 347,
"chars": "["
},
{
"char_end": 391,
"char_start": 358,
"chars": "' + os.path.abspath(target)]\n in"
},
{
"char_end": 400,
"char_start": 392,
"chars": "tall_cmd"
},
{
"char_end": 406,
"char_start": 401,
"chars": "+= ['"
},
{
"char_end": 427,
"char_start": 425,
"chars": "]\n"
},
{
"char_end": 433,
"char_start": 429,
"chars": "subp"
},
{
"char_end": 438,
"char_start": 435,
"chars": "ces"
},
{
"char_end": 442,
"char_start": 440,
"chars": "ch"
},
{
"char_end": 447,
"char_start": 443,
"chars": "ck_c"
},
{
"char_end": 462,
"char_start": 459,
"chars": "cmd"
},
{
"char_end": 509,
"char_start": 504,
"chars": "subpr"
},
{
"char_end": 512,
"char_start": 510,
"chars": "ce"
},
{
"char_end": 517,
"char_start": 514,
"chars": ".ch"
},
{
"char_end": 525,
"char_start": 518,
"chars": "ck_call"
},
{
"char_end": 527,
"char_start": 526,
"chars": "["
},
{
"char_end": 532,
"char_start": 530,
"chars": "',"
},
{
"char_end": 534,
"char_start": 533,
"chars": "'"
},
{
"char_end": 539,
"char_start": 538,
"chars": ","
},
{
"char_end": 549,
"char_start": 548,
"chars": "]"
}
],
"deleted": [
{
"char_end": 150,
"char_start": 149,
"chars": "o"
},
{
"char_end": 152,
"char_start": 151,
"chars": "."
},
{
"char_end": 154,
"char_start": 153,
"chars": "y"
},
{
"char_end": 156,
"char_start": 155,
"chars": "t"
},
{
"char_end": 158,
"char_start": 157,
"chars": "m"
},
{
"char_end": 167,
"char_start": 166,
"chars": " "
},
{
"char_end": 170,
"char_start": 168,
"chars": " +"
},
{
"char_end": 295,
"char_start": 287,
"chars": "${PWD}/%"
},
{
"char_end": 318,
"char_start": 317,
"chars": "%"
},
{
"char_end": 321,
"char_start": 319,
"chars": "ta"
},
{
"char_end": 328,
"char_start": 322,
"chars": "get\n "
},
{
"char_end": 335,
"char_start": 329,
"chars": "s.syst"
},
{
"char_end": 340,
"char_start": 336,
"chars": "m('%"
},
{
"char_end": 344,
"char_start": 341,
"chars": "/in"
},
{
"char_end": 349,
"char_start": 345,
"chars": "tall"
},
{
"char_end": 351,
"char_start": 350,
"chars": "s"
},
{
"char_end": 363,
"char_start": 352,
"chars": " %s' % (bas"
},
{
"char_end": 365,
"char_start": 364,
"chars": "n"
},
{
"char_end": 370,
"char_start": 366,
"chars": "me, "
},
{
"char_end": 383,
"char_start": 378,
"chars": "opts)"
},
{
"char_end": 428,
"char_start": 426,
"chars": "s."
},
{
"char_end": 430,
"char_start": 429,
"chars": "y"
},
{
"char_end": 432,
"char_start": 431,
"chars": "t"
},
{
"char_end": 434,
"char_start": 433,
"chars": "m"
},
{
"char_end": 445,
"char_start": 442,
"chars": " %s"
},
{
"char_end": 448,
"char_start": 446,
"chars": " %"
}
]
},
"commit_link": "github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb",
"file_name": "repack_rust.py",
"func_name": "install",
"line_changes": {
"added": [
{
"char_end": 196,
"char_start": 147,
"line": " subprocess.check_call(['tar', 'xf', filename])\n",
"line_no": 4
},
{
"char_end": 330,
"char_start": 275,
"line": " install_cmd = [os.path.join(basename, 'install.sh')]\n",
"line_no": 7
},
{
"char_end": 387,
"char_start": 330,
"line": " install_cmd += ['--prefix=' + os.path.abspath(target)]\n",
"line_no": 8
},
{
"char_end": 427,
"char_start": 387,
"line": " install_cmd += ['--disable-ldconfig']\n",
"line_no": 9
},
{
"char_end": 464,
"char_start": 427,
"line": " subprocess.check_call(install_cmd)\n",
"line_no": 10
},
{
"char_end": 550,
"char_start": 502,
"line": " subprocess.check_call(['rm', '-rf', basename])\n",
"line_no": 12
}
],
"deleted": [
{
"char_end": 181,
"char_start": 147,
"line": " os.system('tar xf ' + filename)\n",
"line_no": 4
},
{
"char_end": 326,
"char_start": 260,
"line": " install_opts = '--prefix=${PWD}/%s --disable-ldconfig' % target\n",
"line_no": 7
},
{
"char_end": 385,
"char_start": 326,
"line": " os.system('%s/install.sh %s' % (basename, install_opts))\n",
"line_no": 8
},
{
"char_end": 458,
"char_start": 423,
"line": " os.system('rm -rf %s' % basename)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-078"
}
| 109
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def install(filename, target):\n '''Run a package's installer script against the given target directory.'''\n print(' Unpacking %s...' % filename)",
" subprocess.check_call(['tar', 'xf', filename])",
" basename = filename.split('.tar')[0]\n print(' Installing %s...' % basename)",
" install_cmd = [os.path.join(basename, 'install.sh')]\n install_cmd += ['--prefix=' + os.path.abspath(target)]\n install_cmd += ['--disable-ldconfig']\n subprocess.check_call(install_cmd)",
" print(' Cleaning %s...' % basename)",
" subprocess.check_call(['rm', '-rf', basename])"
] |
[
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 154,
"char_start": 149,
"chars": "subpr"
},
{
"char_end": 158,
"char_start": 155,
"chars": "ces"
},
{
"char_end": 162,
"char_start": 160,
"chars": "ch"
},
{
"char_end": 170,
"char_start": 163,
"chars": "ck_call"
},
{
"char_end": 172,
"char_start": 171,
"chars": "["
},
{
"char_end": 178,
"char_start": 176,
"chars": "',"
},
{
"char_end": 180,
"char_start": 179,
"chars": "'"
},
{
"char_end": 184,
"char_start": 183,
"chars": ","
},
{
"char_end": 194,
"char_start": 193,
"chars": "]"
},
{
"char_end": 292,
"char_start": 285,
"chars": "cmd = ["
},
{
"char_end": 295,
"char_start": 293,
"chars": "s."
},
{
"char_end": 297,
"char_start": 296,
"chars": "a"
},
{
"char_end": 307,
"char_start": 298,
"chars": "h.join(ba"
},
{
"char_end": 314,
"char_start": 308,
"chars": "ename,"
},
{
"char_end": 345,
"char_start": 315,
"chars": "'install.sh')]\n install_cmd +"
},
{
"char_end": 348,
"char_start": 347,
"chars": "["
},
{
"char_end": 391,
"char_start": 358,
"chars": "' + os.path.abspath(target)]\n in"
},
{
"char_end": 400,
"char_start": 392,
"chars": "tall_cmd"
},
{
"char_end": 406,
"char_start": 401,
"chars": "+= ['"
},
{
"char_end": 427,
"char_start": 425,
"chars": "]\n"
},
{
"char_end": 433,
"char_start": 429,
"chars": "subp"
},
{
"char_end": 438,
"char_start": 435,
"chars": "ces"
},
{
"char_end": 442,
"char_start": 440,
"chars": "ch"
},
{
"char_end": 447,
"char_start": 443,
"chars": "ck_c"
},
{
"char_end": 462,
"char_start": 459,
"chars": "cmd"
},
{
"char_end": 509,
"char_start": 504,
"chars": "subpr"
},
{
"char_end": 512,
"char_start": 510,
"chars": "ce"
},
{
"char_end": 517,
"char_start": 514,
"chars": ".ch"
},
{
"char_end": 525,
"char_start": 518,
"chars": "ck_call"
},
{
"char_end": 527,
"char_start": 526,
"chars": "["
},
{
"char_end": 532,
"char_start": 530,
"chars": "',"
},
{
"char_end": 534,
"char_start": 533,
"chars": "'"
},
{
"char_end": 539,
"char_start": 538,
"chars": ","
},
{
"char_end": 549,
"char_start": 548,
"chars": "]"
}
],
"deleted": [
{
"char_end": 150,
"char_start": 149,
"chars": "o"
},
{
"char_end": 152,
"char_start": 151,
"chars": "."
},
{
"char_end": 154,
"char_start": 153,
"chars": "y"
},
{
"char_end": 156,
"char_start": 155,
"chars": "t"
},
{
"char_end": 158,
"char_start": 157,
"chars": "m"
},
{
"char_end": 167,
"char_start": 166,
"chars": " "
},
{
"char_end": 170,
"char_start": 168,
"chars": " +"
},
{
"char_end": 295,
"char_start": 287,
"chars": "${PWD}/%"
},
{
"char_end": 318,
"char_start": 317,
"chars": "%"
},
{
"char_end": 321,
"char_start": 319,
"chars": "ta"
},
{
"char_end": 328,
"char_start": 322,
"chars": "get\n "
},
{
"char_end": 335,
"char_start": 329,
"chars": "s.syst"
},
{
"char_end": 340,
"char_start": 336,
"chars": "m('%"
},
{
"char_end": 344,
"char_start": 341,
"chars": "/in"
},
{
"char_end": 349,
"char_start": 345,
"chars": "tall"
},
{
"char_end": 351,
"char_start": 350,
"chars": "s"
},
{
"char_end": 363,
"char_start": 352,
"chars": " %s' % (bas"
},
{
"char_end": 365,
"char_start": 364,
"chars": "n"
},
{
"char_end": 370,
"char_start": 366,
"chars": "me, "
},
{
"char_end": 383,
"char_start": 378,
"chars": "opts)"
},
{
"char_end": 428,
"char_start": 426,
"chars": "s."
},
{
"char_end": 430,
"char_start": 429,
"chars": "y"
},
{
"char_end": 432,
"char_start": 431,
"chars": "t"
},
{
"char_end": 434,
"char_start": 433,
"chars": "m"
},
{
"char_end": 445,
"char_start": 442,
"chars": " %s"
},
{
"char_end": 448,
"char_start": 446,
"chars": " %"
}
]
},
"commit_link": "github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb",
"file_name": "repack_rust.py",
"func_name": "install",
"line_changes": {
"added": [
{
"char_end": 196,
"char_start": 147,
"line": " subprocess.check_call(['tar', 'xf', filename])\n",
"line_no": 4
},
{
"char_end": 330,
"char_start": 275,
"line": " install_cmd = [os.path.join(basename, 'install.sh')]\n",
"line_no": 7
},
{
"char_end": 387,
"char_start": 330,
"line": " install_cmd += ['--prefix=' + os.path.abspath(target)]\n",
"line_no": 8
},
{
"char_end": 427,
"char_start": 387,
"line": " install_cmd += ['--disable-ldconfig']\n",
"line_no": 9
},
{
"char_end": 464,
"char_start": 427,
"line": " subprocess.check_call(install_cmd)\n",
"line_no": 10
},
{
"char_end": 550,
"char_start": 502,
"line": " subprocess.check_call(['rm', '-rf', basename])\n",
"line_no": 12
}
],
"deleted": [
{
"char_end": 181,
"char_start": 147,
"line": " os.system('tar xf ' + filename)\n",
"line_no": 4
},
{
"char_end": 326,
"char_start": 260,
"line": " install_opts = '--prefix=${PWD}/%s --disable-ldconfig' % target\n",
"line_no": 7
},
{
"char_end": 385,
"char_start": 326,
"line": " os.system('%s/install.sh %s' % (basename, install_opts))\n",
"line_no": 8
},
{
"char_end": 458,
"char_start": 423,
"line": " os.system('rm -rf %s' % basename)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-078"
}
| 109
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _get_least_used_nsp(self, nspss):\n \"\"\"\"Return the nsp that has the fewest active vluns.\"\"\"\n # return only the nsp (node:server:port)",
" result = self.common._cli_run('showvlun -a -showcols Port', None)",
"\n # count the number of nsps (there is 1 for each active vlun)\n nsp_counts = {}\n for nsp in nspss:\n # initialize counts to zero\n nsp_counts[nsp] = 0",
" current_least_used_nsp = None\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n nsp = line.strip()\n if nsp in nsp_counts:\n nsp_counts[nsp] = nsp_counts[nsp] + 1",
" # identify key (nsp) of least used nsp\n current_smallest_count = sys.maxint\n for (nsp, count) in nsp_counts.iteritems():\n if count < current_smallest_count:\n current_least_used_nsp = nsp\n current_smallest_count = count",
" return current_least_used_nsp"
] |
[
1,
0,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 194,
"char_start": 193,
"chars": "["
},
{
"char_end": 205,
"char_start": 203,
"chars": "',"
},
{
"char_end": 207,
"char_start": 206,
"chars": "'"
},
{
"char_end": 211,
"char_start": 209,
"chars": "',"
},
{
"char_end": 213,
"char_start": 212,
"chars": "'"
},
{
"char_end": 224,
"char_start": 222,
"chars": "',"
},
{
"char_end": 226,
"char_start": 225,
"chars": "'"
},
{
"char_end": 232,
"char_start": 231,
"chars": "]"
}
],
"deleted": [
{
"char_end": 227,
"char_start": 221,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_iscsi.py",
"func_name": "_get_least_used_nsp",
"line_changes": {
"added": [
{
"char_end": 234,
"char_start": 155,
"line": " result = self.common._cli_run(['showvlun', '-a', '-showcols', 'Port'])\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 229,
"char_start": 155,
"line": " result = self.common._cli_run('showvlun -a -showcols Port', None)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-078"
}
| 110
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _get_least_used_nsp(self, nspss):\n \"\"\"\"Return the nsp that has the fewest active vluns.\"\"\"\n # return only the nsp (node:server:port)",
" result = self.common._cli_run(['showvlun', '-a', '-showcols', 'Port'])",
"\n # count the number of nsps (there is 1 for each active vlun)\n nsp_counts = {}\n for nsp in nspss:\n # initialize counts to zero\n nsp_counts[nsp] = 0",
" current_least_used_nsp = None\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n nsp = line.strip()\n if nsp in nsp_counts:\n nsp_counts[nsp] = nsp_counts[nsp] + 1",
" # identify key (nsp) of least used nsp\n current_smallest_count = sys.maxint\n for (nsp, count) in nsp_counts.iteritems():\n if count < current_smallest_count:\n current_least_used_nsp = nsp\n current_smallest_count = count",
" return current_least_used_nsp"
] |
[
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 194,
"char_start": 193,
"chars": "["
},
{
"char_end": 205,
"char_start": 203,
"chars": "',"
},
{
"char_end": 207,
"char_start": 206,
"chars": "'"
},
{
"char_end": 211,
"char_start": 209,
"chars": "',"
},
{
"char_end": 213,
"char_start": 212,
"chars": "'"
},
{
"char_end": 224,
"char_start": 222,
"chars": "',"
},
{
"char_end": 226,
"char_start": 225,
"chars": "'"
},
{
"char_end": 232,
"char_start": 231,
"chars": "]"
}
],
"deleted": [
{
"char_end": 227,
"char_start": 221,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_iscsi.py",
"func_name": "_get_least_used_nsp",
"line_changes": {
"added": [
{
"char_end": 234,
"char_start": 155,
"line": " result = self.common._cli_run(['showvlun', '-a', '-showcols', 'Port'])\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 229,
"char_start": 155,
"line": " result = self.common._cli_run('showvlun -a -showcols Port', None)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-078"
}
| 110
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _start_fc_map(self, fc_map_id, source, target):\n try:",
" out, err = self._run_ssh('svctask startfcmap %s' % fc_map_id)",
" except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_start_fc_map: Failed to start FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})"
] |
[
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 107,
"char_start": 106,
"chars": "["
},
{
"char_end": 117,
"char_start": 115,
"chars": "',"
},
{
"char_end": 119,
"char_start": 118,
"chars": "'"
},
{
"char_end": 131,
"char_start": 130,
"chars": ","
},
{
"char_end": 142,
"char_start": 141,
"chars": "]"
}
],
"deleted": [
{
"char_end": 128,
"char_start": 125,
"chars": " %s"
},
{
"char_end": 131,
"char_start": 129,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_start_fc_map",
"line_changes": {
"added": [
{
"char_end": 144,
"char_start": 69,
"line": " out, err = self._run_ssh(['svctask', 'startfcmap', fc_map_id])\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 143,
"char_start": 69,
"line": " out, err = self._run_ssh('svctask startfcmap %s' % fc_map_id)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-078"
}
| 111
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _start_fc_map(self, fc_map_id, source, target):\n try:",
" out, err = self._run_ssh(['svctask', 'startfcmap', fc_map_id])",
" except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_start_fc_map: Failed to start FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})"
] |
[
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 107,
"char_start": 106,
"chars": "["
},
{
"char_end": 117,
"char_start": 115,
"chars": "',"
},
{
"char_end": 119,
"char_start": 118,
"chars": "'"
},
{
"char_end": 131,
"char_start": 130,
"chars": ","
},
{
"char_end": 142,
"char_start": 141,
"chars": "]"
}
],
"deleted": [
{
"char_end": 128,
"char_start": 125,
"chars": " %s"
},
{
"char_end": 131,
"char_start": 129,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_start_fc_map",
"line_changes": {
"added": [
{
"char_end": 144,
"char_start": 69,
"line": " out, err = self._run_ssh(['svctask', 'startfcmap', fc_map_id])\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 143,
"char_start": 69,
"line": " out, err = self._run_ssh('svctask startfcmap %s' % fc_map_id)\n",
"line_no": 3
}
]
},
"vul_type": "cwe-078"
}
| 111
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"@then(parsers.parse(\"the hostname '{hostname}' should be resolved\"))\ndef resolve_hostname(busybox_pod, host, hostname):",
" with host.sudo():\n # test dns resolve\n cmd_nslookup = (\"kubectl --kubeconfig=/etc/kubernetes/admin.conf\"\n \" exec -ti {0} nslookup {1}\".format(\n pod_name,\n hostname))\n res = host.run(cmd_nslookup)\n assert res.rc == 0, \"Cannot resolve {}\".format(hostname)"
] |
[
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 179,
"char_start": 177,
"chars": "re"
},
{
"char_end": 181,
"char_start": 180,
"chars": "u"
},
{
"char_end": 187,
"char_start": 182,
"chars": "t = h"
},
{
"char_end": 192,
"char_start": 188,
"chars": "st.r"
},
{
"char_end": 206,
"char_start": 193,
"chars": "n(\n "
},
{
"char_end": 257,
"char_start": 256,
"chars": " "
},
{
"char_end": 283,
"char_start": 281,
"chars": "%s"
},
{
"char_end": 295,
"char_start": 293,
"chars": "%s"
},
{
"char_end": 297,
"char_start": 296,
"chars": ","
},
{
"char_end": 318,
"char_start": 310,
"chars": "busybox_"
},
{
"char_end": 344,
"char_start": 343,
"chars": ","
},
{
"char_end": 356,
"char_start": 355,
"chars": "\n"
},
{
"char_end": 377,
"char_start": 374,
"chars": "ult"
}
],
"deleted": [
{
"char_end": 128,
"char_start": 124,
"chars": " "
},
{
"char_end": 150,
"char_start": 146,
"chars": " "
},
{
"char_end": 201,
"char_start": 189,
"chars": "cmd_nslookup"
},
{
"char_end": 203,
"char_start": 202,
"chars": "="
},
{
"char_end": 205,
"char_start": 204,
"chars": "("
},
{
"char_end": 265,
"char_start": 255,
"chars": " "
},
{
"char_end": 283,
"char_start": 277,
"chars": " "
},
{
"char_end": 285,
"char_start": 284,
"chars": " "
},
{
"char_end": 297,
"char_start": 294,
"chars": "{0}"
},
{
"char_end": 310,
"char_start": 307,
"chars": "{1}"
},
{
"char_end": 319,
"char_start": 311,
"chars": ".format("
},
{
"char_end": 352,
"char_start": 332,
"chars": " "
},
{
"char_end": 360,
"char_start": 355,
"chars": "_name"
},
{
"char_end": 394,
"char_start": 374,
"chars": " "
},
{
"char_end": 404,
"char_start": 402,
"chars": "))"
},
{
"char_end": 406,
"char_start": 405,
"chars": " "
},
{
"char_end": 444,
"char_start": 414,
"chars": " res = host.run(cmd_nslookup"
},
{
"char_end": 450,
"char_start": 446,
"chars": " "
}
]
},
"commit_link": "github.com/scality/metalk8s/commit/82d92836d4ff78c623a0e06302c94cfa5ff79908",
"file_name": "tests/post/steps/test_dns.py",
"func_name": "resolve_hostname",
"line_changes": {
"added": [
{
"char_end": 142,
"char_start": 120,
"line": " with host.sudo():\n",
"line_no": 3
},
{
"char_end": 196,
"char_start": 169,
"line": " result = host.run(\n",
"line_no": 5
},
{
"char_end": 259,
"char_start": 196,
"line": " \"kubectl --kubeconfig=/etc/kubernetes/admin.conf \"\n",
"line_no": 6
},
{
"char_end": 298,
"char_start": 259,
"line": " \"exec -ti %s nslookup %s\",\n",
"line_no": 7
},
{
"char_end": 323,
"char_start": 298,
"line": " busybox_pod,\n",
"line_no": 8
},
{
"char_end": 345,
"char_start": 323,
"line": " hostname,\n",
"line_no": 9
},
{
"char_end": 355,
"char_start": 345,
"line": " )\n",
"line_no": 10
},
{
"char_end": 356,
"char_start": 355,
"line": "\n",
"line_no": 11
},
{
"char_end": 423,
"char_start": 356,
"line": " assert result.rc == 0, \"Cannot resolve {}\".format(hostname)",
"line_no": 12
}
],
"deleted": [
{
"char_end": 146,
"char_start": 120,
"line": " with host.sudo():\n",
"line_no": 3
},
{
"char_end": 255,
"char_start": 177,
"line": " cmd_nslookup = (\"kubectl --kubeconfig=/etc/kubernetes/admin.conf\"\n",
"line_no": 5
},
{
"char_end": 320,
"char_start": 255,
"line": " \" exec -ti {0} nslookup {1}\".format(\n",
"line_no": 6
},
{
"char_end": 362,
"char_start": 320,
"line": " pod_name,\n",
"line_no": 7
},
{
"char_end": 405,
"char_start": 362,
"line": " hostname))\n",
"line_no": 8
},
{
"char_end": 446,
"char_start": 405,
"line": " res = host.run(cmd_nslookup)\n",
"line_no": 9
},
{
"char_end": 514,
"char_start": 446,
"line": " assert res.rc == 0, \"Cannot resolve {}\".format(hostname)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-078"
}
| 112
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"@then(parsers.parse(\"the hostname '{hostname}' should be resolved\"))\ndef resolve_hostname(busybox_pod, host, hostname):",
" with host.sudo():\n # test dns resolve\n result = host.run(\n \"kubectl --kubeconfig=/etc/kubernetes/admin.conf \"\n \"exec -ti %s nslookup %s\",\n busybox_pod,\n hostname,\n )",
" assert result.rc == 0, \"Cannot resolve {}\".format(hostname)"
] |
[
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 179,
"char_start": 177,
"chars": "re"
},
{
"char_end": 181,
"char_start": 180,
"chars": "u"
},
{
"char_end": 187,
"char_start": 182,
"chars": "t = h"
},
{
"char_end": 192,
"char_start": 188,
"chars": "st.r"
},
{
"char_end": 206,
"char_start": 193,
"chars": "n(\n "
},
{
"char_end": 257,
"char_start": 256,
"chars": " "
},
{
"char_end": 283,
"char_start": 281,
"chars": "%s"
},
{
"char_end": 295,
"char_start": 293,
"chars": "%s"
},
{
"char_end": 297,
"char_start": 296,
"chars": ","
},
{
"char_end": 318,
"char_start": 310,
"chars": "busybox_"
},
{
"char_end": 344,
"char_start": 343,
"chars": ","
},
{
"char_end": 356,
"char_start": 355,
"chars": "\n"
},
{
"char_end": 377,
"char_start": 374,
"chars": "ult"
}
],
"deleted": [
{
"char_end": 128,
"char_start": 124,
"chars": " "
},
{
"char_end": 150,
"char_start": 146,
"chars": " "
},
{
"char_end": 201,
"char_start": 189,
"chars": "cmd_nslookup"
},
{
"char_end": 203,
"char_start": 202,
"chars": "="
},
{
"char_end": 205,
"char_start": 204,
"chars": "("
},
{
"char_end": 265,
"char_start": 255,
"chars": " "
},
{
"char_end": 283,
"char_start": 277,
"chars": " "
},
{
"char_end": 285,
"char_start": 284,
"chars": " "
},
{
"char_end": 297,
"char_start": 294,
"chars": "{0}"
},
{
"char_end": 310,
"char_start": 307,
"chars": "{1}"
},
{
"char_end": 319,
"char_start": 311,
"chars": ".format("
},
{
"char_end": 352,
"char_start": 332,
"chars": " "
},
{
"char_end": 360,
"char_start": 355,
"chars": "_name"
},
{
"char_end": 394,
"char_start": 374,
"chars": " "
},
{
"char_end": 404,
"char_start": 402,
"chars": "))"
},
{
"char_end": 406,
"char_start": 405,
"chars": " "
},
{
"char_end": 444,
"char_start": 414,
"chars": " res = host.run(cmd_nslookup"
},
{
"char_end": 450,
"char_start": 446,
"chars": " "
}
]
},
"commit_link": "github.com/scality/metalk8s/commit/82d92836d4ff78c623a0e06302c94cfa5ff79908",
"file_name": "tests/post/steps/test_dns.py",
"func_name": "resolve_hostname",
"line_changes": {
"added": [
{
"char_end": 142,
"char_start": 120,
"line": " with host.sudo():\n",
"line_no": 3
},
{
"char_end": 196,
"char_start": 169,
"line": " result = host.run(\n",
"line_no": 5
},
{
"char_end": 259,
"char_start": 196,
"line": " \"kubectl --kubeconfig=/etc/kubernetes/admin.conf \"\n",
"line_no": 6
},
{
"char_end": 298,
"char_start": 259,
"line": " \"exec -ti %s nslookup %s\",\n",
"line_no": 7
},
{
"char_end": 323,
"char_start": 298,
"line": " busybox_pod,\n",
"line_no": 8
},
{
"char_end": 345,
"char_start": 323,
"line": " hostname,\n",
"line_no": 9
},
{
"char_end": 355,
"char_start": 345,
"line": " )\n",
"line_no": 10
},
{
"char_end": 356,
"char_start": 355,
"line": "\n",
"line_no": 11
},
{
"char_end": 423,
"char_start": 356,
"line": " assert result.rc == 0, \"Cannot resolve {}\".format(hostname)",
"line_no": 12
}
],
"deleted": [
{
"char_end": 146,
"char_start": 120,
"line": " with host.sudo():\n",
"line_no": 3
},
{
"char_end": 255,
"char_start": 177,
"line": " cmd_nslookup = (\"kubectl --kubeconfig=/etc/kubernetes/admin.conf\"\n",
"line_no": 5
},
{
"char_end": 320,
"char_start": 255,
"line": " \" exec -ti {0} nslookup {1}\".format(\n",
"line_no": 6
},
{
"char_end": 362,
"char_start": 320,
"line": " pod_name,\n",
"line_no": 7
},
{
"char_end": 405,
"char_start": 362,
"line": " hostname))\n",
"line_no": 8
},
{
"char_end": 446,
"char_start": 405,
"line": " res = host.run(cmd_nslookup)\n",
"line_no": 9
},
{
"char_end": 514,
"char_start": 446,
"line": " assert res.rc == 0, \"Cannot resolve {}\".format(hostname)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-078"
}
| 112
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _modify_3par_fibrechan_host(self, hostname, wwn):",
" # when using -add, you can not send the persona or domain options",
" out = self.common._cli_run('createhost -add %s %s'\n % (hostname, \" \".join(wwn)), None)"
] |
[
0,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 56,
"char_start": 55,
"chars": "s"
},
{
"char_end": 146,
"char_start": 145,
"chars": "a"
},
{
"char_end": 152,
"char_start": 147,
"chars": "d = ["
},
{
"char_end": 165,
"char_start": 163,
"chars": "',"
},
{
"char_end": 167,
"char_start": 166,
"chars": "'"
},
{
"char_end": 173,
"char_start": 171,
"chars": "',"
},
{
"char_end": 176,
"char_start": 174,
"chars": "ho"
},
{
"char_end": 183,
"char_start": 177,
"chars": "tname]"
},
{
"char_end": 195,
"char_start": 192,
"chars": "for"
},
{
"char_end": 199,
"char_start": 196,
"chars": "wwn"
},
{
"char_end": 202,
"char_start": 200,
"chars": "in"
},
{
"char_end": 209,
"char_start": 203,
"chars": "wwns:\n"
},
{
"char_end": 242,
"char_start": 221,
"chars": "command.append(wwn)\n\n"
},
{
"char_end": 252,
"char_start": 251,
"chars": "u"
},
{
"char_end": 255,
"char_start": 254,
"chars": "="
},
{
"char_end": 260,
"char_start": 256,
"chars": "self"
},
{
"char_end": 265,
"char_start": 261,
"chars": "comm"
},
{
"char_end": 271,
"char_start": 266,
"chars": "n._cl"
},
{
"char_end": 275,
"char_start": 272,
"chars": "_ru"
},
{
"char_end": 278,
"char_start": 277,
"chars": "c"
},
{
"char_end": 282,
"char_start": 279,
"chars": "mma"
},
{
"char_end": 284,
"char_start": 283,
"chars": "d"
}
],
"deleted": [
{
"char_end": 58,
"char_start": 58,
"chars": ""
},
{
"char_end": 151,
"char_start": 140,
"chars": "out = self."
},
{
"char_end": 156,
"char_start": 155,
"chars": "o"
},
{
"char_end": 167,
"char_start": 157,
"chars": "._cli_run("
},
{
"char_end": 188,
"char_start": 184,
"chars": "%s %"
},
{
"char_end": 190,
"char_start": 189,
"chars": "'"
},
{
"char_end": 194,
"char_start": 191,
"chars": " "
},
{
"char_end": 204,
"char_start": 202,
"chars": " "
},
{
"char_end": 230,
"char_start": 226,
"chars": "% (h"
},
{
"char_end": 232,
"char_start": 231,
"chars": "s"
},
{
"char_end": 238,
"char_start": 233,
"chars": "name,"
},
{
"char_end": 240,
"char_start": 239,
"chars": "\""
},
{
"char_end": 242,
"char_start": 241,
"chars": "\""
},
{
"char_end": 244,
"char_start": 243,
"chars": "j"
},
{
"char_end": 256,
"char_start": 248,
"chars": "wwn)), N"
},
{
"char_end": 259,
"char_start": 258,
"chars": "e"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_fc.py",
"func_name": "_modify_3par_fibrechan_host",
"line_changes": {
"added": [
{
"char_end": 59,
"char_start": 0,
"line": " def _modify_3par_fibrechan_host(self, hostname, wwns):\n",
"line_no": 1
},
{
"char_end": 184,
"char_start": 133,
"line": " command = ['createhost', '-add', hostname]\n",
"line_no": 3
},
{
"char_end": 209,
"char_start": 184,
"line": " for wwn in wwns:\n",
"line_no": 4
},
{
"char_end": 241,
"char_start": 209,
"line": " command.append(wwn)\n",
"line_no": 5
},
{
"char_end": 242,
"char_start": 241,
"line": "\n",
"line_no": 6
},
{
"char_end": 285,
"char_start": 242,
"line": " out = self.common._cli_run(command)\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 58,
"char_start": 0,
"line": " def _modify_3par_fibrechan_host(self, hostname, wwn):\n",
"line_no": 1
},
{
"char_end": 191,
"char_start": 132,
"line": " out = self.common._cli_run('createhost -add %s %s'\n",
"line_no": 3
},
{
"char_end": 260,
"char_start": 191,
"line": " % (hostname, \" \".join(wwn)), None)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-078"
}
| 113
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _modify_3par_fibrechan_host(self, hostname, wwns):",
" # when using -add, you can not send the persona or domain options",
" command = ['createhost', '-add', hostname]\n for wwn in wwns:\n command.append(wwn)",
" out = self.common._cli_run(command)"
] |
[
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 56,
"char_start": 55,
"chars": "s"
},
{
"char_end": 146,
"char_start": 145,
"chars": "a"
},
{
"char_end": 152,
"char_start": 147,
"chars": "d = ["
},
{
"char_end": 165,
"char_start": 163,
"chars": "',"
},
{
"char_end": 167,
"char_start": 166,
"chars": "'"
},
{
"char_end": 173,
"char_start": 171,
"chars": "',"
},
{
"char_end": 176,
"char_start": 174,
"chars": "ho"
},
{
"char_end": 183,
"char_start": 177,
"chars": "tname]"
},
{
"char_end": 195,
"char_start": 192,
"chars": "for"
},
{
"char_end": 199,
"char_start": 196,
"chars": "wwn"
},
{
"char_end": 202,
"char_start": 200,
"chars": "in"
},
{
"char_end": 209,
"char_start": 203,
"chars": "wwns:\n"
},
{
"char_end": 242,
"char_start": 221,
"chars": "command.append(wwn)\n\n"
},
{
"char_end": 252,
"char_start": 251,
"chars": "u"
},
{
"char_end": 255,
"char_start": 254,
"chars": "="
},
{
"char_end": 260,
"char_start": 256,
"chars": "self"
},
{
"char_end": 265,
"char_start": 261,
"chars": "comm"
},
{
"char_end": 271,
"char_start": 266,
"chars": "n._cl"
},
{
"char_end": 275,
"char_start": 272,
"chars": "_ru"
},
{
"char_end": 278,
"char_start": 277,
"chars": "c"
},
{
"char_end": 282,
"char_start": 279,
"chars": "mma"
},
{
"char_end": 284,
"char_start": 283,
"chars": "d"
}
],
"deleted": [
{
"char_end": 58,
"char_start": 58,
"chars": ""
},
{
"char_end": 151,
"char_start": 140,
"chars": "out = self."
},
{
"char_end": 156,
"char_start": 155,
"chars": "o"
},
{
"char_end": 167,
"char_start": 157,
"chars": "._cli_run("
},
{
"char_end": 188,
"char_start": 184,
"chars": "%s %"
},
{
"char_end": 190,
"char_start": 189,
"chars": "'"
},
{
"char_end": 194,
"char_start": 191,
"chars": " "
},
{
"char_end": 204,
"char_start": 202,
"chars": " "
},
{
"char_end": 230,
"char_start": 226,
"chars": "% (h"
},
{
"char_end": 232,
"char_start": 231,
"chars": "s"
},
{
"char_end": 238,
"char_start": 233,
"chars": "name,"
},
{
"char_end": 240,
"char_start": 239,
"chars": "\""
},
{
"char_end": 242,
"char_start": 241,
"chars": "\""
},
{
"char_end": 244,
"char_start": 243,
"chars": "j"
},
{
"char_end": 256,
"char_start": 248,
"chars": "wwn)), N"
},
{
"char_end": 259,
"char_start": 258,
"chars": "e"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_fc.py",
"func_name": "_modify_3par_fibrechan_host",
"line_changes": {
"added": [
{
"char_end": 59,
"char_start": 0,
"line": " def _modify_3par_fibrechan_host(self, hostname, wwns):\n",
"line_no": 1
},
{
"char_end": 184,
"char_start": 133,
"line": " command = ['createhost', '-add', hostname]\n",
"line_no": 3
},
{
"char_end": 209,
"char_start": 184,
"line": " for wwn in wwns:\n",
"line_no": 4
},
{
"char_end": 241,
"char_start": 209,
"line": " command.append(wwn)\n",
"line_no": 5
},
{
"char_end": 242,
"char_start": 241,
"line": "\n",
"line_no": 6
},
{
"char_end": 285,
"char_start": 242,
"line": " out = self.common._cli_run(command)\n",
"line_no": 7
}
],
"deleted": [
{
"char_end": 58,
"char_start": 0,
"line": " def _modify_3par_fibrechan_host(self, hostname, wwn):\n",
"line_no": 1
},
{
"char_end": 191,
"char_start": 132,
"line": " out = self.common._cli_run('createhost -add %s %s'\n",
"line_no": 3
},
{
"char_end": 260,
"char_start": 191,
"line": " % (hostname, \" \".join(wwn)), None)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-078"
}
| 113
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_settings_path_skip_issue_909(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'skip =\\n'\n ' file_to_be_skipped.py\\n'\n 'skip_glob =\\n'\n ' *glob_skip*\\n')",
" base_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n base_dir.join('file_to_be_skipped.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')",
" test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n with pytest.raises(Exception): # without the settings path provided: the command should not skip & identify errors",
" check_output(['isort', '--check-only'])\n results = check_output(['isort', '--check-only', '--settings-path=conf/.isort.cfg'])",
" os.chdir(str(test_run_directory))\n",
" assert b'skipped 2' in results.lower()"
] |
[
1,
1,
1,
0,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 1215,
"char_start": 1209,
"chars": "subpro"
},
{
"char_end": 1221,
"char_start": 1217,
"chars": "ss.r"
},
{
"char_end": 1223,
"char_start": 1222,
"chars": "n"
},
{
"char_end": 1261,
"char_start": 1249,
"chars": ", check=True"
},
{
"char_end": 1282,
"char_start": 1276,
"chars": "subpro"
},
{
"char_end": 1288,
"char_start": 1284,
"chars": "ss.r"
},
{
"char_end": 1290,
"char_start": 1289,
"chars": "n"
},
{
"char_end": 1300,
"char_start": 1291,
"chars": "\n "
},
{
"char_end": 1417,
"char_start": 1360,
"chars": ",\n stdout=subprocess.PIPE,\n check=True\n "
},
{
"char_end": 1492,
"char_start": 1491,
"chars": "."
},
{
"char_end": 1498,
"char_start": 1493,
"chars": "tdout"
}
],
"deleted": [
{
"char_end": 1216,
"char_start": 1209,
"chars": "check_o"
},
{
"char_end": 1218,
"char_start": 1217,
"chars": "t"
},
{
"char_end": 1221,
"char_start": 1220,
"chars": "t"
},
{
"char_end": 1260,
"char_start": 1259,
"chars": "s"
},
{
"char_end": 1265,
"char_start": 1264,
"chars": "h"
},
{
"char_end": 1273,
"char_start": 1266,
"chars": "ck_outp"
},
{
"char_end": 1275,
"char_start": 1274,
"chars": "t"
}
]
},
"commit_link": "github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76",
"file_name": "test_isort.py",
"func_name": "test_settings_path_skip_issue_909",
"line_changes": {
"added": [
{
"char_end": 1263,
"char_start": 1201,
"line": " subprocess.run(['isort', '--check-only'], check=True)\n",
"line_no": 24
},
{
"char_end": 1292,
"char_start": 1263,
"line": " result = subprocess.run(\n",
"line_no": 25
},
{
"char_end": 1362,
"char_start": 1292,
"line": " ['isort', '--check-only', '--settings-path=conf/.isort.cfg'],\n",
"line_no": 26
},
{
"char_end": 1394,
"char_start": 1362,
"line": " stdout=subprocess.PIPE,\n",
"line_no": 27
},
{
"char_end": 1413,
"char_start": 1394,
"line": " check=True\n",
"line_no": 28
},
{
"char_end": 1419,
"char_start": 1413,
"line": " )\n",
"line_no": 29
},
{
"char_end": 1506,
"char_start": 1458,
"line": " assert b'skipped 2' in result.stdout.lower()\n",
"line_no": 32
}
],
"deleted": [
{
"char_end": 1249,
"char_start": 1201,
"line": " check_output(['isort', '--check-only'])\n",
"line_no": 24
},
{
"char_end": 1338,
"char_start": 1249,
"line": " results = check_output(['isort', '--check-only', '--settings-path=conf/.isort.cfg'])\n",
"line_no": 25
},
{
"char_end": 1419,
"char_start": 1377,
"line": " assert b'skipped 2' in results.lower()\n",
"line_no": 28
}
]
},
"vul_type": "cwe-078"
}
| 114
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_settings_path_skip_issue_909(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'skip =\\n'\n ' file_to_be_skipped.py\\n'\n 'skip_glob =\\n'\n ' *glob_skip*\\n')",
" base_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n base_dir.join('file_to_be_skipped.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')",
" test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n with pytest.raises(Exception): # without the settings path provided: the command should not skip & identify errors",
" subprocess.run(['isort', '--check-only'], check=True)\n result = subprocess.run(\n ['isort', '--check-only', '--settings-path=conf/.isort.cfg'],\n stdout=subprocess.PIPE,\n check=True\n )",
" os.chdir(str(test_run_directory))\n",
" assert b'skipped 2' in result.stdout.lower()"
] |
[
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 1215,
"char_start": 1209,
"chars": "subpro"
},
{
"char_end": 1221,
"char_start": 1217,
"chars": "ss.r"
},
{
"char_end": 1223,
"char_start": 1222,
"chars": "n"
},
{
"char_end": 1261,
"char_start": 1249,
"chars": ", check=True"
},
{
"char_end": 1282,
"char_start": 1276,
"chars": "subpro"
},
{
"char_end": 1288,
"char_start": 1284,
"chars": "ss.r"
},
{
"char_end": 1290,
"char_start": 1289,
"chars": "n"
},
{
"char_end": 1300,
"char_start": 1291,
"chars": "\n "
},
{
"char_end": 1417,
"char_start": 1360,
"chars": ",\n stdout=subprocess.PIPE,\n check=True\n "
},
{
"char_end": 1492,
"char_start": 1491,
"chars": "."
},
{
"char_end": 1498,
"char_start": 1493,
"chars": "tdout"
}
],
"deleted": [
{
"char_end": 1216,
"char_start": 1209,
"chars": "check_o"
},
{
"char_end": 1218,
"char_start": 1217,
"chars": "t"
},
{
"char_end": 1221,
"char_start": 1220,
"chars": "t"
},
{
"char_end": 1260,
"char_start": 1259,
"chars": "s"
},
{
"char_end": 1265,
"char_start": 1264,
"chars": "h"
},
{
"char_end": 1273,
"char_start": 1266,
"chars": "ck_outp"
},
{
"char_end": 1275,
"char_start": 1274,
"chars": "t"
}
]
},
"commit_link": "github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76",
"file_name": "test_isort.py",
"func_name": "test_settings_path_skip_issue_909",
"line_changes": {
"added": [
{
"char_end": 1263,
"char_start": 1201,
"line": " subprocess.run(['isort', '--check-only'], check=True)\n",
"line_no": 24
},
{
"char_end": 1292,
"char_start": 1263,
"line": " result = subprocess.run(\n",
"line_no": 25
},
{
"char_end": 1362,
"char_start": 1292,
"line": " ['isort', '--check-only', '--settings-path=conf/.isort.cfg'],\n",
"line_no": 26
},
{
"char_end": 1394,
"char_start": 1362,
"line": " stdout=subprocess.PIPE,\n",
"line_no": 27
},
{
"char_end": 1413,
"char_start": 1394,
"line": " check=True\n",
"line_no": 28
},
{
"char_end": 1419,
"char_start": 1413,
"line": " )\n",
"line_no": 29
},
{
"char_end": 1506,
"char_start": 1458,
"line": " assert b'skipped 2' in result.stdout.lower()\n",
"line_no": 32
}
],
"deleted": [
{
"char_end": 1249,
"char_start": 1201,
"line": " check_output(['isort', '--check-only'])\n",
"line_no": 24
},
{
"char_end": 1338,
"char_start": 1249,
"line": " results = check_output(['isort', '--check-only', '--settings-path=conf/.isort.cfg'])\n",
"line_no": 25
},
{
"char_end": 1419,
"char_start": 1377,
"line": " assert b'skipped 2' in results.lower()\n",
"line_no": 28
}
]
},
"vul_type": "cwe-078"
}
| 114
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):",
" \"\"\"Create a 3PAR host.",
" Create a 3PAR host, if there is already a host on the 3par using\n the same wwn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"",
" out = self.common._cli_run('createhost -persona %s -domain %s %s %s'\n % (persona_id, domain,\n hostname, \" \".join(wwn)), None)",
" if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)",
" return hostname"
] |
[
0,
1,
1,
0,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 56,
"char_start": 55,
"chars": "s"
},
{
"char_end": 303,
"char_start": 302,
"chars": "a"
},
{
"char_end": 309,
"char_start": 304,
"chars": "d = ["
},
{
"char_end": 322,
"char_start": 320,
"chars": "',"
},
{
"char_end": 324,
"char_start": 323,
"chars": "'"
},
{
"char_end": 334,
"char_start": 332,
"chars": "',"
},
{
"char_end": 338,
"char_start": 335,
"chars": "per"
},
{
"char_end": 346,
"char_start": 339,
"chars": "ona_id,"
},
{
"char_end": 348,
"char_start": 347,
"chars": "'"
},
{
"char_end": 357,
"char_start": 355,
"chars": "',"
},
{
"char_end": 365,
"char_start": 358,
"chars": "domain,"
},
{
"char_end": 387,
"char_start": 385,
"chars": "ho"
},
{
"char_end": 389,
"char_start": 388,
"chars": "t"
},
{
"char_end": 394,
"char_start": 392,
"chars": "e]"
},
{
"char_end": 406,
"char_start": 403,
"chars": "for"
},
{
"char_end": 410,
"char_start": 407,
"chars": "wwn"
},
{
"char_end": 413,
"char_start": 411,
"chars": "in"
},
{
"char_end": 420,
"char_start": 414,
"chars": "wwns:\n"
},
{
"char_end": 453,
"char_start": 432,
"chars": "command.append(wwn)\n\n"
},
{
"char_end": 463,
"char_start": 462,
"chars": "u"
},
{
"char_end": 466,
"char_start": 465,
"chars": "="
},
{
"char_end": 471,
"char_start": 467,
"chars": "self"
},
{
"char_end": 476,
"char_start": 472,
"chars": "comm"
},
{
"char_end": 482,
"char_start": 477,
"chars": "n._cl"
},
{
"char_end": 486,
"char_start": 483,
"chars": "_ru"
},
{
"char_end": 489,
"char_start": 488,
"chars": "c"
},
{
"char_end": 493,
"char_start": 490,
"chars": "mma"
},
{
"char_end": 495,
"char_start": 494,
"chars": "d"
}
],
"deleted": [
{
"char_end": 308,
"char_start": 297,
"chars": "out = self."
},
{
"char_end": 313,
"char_start": 312,
"chars": "o"
},
{
"char_end": 324,
"char_start": 314,
"chars": "._cli_run("
},
{
"char_end": 346,
"char_start": 345,
"chars": "%"
},
{
"char_end": 365,
"char_start": 356,
"chars": "%s %s %s'"
},
{
"char_end": 373,
"char_start": 366,
"chars": " "
},
{
"char_end": 407,
"char_start": 392,
"chars": " % (per"
},
{
"char_end": 409,
"char_start": 408,
"chars": "o"
},
{
"char_end": 418,
"char_start": 411,
"chars": "_id, do"
},
{
"char_end": 423,
"char_start": 419,
"chars": "ain,"
},
{
"char_end": 461,
"char_start": 456,
"chars": " "
},
{
"char_end": 464,
"char_start": 462,
"chars": "ho"
},
{
"char_end": 469,
"char_start": 465,
"chars": "tnam"
},
{
"char_end": 475,
"char_start": 470,
"chars": ", \" \""
},
{
"char_end": 477,
"char_start": 476,
"chars": "j"
},
{
"char_end": 489,
"char_start": 481,
"chars": "wwn)), N"
},
{
"char_end": 492,
"char_start": 491,
"chars": "e"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_fc.py",
"func_name": "_create_3par_fibrechan_host",
"line_changes": {
"added": [
{
"char_end": 79,
"char_start": 0,
"line": " def _create_3par_fibrechan_host(self, hostname, wwns, domain, persona_id):\n",
"line_no": 1
},
{
"char_end": 366,
"char_start": 290,
"line": " command = ['createhost', '-persona', persona_id, '-domain', domain,\n",
"line_no": 8
},
{
"char_end": 395,
"char_start": 366,
"line": " hostname]\n",
"line_no": 9
},
{
"char_end": 420,
"char_start": 395,
"line": " for wwn in wwns:\n",
"line_no": 10
},
{
"char_end": 452,
"char_start": 420,
"line": " command.append(wwn)\n",
"line_no": 11
},
{
"char_end": 453,
"char_start": 452,
"line": "\n",
"line_no": 12
},
{
"char_end": 497,
"char_start": 453,
"line": " out = self.common._cli_run(command)\n",
"line_no": 13
}
],
"deleted": [
{
"char_end": 78,
"char_start": 0,
"line": " def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):\n",
"line_no": 1
},
{
"char_end": 366,
"char_start": 289,
"line": " out = self.common._cli_run('createhost -persona %s -domain %s %s %s'\n",
"line_no": 8
},
{
"char_end": 424,
"char_start": 366,
"line": " % (persona_id, domain,\n",
"line_no": 9
},
{
"char_end": 494,
"char_start": 424,
"line": " hostname, \" \".join(wwn)), None)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-078"
}
| 115
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _create_3par_fibrechan_host(self, hostname, wwns, domain, persona_id):",
" \"\"\"Create a 3PAR host.",
" Create a 3PAR host, if there is already a host on the 3par using\n the same wwn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"",
" command = ['createhost', '-persona', persona_id, '-domain', domain,\n hostname]\n for wwn in wwns:\n command.append(wwn)",
" out = self.common._cli_run(command)",
" if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)",
" return hostname"
] |
[
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 56,
"char_start": 55,
"chars": "s"
},
{
"char_end": 303,
"char_start": 302,
"chars": "a"
},
{
"char_end": 309,
"char_start": 304,
"chars": "d = ["
},
{
"char_end": 322,
"char_start": 320,
"chars": "',"
},
{
"char_end": 324,
"char_start": 323,
"chars": "'"
},
{
"char_end": 334,
"char_start": 332,
"chars": "',"
},
{
"char_end": 338,
"char_start": 335,
"chars": "per"
},
{
"char_end": 346,
"char_start": 339,
"chars": "ona_id,"
},
{
"char_end": 348,
"char_start": 347,
"chars": "'"
},
{
"char_end": 357,
"char_start": 355,
"chars": "',"
},
{
"char_end": 365,
"char_start": 358,
"chars": "domain,"
},
{
"char_end": 387,
"char_start": 385,
"chars": "ho"
},
{
"char_end": 389,
"char_start": 388,
"chars": "t"
},
{
"char_end": 394,
"char_start": 392,
"chars": "e]"
},
{
"char_end": 406,
"char_start": 403,
"chars": "for"
},
{
"char_end": 410,
"char_start": 407,
"chars": "wwn"
},
{
"char_end": 413,
"char_start": 411,
"chars": "in"
},
{
"char_end": 420,
"char_start": 414,
"chars": "wwns:\n"
},
{
"char_end": 453,
"char_start": 432,
"chars": "command.append(wwn)\n\n"
},
{
"char_end": 463,
"char_start": 462,
"chars": "u"
},
{
"char_end": 466,
"char_start": 465,
"chars": "="
},
{
"char_end": 471,
"char_start": 467,
"chars": "self"
},
{
"char_end": 476,
"char_start": 472,
"chars": "comm"
},
{
"char_end": 482,
"char_start": 477,
"chars": "n._cl"
},
{
"char_end": 486,
"char_start": 483,
"chars": "_ru"
},
{
"char_end": 489,
"char_start": 488,
"chars": "c"
},
{
"char_end": 493,
"char_start": 490,
"chars": "mma"
},
{
"char_end": 495,
"char_start": 494,
"chars": "d"
}
],
"deleted": [
{
"char_end": 308,
"char_start": 297,
"chars": "out = self."
},
{
"char_end": 313,
"char_start": 312,
"chars": "o"
},
{
"char_end": 324,
"char_start": 314,
"chars": "._cli_run("
},
{
"char_end": 346,
"char_start": 345,
"chars": "%"
},
{
"char_end": 365,
"char_start": 356,
"chars": "%s %s %s'"
},
{
"char_end": 373,
"char_start": 366,
"chars": " "
},
{
"char_end": 407,
"char_start": 392,
"chars": " % (per"
},
{
"char_end": 409,
"char_start": 408,
"chars": "o"
},
{
"char_end": 418,
"char_start": 411,
"chars": "_id, do"
},
{
"char_end": 423,
"char_start": 419,
"chars": "ain,"
},
{
"char_end": 461,
"char_start": 456,
"chars": " "
},
{
"char_end": 464,
"char_start": 462,
"chars": "ho"
},
{
"char_end": 469,
"char_start": 465,
"chars": "tnam"
},
{
"char_end": 475,
"char_start": 470,
"chars": ", \" \""
},
{
"char_end": 477,
"char_start": 476,
"chars": "j"
},
{
"char_end": 489,
"char_start": 481,
"chars": "wwn)), N"
},
{
"char_end": 492,
"char_start": 491,
"chars": "e"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_fc.py",
"func_name": "_create_3par_fibrechan_host",
"line_changes": {
"added": [
{
"char_end": 79,
"char_start": 0,
"line": " def _create_3par_fibrechan_host(self, hostname, wwns, domain, persona_id):\n",
"line_no": 1
},
{
"char_end": 366,
"char_start": 290,
"line": " command = ['createhost', '-persona', persona_id, '-domain', domain,\n",
"line_no": 8
},
{
"char_end": 395,
"char_start": 366,
"line": " hostname]\n",
"line_no": 9
},
{
"char_end": 420,
"char_start": 395,
"line": " for wwn in wwns:\n",
"line_no": 10
},
{
"char_end": 452,
"char_start": 420,
"line": " command.append(wwn)\n",
"line_no": 11
},
{
"char_end": 453,
"char_start": 452,
"line": "\n",
"line_no": 12
},
{
"char_end": 497,
"char_start": 453,
"line": " out = self.common._cli_run(command)\n",
"line_no": 13
}
],
"deleted": [
{
"char_end": 78,
"char_start": 0,
"line": " def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):\n",
"line_no": 1
},
{
"char_end": 366,
"char_start": 289,
"line": " out = self.common._cli_run('createhost -persona %s -domain %s %s %s'\n",
"line_no": 8
},
{
"char_end": 424,
"char_start": 366,
"line": " % (persona_id, domain,\n",
"line_no": 9
},
{
"char_end": 494,
"char_start": 424,
"line": " hostname, \" \".join(wwn)), None)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-078"
}
| 115
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def take_bug_report(self, test_name, begin_time):\n \"\"\"Takes a bug report on the device and stores it in a file.",
" Args:\n test_name: Name of the test case that triggered this bug report.\n begin_time: Logline format timestamp taken when the test started.\n \"\"\"\n new_br = True\n try:\n stdout = self.adb.shell('bugreportz -v').decode('utf-8')\n # This check is necessary for builds before N, where adb shell's ret\n # code and stderr are not propagated properly.\n if 'not found' in stdout:\n new_br = False\n except adb.AdbError:\n new_br = False\n br_path = os.path.join(self.log_path, 'BugReports')\n utils.create_dir(br_path)\n base_name = ',%s,%s.txt' % (begin_time, self.serial)\n if new_br:\n base_name = base_name.replace('.txt', '.zip')\n test_name_len = utils.MAX_FILENAME_LEN - len(base_name)\n out_name = test_name[:test_name_len] + base_name\n full_out_path = os.path.join(br_path, out_name.replace(' ', r'\\ '))\n # in case device restarted, wait for adb interface to return\n self.wait_for_boot_completion()\n self.log.info('Taking bugreport for %s.', test_name)\n if new_br:\n out = self.adb.shell('bugreportz').decode('utf-8')\n if not out.startswith('OK'):\n raise DeviceError(self, 'Failed to take bugreport: %s' % out)\n br_out_path = out.split(':')[1].strip()",
" self.adb.pull('%s %s' % (br_out_path, full_out_path))",
" else:",
" self.adb.bugreport(' > %s' % full_out_path)",
" self.log.info('Bugreport for %s taken at %s.', test_name,\n full_out_path)"
] |
[
1,
1,
0,
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 1553,
"char_start": 1552,
"chars": "["
},
{
"char_end": 1580,
"char_start": 1579,
"chars": "]"
},
{
"char_end": 1725,
"char_start": 1608,
"chars": "# shell=True as this command redirects the stdout to a local file\n # using shell redirection.\n "
},
{
"char_end": 1779,
"char_start": 1767,
"chars": ", shell=True"
}
],
"deleted": [
{
"char_end": 1563,
"char_start": 1552,
"chars": "'%s %s' % ("
},
{
"char_end": 1590,
"char_start": 1589,
"chars": ")"
}
]
},
"commit_link": "github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee",
"file_name": "mobly/controllers/android_device.py",
"func_name": "take_bug_report",
"line_changes": {
"added": [
{
"char_end": 1582,
"char_start": 1526,
"line": " self.adb.pull([br_out_path, full_out_path])\n",
"line_no": 33
},
{
"char_end": 1781,
"char_start": 1713,
"line": " self.adb.bugreport(' > %s' % full_out_path, shell=True)\n",
"line_no": 37
}
],
"deleted": [
{
"char_end": 1592,
"char_start": 1526,
"line": " self.adb.pull('%s %s' % (br_out_path, full_out_path))\n",
"line_no": 33
},
{
"char_end": 1662,
"char_start": 1606,
"line": " self.adb.bugreport(' > %s' % full_out_path)\n",
"line_no": 35
}
]
},
"vul_type": "cwe-078"
}
| 116
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def take_bug_report(self, test_name, begin_time):\n \"\"\"Takes a bug report on the device and stores it in a file.",
" Args:\n test_name: Name of the test case that triggered this bug report.\n begin_time: Logline format timestamp taken when the test started.\n \"\"\"\n new_br = True\n try:\n stdout = self.adb.shell('bugreportz -v').decode('utf-8')\n # This check is necessary for builds before N, where adb shell's ret\n # code and stderr are not propagated properly.\n if 'not found' in stdout:\n new_br = False\n except adb.AdbError:\n new_br = False\n br_path = os.path.join(self.log_path, 'BugReports')\n utils.create_dir(br_path)\n base_name = ',%s,%s.txt' % (begin_time, self.serial)\n if new_br:\n base_name = base_name.replace('.txt', '.zip')\n test_name_len = utils.MAX_FILENAME_LEN - len(base_name)\n out_name = test_name[:test_name_len] + base_name\n full_out_path = os.path.join(br_path, out_name.replace(' ', r'\\ '))\n # in case device restarted, wait for adb interface to return\n self.wait_for_boot_completion()\n self.log.info('Taking bugreport for %s.', test_name)\n if new_br:\n out = self.adb.shell('bugreportz').decode('utf-8')\n if not out.startswith('OK'):\n raise DeviceError(self, 'Failed to take bugreport: %s' % out)\n br_out_path = out.split(':')[1].strip()",
" self.adb.pull([br_out_path, full_out_path])",
" else:",
" # shell=True as this command redirects the stdout to a local file\n # using shell redirection.\n self.adb.bugreport(' > %s' % full_out_path, shell=True)",
" self.log.info('Bugreport for %s taken at %s.', test_name,\n full_out_path)"
] |
[
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 1553,
"char_start": 1552,
"chars": "["
},
{
"char_end": 1580,
"char_start": 1579,
"chars": "]"
},
{
"char_end": 1725,
"char_start": 1608,
"chars": "# shell=True as this command redirects the stdout to a local file\n # using shell redirection.\n "
},
{
"char_end": 1779,
"char_start": 1767,
"chars": ", shell=True"
}
],
"deleted": [
{
"char_end": 1563,
"char_start": 1552,
"chars": "'%s %s' % ("
},
{
"char_end": 1590,
"char_start": 1589,
"chars": ")"
}
]
},
"commit_link": "github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee",
"file_name": "mobly/controllers/android_device.py",
"func_name": "take_bug_report",
"line_changes": {
"added": [
{
"char_end": 1582,
"char_start": 1526,
"line": " self.adb.pull([br_out_path, full_out_path])\n",
"line_no": 33
},
{
"char_end": 1781,
"char_start": 1713,
"line": " self.adb.bugreport(' > %s' % full_out_path, shell=True)\n",
"line_no": 37
}
],
"deleted": [
{
"char_end": 1592,
"char_start": 1526,
"line": " self.adb.pull('%s %s' % (br_out_path, full_out_path))\n",
"line_no": 33
},
{
"char_end": 1662,
"char_start": 1606,
"line": " self.adb.bugreport(' > %s' % full_out_path)\n",
"line_no": 35
}
]
},
"vul_type": "cwe-078"
}
| 116
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)",
" #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n",
" show_host_cmd = 'showhost -verbose fakehost'",
" _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n",
" create_host_cmd = ('createhost -iscsi -persona 1 -domain '\n '(\\'OpenStack\\',) '\n 'fakehost iqn.1993-08.org.debian:01:222')",
" in_use_ret = pack('\\r\\nalready used by host fakehost.foo ')\n _run_ssh(create_host_cmd, False).AndReturn([in_use_ret, ''])\n",
" show_3par_cmd = 'showhost -verbose fakehost.foo'",
" _run_ssh(show_3par_cmd, False).AndReturn([pack(ISCSI_3PAR_RET), ''])\n self.mox.ReplayAll()",
" host = self.driver._create_host(self.volume, self.connector)",
" self.assertEquals(host['name'], 'fakehost.foo')"
] |
[
1,
1,
0,
1,
0,
1,
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 530,
"char_start": 529,
"chars": "["
},
{
"char_end": 541,
"char_start": 539,
"chars": "',"
},
{
"char_end": 543,
"char_start": 542,
"chars": "'"
},
{
"char_end": 553,
"char_start": 551,
"chars": "',"
},
{
"char_end": 555,
"char_start": 554,
"chars": "'"
},
{
"char_end": 565,
"char_start": 564,
"chars": "]"
},
{
"char_end": 675,
"char_start": 674,
"chars": "["
},
{
"char_end": 688,
"char_start": 686,
"chars": "',"
},
{
"char_end": 690,
"char_start": 689,
"chars": "'"
},
{
"char_end": 698,
"char_start": 696,
"chars": "',"
},
{
"char_end": 700,
"char_start": 699,
"chars": "'"
},
{
"char_end": 710,
"char_start": 708,
"chars": "',"
},
{
"char_end": 712,
"char_start": 711,
"chars": "'"
},
{
"char_end": 715,
"char_start": 713,
"chars": "',"
},
{
"char_end": 717,
"char_start": 716,
"chars": "'"
},
{
"char_end": 726,
"char_start": 725,
"chars": ","
},
{
"char_end": 769,
"char_start": 768,
"chars": ","
},
{
"char_end": 781,
"char_start": 771,
"chars": "fakehost',"
},
{
"char_end": 783,
"char_start": 782,
"chars": " "
},
{
"char_end": 842,
"char_start": 841,
"chars": "]"
},
{
"char_end": 1007,
"char_start": 1006,
"chars": "["
},
{
"char_end": 1018,
"char_start": 1016,
"chars": "',"
},
{
"char_end": 1020,
"char_start": 1019,
"chars": "'"
},
{
"char_end": 1030,
"char_start": 1028,
"chars": "',"
},
{
"char_end": 1032,
"char_start": 1031,
"chars": "'"
},
{
"char_end": 1046,
"char_start": 1045,
"chars": "]"
}
],
"deleted": [
{
"char_end": 704,
"char_start": 703,
"chars": " "
},
{
"char_end": 734,
"char_start": 733,
"chars": "'"
},
{
"char_end": 736,
"char_start": 735,
"chars": "\\"
},
{
"char_end": 747,
"char_start": 746,
"chars": "\\"
},
{
"char_end": 789,
"char_start": 780,
"chars": "'fakehost"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/tests/test_hp3par.py",
"func_name": "test_create_invalid_host",
"line_changes": {
"added": [
{
"char_end": 566,
"char_start": 505,
"line": " show_host_cmd = ['showhost', '-verbose', 'fakehost']\n",
"line_no": 13
},
{
"char_end": 727,
"char_start": 647,
"line": " create_host_cmd = (['createhost', '-iscsi', '-persona', '1', '-domain',\n",
"line_no": 16
},
{
"char_end": 782,
"char_start": 727,
"line": " ('OpenStack',), 'fakehost',\n",
"line_no": 17
},
{
"char_end": 844,
"char_start": 782,
"line": " 'iqn.1993-08.org.debian:01:222'])\n",
"line_no": 18
},
{
"char_end": 1047,
"char_start": 982,
"line": " show_3par_cmd = ['showhost', '-verbose', 'fakehost.foo']\n",
"line_no": 22
}
],
"deleted": [
{
"char_end": 558,
"char_start": 505,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n",
"line_no": 13
},
{
"char_end": 706,
"char_start": 639,
"line": " create_host_cmd = ('createhost -iscsi -persona 1 -domain '\n",
"line_no": 16
},
{
"char_end": 753,
"char_start": 706,
"line": " '(\\'OpenStack\\',) '\n",
"line_no": 17
},
{
"char_end": 822,
"char_start": 753,
"line": " 'fakehost iqn.1993-08.org.debian:01:222')\n",
"line_no": 18
},
{
"char_end": 1017,
"char_start": 960,
"line": " show_3par_cmd = 'showhost -verbose fakehost.foo'\n",
"line_no": 22
}
]
},
"vul_type": "cwe-078"
}
| 117
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)",
" #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n",
" show_host_cmd = ['showhost', '-verbose', 'fakehost']",
" _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n",
" create_host_cmd = (['createhost', '-iscsi', '-persona', '1', '-domain',\n ('OpenStack',), 'fakehost',\n 'iqn.1993-08.org.debian:01:222'])",
" in_use_ret = pack('\\r\\nalready used by host fakehost.foo ')\n _run_ssh(create_host_cmd, False).AndReturn([in_use_ret, ''])\n",
" show_3par_cmd = ['showhost', '-verbose', 'fakehost.foo']",
" _run_ssh(show_3par_cmd, False).AndReturn([pack(ISCSI_3PAR_RET), ''])\n self.mox.ReplayAll()",
" host = self.driver._create_host(self.volume, self.connector)",
" self.assertEquals(host['name'], 'fakehost.foo')"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 530,
"char_start": 529,
"chars": "["
},
{
"char_end": 541,
"char_start": 539,
"chars": "',"
},
{
"char_end": 543,
"char_start": 542,
"chars": "'"
},
{
"char_end": 553,
"char_start": 551,
"chars": "',"
},
{
"char_end": 555,
"char_start": 554,
"chars": "'"
},
{
"char_end": 565,
"char_start": 564,
"chars": "]"
},
{
"char_end": 675,
"char_start": 674,
"chars": "["
},
{
"char_end": 688,
"char_start": 686,
"chars": "',"
},
{
"char_end": 690,
"char_start": 689,
"chars": "'"
},
{
"char_end": 698,
"char_start": 696,
"chars": "',"
},
{
"char_end": 700,
"char_start": 699,
"chars": "'"
},
{
"char_end": 710,
"char_start": 708,
"chars": "',"
},
{
"char_end": 712,
"char_start": 711,
"chars": "'"
},
{
"char_end": 715,
"char_start": 713,
"chars": "',"
},
{
"char_end": 717,
"char_start": 716,
"chars": "'"
},
{
"char_end": 726,
"char_start": 725,
"chars": ","
},
{
"char_end": 769,
"char_start": 768,
"chars": ","
},
{
"char_end": 781,
"char_start": 771,
"chars": "fakehost',"
},
{
"char_end": 783,
"char_start": 782,
"chars": " "
},
{
"char_end": 842,
"char_start": 841,
"chars": "]"
},
{
"char_end": 1007,
"char_start": 1006,
"chars": "["
},
{
"char_end": 1018,
"char_start": 1016,
"chars": "',"
},
{
"char_end": 1020,
"char_start": 1019,
"chars": "'"
},
{
"char_end": 1030,
"char_start": 1028,
"chars": "',"
},
{
"char_end": 1032,
"char_start": 1031,
"chars": "'"
},
{
"char_end": 1046,
"char_start": 1045,
"chars": "]"
}
],
"deleted": [
{
"char_end": 704,
"char_start": 703,
"chars": " "
},
{
"char_end": 734,
"char_start": 733,
"chars": "'"
},
{
"char_end": 736,
"char_start": 735,
"chars": "\\"
},
{
"char_end": 747,
"char_start": 746,
"chars": "\\"
},
{
"char_end": 789,
"char_start": 780,
"chars": "'fakehost"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/tests/test_hp3par.py",
"func_name": "test_create_invalid_host",
"line_changes": {
"added": [
{
"char_end": 566,
"char_start": 505,
"line": " show_host_cmd = ['showhost', '-verbose', 'fakehost']\n",
"line_no": 13
},
{
"char_end": 727,
"char_start": 647,
"line": " create_host_cmd = (['createhost', '-iscsi', '-persona', '1', '-domain',\n",
"line_no": 16
},
{
"char_end": 782,
"char_start": 727,
"line": " ('OpenStack',), 'fakehost',\n",
"line_no": 17
},
{
"char_end": 844,
"char_start": 782,
"line": " 'iqn.1993-08.org.debian:01:222'])\n",
"line_no": 18
},
{
"char_end": 1047,
"char_start": 982,
"line": " show_3par_cmd = ['showhost', '-verbose', 'fakehost.foo']\n",
"line_no": 22
}
],
"deleted": [
{
"char_end": 558,
"char_start": 505,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n",
"line_no": 13
},
{
"char_end": 706,
"char_start": 639,
"line": " create_host_cmd = ('createhost -iscsi -persona 1 -domain '\n",
"line_no": 16
},
{
"char_end": 753,
"char_start": 706,
"line": " '(\\'OpenStack\\',) '\n",
"line_no": 17
},
{
"char_end": 822,
"char_start": 753,
"line": " 'fakehost iqn.1993-08.org.debian:01:222')\n",
"line_no": 18
},
{
"char_end": 1017,
"char_start": 960,
"line": " show_3par_cmd = 'showhost -verbose fakehost.foo'\n",
"line_no": 22
}
]
},
"vul_type": "cwe-078"
}
| 117
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def adb_call(*args):",
" clean_name = name.replace('_', '-')",
" arg_str = ' '.join(str(elem) for elem in args)\n return self._exec_adb_cmd(clean_name, arg_str)"
] |
[
0,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 43,
"char_start": 25,
"chars": "=None, shell=False"
},
{
"char_end": 66,
"char_start": 58,
"chars": "\"\"\"Wrapp"
},
{
"char_end": 73,
"char_start": 67,
"chars": "r for "
},
{
"char_end": 85,
"char_start": 75,
"chars": " ADB comma"
},
{
"char_end": 124,
"char_start": 86,
"chars": "d.\n\n Args:\n "
},
{
"char_end": 144,
"char_start": 125,
"chars": "rgs: string or list"
},
{
"char_end": 147,
"char_start": 145,
"chars": "of"
},
{
"char_end": 152,
"char_start": 148,
"chars": "stri"
},
{
"char_end": 157,
"char_start": 153,
"chars": "gs, "
},
{
"char_end": 161,
"char_start": 158,
"chars": "rgu"
},
{
"char_end": 185,
"char_start": 163,
"chars": "nts to the adb command"
},
{
"char_end": 208,
"char_start": 186,
"chars": "\n S"
},
{
"char_end": 214,
"char_start": 209,
"chars": "e sub"
},
{
"char_end": 217,
"char_start": 215,
"chars": "ro"
},
{
"char_end": 226,
"char_start": 219,
"chars": "ss.Proc"
},
{
"char_end": 228,
"char_start": 227,
"chars": ")"
},
{
"char_end": 243,
"char_start": 229,
"chars": "documentation."
},
{
"char_end": 249,
"char_start": 244,
"chars": " "
},
{
"char_end": 284,
"char_start": 260,
"chars": "shell: bool, True to run"
},
{
"char_end": 294,
"char_start": 285,
"chars": "this comm"
},
{
"char_end": 300,
"char_start": 295,
"chars": "nd th"
},
{
"char_end": 303,
"char_start": 301,
"chars": "ou"
},
{
"char_end": 312,
"char_start": 304,
"chars": "h the sy"
},
{
"char_end": 339,
"char_start": 314,
"chars": "em shell,\n "
},
{
"char_end": 351,
"char_start": 342,
"chars": " False t"
},
{
"char_end": 353,
"char_start": 352,
"chars": " "
},
{
"char_end": 361,
"char_start": 355,
"chars": "voke i"
},
{
"char_end": 365,
"char_start": 362,
"chars": " di"
},
{
"char_end": 369,
"char_start": 367,
"chars": "ct"
},
{
"char_end": 374,
"char_start": 370,
"chars": "y. S"
},
{
"char_end": 393,
"char_start": 375,
"chars": "e subprocess.Proc("
},
{
"char_end": 396,
"char_start": 395,
"chars": "d"
},
{
"char_end": 418,
"char_start": 397,
"chars": "cs.\n\n Retu"
},
{
"char_end": 426,
"char_start": 419,
"chars": "ns:\n "
},
{
"char_end": 441,
"char_start": 427,
"chars": " Th"
},
{
"char_end": 455,
"char_start": 442,
"chars": " output of th"
},
{
"char_end": 463,
"char_start": 456,
"chars": " adb co"
},
{
"char_end": 472,
"char_start": 464,
"chars": "mand run"
},
{
"char_end": 519,
"char_start": 474,
"chars": "f exit code is 0.\n \"\"\"\n "
},
{
"char_end": 584,
"char_start": 524,
"chars": " = args or ''\n clean_name = name.replace('_', '-'"
},
{
"char_end": 648,
"char_start": 639,
"chars": "s, shell="
},
{
"char_end": 653,
"char_start": 649,
"chars": "hell"
}
],
"deleted": [
{
"char_end": 22,
"char_start": 21,
"chars": "*"
},
{
"char_end": 44,
"char_start": 42,
"chars": "le"
},
{
"char_end": 47,
"char_start": 46,
"chars": "_"
},
{
"char_end": 53,
"char_start": 52,
"chars": "="
},
{
"char_end": 55,
"char_start": 54,
"chars": "n"
},
{
"char_end": 60,
"char_start": 58,
"chars": ".r"
},
{
"char_end": 64,
"char_start": 62,
"chars": "la"
},
{
"char_end": 71,
"char_start": 67,
"chars": "'_',"
},
{
"char_end": 76,
"char_start": 72,
"chars": "'-')"
},
{
"char_end": 93,
"char_start": 92,
"chars": "_"
},
{
"char_end": 96,
"char_start": 95,
"chars": "r"
},
{
"char_end": 98,
"char_start": 97,
"chars": "="
},
{
"char_end": 100,
"char_start": 99,
"chars": "'"
},
{
"char_end": 104,
"char_start": 101,
"chars": "'.j"
},
{
"char_end": 109,
"char_start": 107,
"chars": "(s"
},
{
"char_end": 112,
"char_start": 111,
"chars": "("
},
{
"char_end": 116,
"char_start": 115,
"chars": "m"
},
{
"char_end": 124,
"char_start": 123,
"chars": "l"
},
{
"char_end": 126,
"char_start": 125,
"chars": "m"
},
{
"char_end": 129,
"char_start": 128,
"chars": "n"
},
{
"char_end": 190,
"char_start": 189,
"chars": "_"
},
{
"char_end": 193,
"char_start": 191,
"chars": "tr"
}
]
},
"commit_link": "github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee",
"file_name": "mobly/controllers/android_device_lib/adb.py",
"func_name": "__getattr__.adb_call",
"line_changes": {
"added": [
{
"char_end": 46,
"char_start": 0,
"line": " def adb_call(args=None, shell=False):\n",
"line_no": 1
},
{
"char_end": 89,
"char_start": 46,
"line": " \"\"\"Wrapper for an ADB command.\n",
"line_no": 2
},
{
"char_end": 90,
"char_start": 89,
"line": "\n",
"line_no": 3
},
{
"char_end": 108,
"char_start": 90,
"line": " Args:\n",
"line_no": 4
},
{
"char_end": 187,
"char_start": 108,
"line": " args: string or list of strings, arguments to the adb command.\n",
"line_no": 5
},
{
"char_end": 244,
"char_start": 187,
"line": " See subprocess.Proc() documentation.\n",
"line_no": 6
},
{
"char_end": 324,
"char_start": 244,
"line": " shell: bool, True to run this command through the system shell,\n",
"line_no": 7
},
{
"char_end": 401,
"char_start": 324,
"line": " False to invoke it directly. See subprocess.Proc() docs.\n",
"line_no": 8
},
{
"char_end": 402,
"char_start": 401,
"line": "\n",
"line_no": 9
},
{
"char_end": 423,
"char_start": 402,
"line": " Returns:\n",
"line_no": 10
},
{
"char_end": 492,
"char_start": 423,
"line": " The output of the adb command run if exit code is 0.\n",
"line_no": 11
},
{
"char_end": 508,
"char_start": 492,
"line": " \"\"\"\n",
"line_no": 12
},
{
"char_end": 538,
"char_start": 508,
"line": " args = args or ''\n",
"line_no": 13
},
{
"char_end": 654,
"char_start": 586,
"line": " return self._exec_adb_cmd(clean_name, args, shell=shell)\n",
"line_no": 15
}
],
"deleted": [
{
"char_end": 29,
"char_start": 0,
"line": " def adb_call(*args):\n",
"line_no": 1
},
{
"char_end": 136,
"char_start": 77,
"line": " arg_str = ' '.join(str(elem) for elem in args)\n",
"line_no": 3
},
{
"char_end": 194,
"char_start": 136,
"line": " return self._exec_adb_cmd(clean_name, arg_str)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-078"
}
| 118
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def adb_call(args=None, shell=False):\n \"\"\"Wrapper for an ADB command.",
" Args:\n args: string or list of strings, arguments to the adb command.\n See subprocess.Proc() documentation.\n shell: bool, True to run this command through the system shell,\n False to invoke it directly. See subprocess.Proc() docs.",
" Returns:\n The output of the adb command run if exit code is 0.\n \"\"\"\n args = args or ''",
" clean_name = name.replace('_', '-')",
" return self._exec_adb_cmd(clean_name, args, shell=shell)"
] |
[
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 43,
"char_start": 25,
"chars": "=None, shell=False"
},
{
"char_end": 66,
"char_start": 58,
"chars": "\"\"\"Wrapp"
},
{
"char_end": 73,
"char_start": 67,
"chars": "r for "
},
{
"char_end": 85,
"char_start": 75,
"chars": " ADB comma"
},
{
"char_end": 124,
"char_start": 86,
"chars": "d.\n\n Args:\n "
},
{
"char_end": 144,
"char_start": 125,
"chars": "rgs: string or list"
},
{
"char_end": 147,
"char_start": 145,
"chars": "of"
},
{
"char_end": 152,
"char_start": 148,
"chars": "stri"
},
{
"char_end": 157,
"char_start": 153,
"chars": "gs, "
},
{
"char_end": 161,
"char_start": 158,
"chars": "rgu"
},
{
"char_end": 185,
"char_start": 163,
"chars": "nts to the adb command"
},
{
"char_end": 208,
"char_start": 186,
"chars": "\n S"
},
{
"char_end": 214,
"char_start": 209,
"chars": "e sub"
},
{
"char_end": 217,
"char_start": 215,
"chars": "ro"
},
{
"char_end": 226,
"char_start": 219,
"chars": "ss.Proc"
},
{
"char_end": 228,
"char_start": 227,
"chars": ")"
},
{
"char_end": 243,
"char_start": 229,
"chars": "documentation."
},
{
"char_end": 249,
"char_start": 244,
"chars": " "
},
{
"char_end": 284,
"char_start": 260,
"chars": "shell: bool, True to run"
},
{
"char_end": 294,
"char_start": 285,
"chars": "this comm"
},
{
"char_end": 300,
"char_start": 295,
"chars": "nd th"
},
{
"char_end": 303,
"char_start": 301,
"chars": "ou"
},
{
"char_end": 312,
"char_start": 304,
"chars": "h the sy"
},
{
"char_end": 339,
"char_start": 314,
"chars": "em shell,\n "
},
{
"char_end": 351,
"char_start": 342,
"chars": " False t"
},
{
"char_end": 353,
"char_start": 352,
"chars": " "
},
{
"char_end": 361,
"char_start": 355,
"chars": "voke i"
},
{
"char_end": 365,
"char_start": 362,
"chars": " di"
},
{
"char_end": 369,
"char_start": 367,
"chars": "ct"
},
{
"char_end": 374,
"char_start": 370,
"chars": "y. S"
},
{
"char_end": 393,
"char_start": 375,
"chars": "e subprocess.Proc("
},
{
"char_end": 396,
"char_start": 395,
"chars": "d"
},
{
"char_end": 418,
"char_start": 397,
"chars": "cs.\n\n Retu"
},
{
"char_end": 426,
"char_start": 419,
"chars": "ns:\n "
},
{
"char_end": 441,
"char_start": 427,
"chars": " Th"
},
{
"char_end": 455,
"char_start": 442,
"chars": " output of th"
},
{
"char_end": 463,
"char_start": 456,
"chars": " adb co"
},
{
"char_end": 472,
"char_start": 464,
"chars": "mand run"
},
{
"char_end": 519,
"char_start": 474,
"chars": "f exit code is 0.\n \"\"\"\n "
},
{
"char_end": 584,
"char_start": 524,
"chars": " = args or ''\n clean_name = name.replace('_', '-'"
},
{
"char_end": 648,
"char_start": 639,
"chars": "s, shell="
},
{
"char_end": 653,
"char_start": 649,
"chars": "hell"
}
],
"deleted": [
{
"char_end": 22,
"char_start": 21,
"chars": "*"
},
{
"char_end": 44,
"char_start": 42,
"chars": "le"
},
{
"char_end": 47,
"char_start": 46,
"chars": "_"
},
{
"char_end": 53,
"char_start": 52,
"chars": "="
},
{
"char_end": 55,
"char_start": 54,
"chars": "n"
},
{
"char_end": 60,
"char_start": 58,
"chars": ".r"
},
{
"char_end": 64,
"char_start": 62,
"chars": "la"
},
{
"char_end": 71,
"char_start": 67,
"chars": "'_',"
},
{
"char_end": 76,
"char_start": 72,
"chars": "'-')"
},
{
"char_end": 93,
"char_start": 92,
"chars": "_"
},
{
"char_end": 96,
"char_start": 95,
"chars": "r"
},
{
"char_end": 98,
"char_start": 97,
"chars": "="
},
{
"char_end": 100,
"char_start": 99,
"chars": "'"
},
{
"char_end": 104,
"char_start": 101,
"chars": "'.j"
},
{
"char_end": 109,
"char_start": 107,
"chars": "(s"
},
{
"char_end": 112,
"char_start": 111,
"chars": "("
},
{
"char_end": 116,
"char_start": 115,
"chars": "m"
},
{
"char_end": 124,
"char_start": 123,
"chars": "l"
},
{
"char_end": 126,
"char_start": 125,
"chars": "m"
},
{
"char_end": 129,
"char_start": 128,
"chars": "n"
},
{
"char_end": 190,
"char_start": 189,
"chars": "_"
},
{
"char_end": 193,
"char_start": 191,
"chars": "tr"
}
]
},
"commit_link": "github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee",
"file_name": "mobly/controllers/android_device_lib/adb.py",
"func_name": "__getattr__.adb_call",
"line_changes": {
"added": [
{
"char_end": 46,
"char_start": 0,
"line": " def adb_call(args=None, shell=False):\n",
"line_no": 1
},
{
"char_end": 89,
"char_start": 46,
"line": " \"\"\"Wrapper for an ADB command.\n",
"line_no": 2
},
{
"char_end": 90,
"char_start": 89,
"line": "\n",
"line_no": 3
},
{
"char_end": 108,
"char_start": 90,
"line": " Args:\n",
"line_no": 4
},
{
"char_end": 187,
"char_start": 108,
"line": " args: string or list of strings, arguments to the adb command.\n",
"line_no": 5
},
{
"char_end": 244,
"char_start": 187,
"line": " See subprocess.Proc() documentation.\n",
"line_no": 6
},
{
"char_end": 324,
"char_start": 244,
"line": " shell: bool, True to run this command through the system shell,\n",
"line_no": 7
},
{
"char_end": 401,
"char_start": 324,
"line": " False to invoke it directly. See subprocess.Proc() docs.\n",
"line_no": 8
},
{
"char_end": 402,
"char_start": 401,
"line": "\n",
"line_no": 9
},
{
"char_end": 423,
"char_start": 402,
"line": " Returns:\n",
"line_no": 10
},
{
"char_end": 492,
"char_start": 423,
"line": " The output of the adb command run if exit code is 0.\n",
"line_no": 11
},
{
"char_end": 508,
"char_start": 492,
"line": " \"\"\"\n",
"line_no": 12
},
{
"char_end": 538,
"char_start": 508,
"line": " args = args or ''\n",
"line_no": 13
},
{
"char_end": 654,
"char_start": 586,
"line": " return self._exec_adb_cmd(clean_name, args, shell=shell)\n",
"line_no": 15
}
],
"deleted": [
{
"char_end": 29,
"char_start": 0,
"line": " def adb_call(*args):\n",
"line_no": 1
},
{
"char_end": 136,
"char_start": 77,
"line": " arg_str = ' '.join(str(elem) for elem in args)\n",
"line_no": 3
},
{
"char_end": 194,
"char_start": 136,
"line": " return self._exec_adb_cmd(clean_name, arg_str)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-078"
}
| 118
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_skip_paths_issue_938(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'line_length = 88\\n'\n 'multi_line_output = 4\\n'\n 'lines_after_imports = 2\\n'\n 'skip_glob =\\n'\n ' migrations/**.py\\n')\n base_dir.join('dont_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')",
" migrations_dir = base_dir.mkdir('migrations')\n migrations_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')",
" test_run_directory = os.getcwd()\n os.chdir(str(base_dir))",
" results = check_output(['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'])",
" os.chdir(str(test_run_directory))\n",
" assert b'skipped' not in results.lower()",
"\n os.chdir(str(base_dir))",
" results = check_output(['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'])",
" os.chdir(str(test_run_directory))\n",
" assert b'skipped 1' in results.lower()"
] |
[
1,
1,
1,
0,
1,
0,
1,
0,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 1206,
"char_start": 1200,
"chars": "subpro"
},
{
"char_end": 1212,
"char_start": 1208,
"chars": "ss.r"
},
{
"char_end": 1214,
"char_start": 1213,
"chars": "n"
},
{
"char_end": 1224,
"char_start": 1215,
"chars": "\n "
},
{
"char_end": 1339,
"char_start": 1281,
"chars": ",\n stdout=subprocess.PIPE,\n check=True,\n "
},
{
"char_end": 1416,
"char_start": 1415,
"chars": "."
},
{
"char_end": 1422,
"char_start": 1417,
"chars": "tdout"
},
{
"char_end": 1479,
"char_start": 1473,
"chars": "subpro"
},
{
"char_end": 1485,
"char_start": 1481,
"chars": "ss.r"
},
{
"char_end": 1487,
"char_start": 1486,
"chars": "n"
},
{
"char_end": 1497,
"char_start": 1488,
"chars": "\n "
},
{
"char_end": 1665,
"char_start": 1607,
"chars": ",\n stdout=subprocess.PIPE,\n check=True,\n "
},
{
"char_end": 1740,
"char_start": 1739,
"chars": "."
},
{
"char_end": 1746,
"char_start": 1741,
"chars": "tdout"
}
],
"deleted": [
{
"char_end": 1198,
"char_start": 1197,
"chars": "s"
},
{
"char_end": 1203,
"char_start": 1202,
"chars": "h"
},
{
"char_end": 1211,
"char_start": 1204,
"chars": "ck_outp"
},
{
"char_end": 1213,
"char_start": 1212,
"chars": "t"
},
{
"char_end": 1397,
"char_start": 1396,
"chars": "s"
},
{
"char_end": 1402,
"char_start": 1401,
"chars": "h"
},
{
"char_end": 1410,
"char_start": 1403,
"chars": "ck_outp"
},
{
"char_end": 1412,
"char_start": 1411,
"chars": "t"
}
]
},
"commit_link": "github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76",
"file_name": "test_isort.py",
"func_name": "test_skip_paths_issue_938",
"line_changes": {
"added": [
{
"char_end": 1216,
"char_start": 1187,
"line": " result = subprocess.run(\n",
"line_no": 25
},
{
"char_end": 1283,
"char_start": 1216,
"line": " ['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n",
"line_no": 26
},
{
"char_end": 1315,
"char_start": 1283,
"line": " stdout=subprocess.PIPE,\n",
"line_no": 27
},
{
"char_end": 1335,
"char_start": 1315,
"line": " check=True,\n",
"line_no": 28
},
{
"char_end": 1341,
"char_start": 1335,
"line": " )\n",
"line_no": 29
},
{
"char_end": 1431,
"char_start": 1380,
"line": " assert b'skipped' not in result.stdout.lower()\n",
"line_no": 32
},
{
"char_end": 1489,
"char_start": 1460,
"line": " result = subprocess.run(\n",
"line_no": 35
},
{
"char_end": 1609,
"char_start": 1489,
"line": " ['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n",
"line_no": 36
},
{
"char_end": 1641,
"char_start": 1609,
"line": " stdout=subprocess.PIPE,\n",
"line_no": 37
},
{
"char_end": 1661,
"char_start": 1641,
"line": " check=True,\n",
"line_no": 38
},
{
"char_end": 1667,
"char_start": 1661,
"line": " )\n",
"line_no": 39
},
{
"char_end": 1754,
"char_start": 1706,
"line": " assert b'skipped 1' in result.stdout.lower()\n",
"line_no": 42
}
],
"deleted": [
{
"char_end": 1273,
"char_start": 1187,
"line": " results = check_output(['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n",
"line_no": 25
},
{
"char_end": 1357,
"char_start": 1312,
"line": " assert b'skipped' not in results.lower()\n",
"line_no": 28
},
{
"char_end": 1525,
"char_start": 1386,
"line": " results = check_output(['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n",
"line_no": 31
},
{
"char_end": 1606,
"char_start": 1564,
"line": " assert b'skipped 1' in results.lower()\n",
"line_no": 34
}
]
},
"vul_type": "cwe-078"
}
| 119
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_skip_paths_issue_938(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'line_length = 88\\n'\n 'multi_line_output = 4\\n'\n 'lines_after_imports = 2\\n'\n 'skip_glob =\\n'\n ' migrations/**.py\\n')\n base_dir.join('dont_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')",
" migrations_dir = base_dir.mkdir('migrations')\n migrations_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')",
" test_run_directory = os.getcwd()\n os.chdir(str(base_dir))",
" result = subprocess.run(\n ['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n stdout=subprocess.PIPE,\n check=True,\n )",
" os.chdir(str(test_run_directory))\n",
" assert b'skipped' not in result.stdout.lower()",
"\n os.chdir(str(base_dir))",
" result = subprocess.run(\n ['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n stdout=subprocess.PIPE,\n check=True,\n )",
" os.chdir(str(test_run_directory))\n",
" assert b'skipped 1' in result.stdout.lower()"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 1206,
"char_start": 1200,
"chars": "subpro"
},
{
"char_end": 1212,
"char_start": 1208,
"chars": "ss.r"
},
{
"char_end": 1214,
"char_start": 1213,
"chars": "n"
},
{
"char_end": 1224,
"char_start": 1215,
"chars": "\n "
},
{
"char_end": 1339,
"char_start": 1281,
"chars": ",\n stdout=subprocess.PIPE,\n check=True,\n "
},
{
"char_end": 1416,
"char_start": 1415,
"chars": "."
},
{
"char_end": 1422,
"char_start": 1417,
"chars": "tdout"
},
{
"char_end": 1479,
"char_start": 1473,
"chars": "subpro"
},
{
"char_end": 1485,
"char_start": 1481,
"chars": "ss.r"
},
{
"char_end": 1487,
"char_start": 1486,
"chars": "n"
},
{
"char_end": 1497,
"char_start": 1488,
"chars": "\n "
},
{
"char_end": 1665,
"char_start": 1607,
"chars": ",\n stdout=subprocess.PIPE,\n check=True,\n "
},
{
"char_end": 1740,
"char_start": 1739,
"chars": "."
},
{
"char_end": 1746,
"char_start": 1741,
"chars": "tdout"
}
],
"deleted": [
{
"char_end": 1198,
"char_start": 1197,
"chars": "s"
},
{
"char_end": 1203,
"char_start": 1202,
"chars": "h"
},
{
"char_end": 1211,
"char_start": 1204,
"chars": "ck_outp"
},
{
"char_end": 1213,
"char_start": 1212,
"chars": "t"
},
{
"char_end": 1397,
"char_start": 1396,
"chars": "s"
},
{
"char_end": 1402,
"char_start": 1401,
"chars": "h"
},
{
"char_end": 1410,
"char_start": 1403,
"chars": "ck_outp"
},
{
"char_end": 1412,
"char_start": 1411,
"chars": "t"
}
]
},
"commit_link": "github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76",
"file_name": "test_isort.py",
"func_name": "test_skip_paths_issue_938",
"line_changes": {
"added": [
{
"char_end": 1216,
"char_start": 1187,
"line": " result = subprocess.run(\n",
"line_no": 25
},
{
"char_end": 1283,
"char_start": 1216,
"line": " ['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n",
"line_no": 26
},
{
"char_end": 1315,
"char_start": 1283,
"line": " stdout=subprocess.PIPE,\n",
"line_no": 27
},
{
"char_end": 1335,
"char_start": 1315,
"line": " check=True,\n",
"line_no": 28
},
{
"char_end": 1341,
"char_start": 1335,
"line": " )\n",
"line_no": 29
},
{
"char_end": 1431,
"char_start": 1380,
"line": " assert b'skipped' not in result.stdout.lower()\n",
"line_no": 32
},
{
"char_end": 1489,
"char_start": 1460,
"line": " result = subprocess.run(\n",
"line_no": 35
},
{
"char_end": 1609,
"char_start": 1489,
"line": " ['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n",
"line_no": 36
},
{
"char_end": 1641,
"char_start": 1609,
"line": " stdout=subprocess.PIPE,\n",
"line_no": 37
},
{
"char_end": 1661,
"char_start": 1641,
"line": " check=True,\n",
"line_no": 38
},
{
"char_end": 1667,
"char_start": 1661,
"line": " )\n",
"line_no": 39
},
{
"char_end": 1754,
"char_start": 1706,
"line": " assert b'skipped 1' in result.stdout.lower()\n",
"line_no": 42
}
],
"deleted": [
{
"char_end": 1273,
"char_start": 1187,
"line": " results = check_output(['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n",
"line_no": 25
},
{
"char_end": 1357,
"char_start": 1312,
"line": " assert b'skipped' not in results.lower()\n",
"line_no": 28
},
{
"char_end": 1525,
"char_start": 1386,
"line": " results = check_output(['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n",
"line_no": 31
},
{
"char_end": 1606,
"char_start": 1564,
"line": " assert b'skipped 1' in results.lower()\n",
"line_no": 34
}
]
},
"vul_type": "cwe-078"
}
| 119
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _ensure_vdisk_no_fc_mappings(self, name, allow_snaps=True):\n # Ensure vdisk has no FlashCopy mappings\n mapping_ids = self._get_vdisk_fc_mappings(name)\n while len(mapping_ids):\n wait_for_copy = False\n for map_id in mapping_ids:\n attrs = self._get_flashcopy_mapping_attributes(map_id)\n if not attrs:\n continue\n source = attrs['source_vdisk_name']\n target = attrs['target_vdisk_name']\n copy_rate = attrs['copy_rate']\n status = attrs['status']",
" if copy_rate == '0':\n # Case #2: A vdisk that has snapshots\n if source == name:\n if not allow_snaps:\n return False",
" ssh_cmd = ('svctask chfcmap -copyrate 50 '\n '-autodelete on %s' % map_id)",
" out, err = self._run_ssh(ssh_cmd)\n wait_for_copy = True\n # Case #3: A snapshot\n else:\n msg = (_('Vdisk %(name)s not involved in '\n 'mapping %(src)s -> %(tgt)s') %\n {'name': name, 'src': source, 'tgt': target})\n self._driver_assert(target == name, msg)\n if status in ['copying', 'prepared']:",
" self._run_ssh('svctask stopfcmap %s' % map_id)",
" elif status in ['stopping', 'preparing']:\n wait_for_copy = True\n else:",
" self._run_ssh('svctask rmfcmap -force %s' % map_id)",
" # Case 4: Copy in progress - wait and will autodelete\n else:\n if status == 'prepared':",
" self._run_ssh('svctask stopfcmap %s' % map_id)\n self._run_ssh('svctask rmfcmap -force %s' % map_id)",
" elif status == 'idle_or_copied':\n # Prepare failed",
" self._run_ssh('svctask rmfcmap -force %s' % map_id)",
" else:\n wait_for_copy = True\n if wait_for_copy:\n time.sleep(5)\n mapping_ids = self._get_vdisk_fc_mappings(name)\n return True"
] |
[
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 855,
"char_start": 854,
"chars": "["
},
{
"char_end": 865,
"char_start": 863,
"chars": "',"
},
{
"char_end": 867,
"char_start": 866,
"chars": "'"
},
{
"char_end": 876,
"char_start": 874,
"chars": "',"
},
{
"char_end": 878,
"char_start": 877,
"chars": "'"
},
{
"char_end": 889,
"char_start": 887,
"chars": "',"
},
{
"char_end": 891,
"char_start": 890,
"chars": "'"
},
{
"char_end": 895,
"char_start": 894,
"chars": ","
},
{
"char_end": 945,
"char_start": 943,
"chars": "',"
},
{
"char_end": 947,
"char_start": 946,
"chars": "'"
},
{
"char_end": 951,
"char_start": 950,
"chars": ","
},
{
"char_end": 959,
"char_start": 958,
"chars": "]"
},
{
"char_end": 1510,
"char_start": 1509,
"chars": "["
},
{
"char_end": 1520,
"char_start": 1518,
"chars": "',"
},
{
"char_end": 1522,
"char_start": 1521,
"chars": "'"
},
{
"char_end": 1533,
"char_start": 1532,
"chars": ","
},
{
"char_end": 1541,
"char_start": 1540,
"chars": "]"
},
{
"char_end": 1731,
"char_start": 1730,
"chars": "["
},
{
"char_end": 1741,
"char_start": 1739,
"chars": "',"
},
{
"char_end": 1743,
"char_start": 1742,
"chars": "'"
},
{
"char_end": 1752,
"char_start": 1750,
"chars": "',"
},
{
"char_end": 1754,
"char_start": 1753,
"chars": "'"
},
{
"char_end": 1767,
"char_start": 1760,
"chars": "',\n "
},
{
"char_end": 1775,
"char_start": 1768,
"chars": " "
},
{
"char_end": 1805,
"char_start": 1776,
"chars": " "
},
{
"char_end": 1813,
"char_start": 1812,
"chars": "]"
},
{
"char_end": 1991,
"char_start": 1990,
"chars": "["
},
{
"char_end": 2001,
"char_start": 1999,
"chars": "',"
},
{
"char_end": 2003,
"char_start": 2002,
"chars": "'"
},
{
"char_end": 2014,
"char_start": 2013,
"chars": ","
},
{
"char_end": 2022,
"char_start": 2021,
"chars": "]"
},
{
"char_end": 2063,
"char_start": 2062,
"chars": "["
},
{
"char_end": 2073,
"char_start": 2071,
"chars": "',"
},
{
"char_end": 2075,
"char_start": 2074,
"chars": "'"
},
{
"char_end": 2084,
"char_start": 2082,
"chars": "',"
},
{
"char_end": 2086,
"char_start": 2085,
"chars": "'"
},
{
"char_end": 2094,
"char_start": 2093,
"chars": ","
},
{
"char_end": 2102,
"char_start": 2101,
"chars": "]"
},
{
"char_end": 2237,
"char_start": 2236,
"chars": "["
},
{
"char_end": 2247,
"char_start": 2245,
"chars": "',"
},
{
"char_end": 2249,
"char_start": 2248,
"chars": "'"
},
{
"char_end": 2258,
"char_start": 2256,
"chars": "',"
},
{
"char_end": 2260,
"char_start": 2259,
"chars": "'"
},
{
"char_end": 2268,
"char_start": 2267,
"chars": ","
},
{
"char_end": 2276,
"char_start": 2275,
"chars": "]"
}
],
"deleted": [
{
"char_end": 855,
"char_start": 854,
"chars": "("
},
{
"char_end": 885,
"char_start": 884,
"chars": " "
},
{
"char_end": 940,
"char_start": 937,
"chars": " %s"
},
{
"char_end": 943,
"char_start": 941,
"chars": " %"
},
{
"char_end": 951,
"char_start": 950,
"chars": ")"
},
{
"char_end": 1522,
"char_start": 1519,
"chars": " %s"
},
{
"char_end": 1525,
"char_start": 1523,
"chars": " %"
},
{
"char_end": 1748,
"char_start": 1745,
"chars": "%s'"
},
{
"char_end": 1750,
"char_start": 1749,
"chars": "%"
},
{
"char_end": 1955,
"char_start": 1952,
"chars": " %s"
},
{
"char_end": 1958,
"char_start": 1956,
"chars": " %"
},
{
"char_end": 2031,
"char_start": 2028,
"chars": " %s"
},
{
"char_end": 2034,
"char_start": 2032,
"chars": " %"
},
{
"char_end": 2201,
"char_start": 2198,
"chars": " %s"
},
{
"char_end": 2204,
"char_start": 2202,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_ensure_vdisk_no_fc_mappings",
"line_changes": {
"added": [
{
"char_end": 896,
"char_start": 820,
"line": " ssh_cmd = ['svctask', 'chfcmap', '-copyrate', '50',\n",
"line_no": 20
},
{
"char_end": 960,
"char_start": 896,
"line": " '-autodelete', 'on', map_id]\n",
"line_no": 21
},
{
"char_end": 1543,
"char_start": 1467,
"line": " self._run_ssh(['svctask', 'stopfcmap', map_id])\n",
"line_no": 31
},
{
"char_end": 1763,
"char_start": 1688,
"line": " self._run_ssh(['svctask', 'rmfcmap', '-force',\n",
"line_no": 35
},
{
"char_end": 1815,
"char_start": 1763,
"line": " map_id])\n",
"line_no": 36
},
{
"char_end": 2024,
"char_start": 1952,
"line": " self._run_ssh(['svctask', 'stopfcmap', map_id])\n",
"line_no": 40
},
{
"char_end": 2104,
"char_start": 2024,
"line": " self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])\n",
"line_no": 41
},
{
"char_end": 2278,
"char_start": 2198,
"line": " self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])\n",
"line_no": 44
}
],
"deleted": [
{
"char_end": 887,
"char_start": 820,
"line": " ssh_cmd = ('svctask chfcmap -copyrate 50 '\n",
"line_no": 20
},
{
"char_end": 952,
"char_start": 887,
"line": " '-autodelete on %s' % map_id)\n",
"line_no": 21
},
{
"char_end": 1534,
"char_start": 1459,
"line": " self._run_ssh('svctask stopfcmap %s' % map_id)\n",
"line_no": 31
},
{
"char_end": 1759,
"char_start": 1679,
"line": " self._run_ssh('svctask rmfcmap -force %s' % map_id)\n",
"line_no": 35
},
{
"char_end": 1967,
"char_start": 1896,
"line": " self._run_ssh('svctask stopfcmap %s' % map_id)\n",
"line_no": 39
},
{
"char_end": 2043,
"char_start": 1967,
"line": " self._run_ssh('svctask rmfcmap -force %s' % map_id)\n",
"line_no": 40
},
{
"char_end": 2213,
"char_start": 2137,
"line": " self._run_ssh('svctask rmfcmap -force %s' % map_id)\n",
"line_no": 43
}
]
},
"vul_type": "cwe-078"
}
| 120
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _ensure_vdisk_no_fc_mappings(self, name, allow_snaps=True):\n # Ensure vdisk has no FlashCopy mappings\n mapping_ids = self._get_vdisk_fc_mappings(name)\n while len(mapping_ids):\n wait_for_copy = False\n for map_id in mapping_ids:\n attrs = self._get_flashcopy_mapping_attributes(map_id)\n if not attrs:\n continue\n source = attrs['source_vdisk_name']\n target = attrs['target_vdisk_name']\n copy_rate = attrs['copy_rate']\n status = attrs['status']",
" if copy_rate == '0':\n # Case #2: A vdisk that has snapshots\n if source == name:\n if not allow_snaps:\n return False",
" ssh_cmd = ['svctask', 'chfcmap', '-copyrate', '50',\n '-autodelete', 'on', map_id]",
" out, err = self._run_ssh(ssh_cmd)\n wait_for_copy = True\n # Case #3: A snapshot\n else:\n msg = (_('Vdisk %(name)s not involved in '\n 'mapping %(src)s -> %(tgt)s') %\n {'name': name, 'src': source, 'tgt': target})\n self._driver_assert(target == name, msg)\n if status in ['copying', 'prepared']:",
" self._run_ssh(['svctask', 'stopfcmap', map_id])",
" elif status in ['stopping', 'preparing']:\n wait_for_copy = True\n else:",
" self._run_ssh(['svctask', 'rmfcmap', '-force',\n map_id])",
" # Case 4: Copy in progress - wait and will autodelete\n else:\n if status == 'prepared':",
" self._run_ssh(['svctask', 'stopfcmap', map_id])\n self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])",
" elif status == 'idle_or_copied':\n # Prepare failed",
" self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])",
" else:\n wait_for_copy = True\n if wait_for_copy:\n time.sleep(5)\n mapping_ids = self._get_vdisk_fc_mappings(name)\n return True"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 855,
"char_start": 854,
"chars": "["
},
{
"char_end": 865,
"char_start": 863,
"chars": "',"
},
{
"char_end": 867,
"char_start": 866,
"chars": "'"
},
{
"char_end": 876,
"char_start": 874,
"chars": "',"
},
{
"char_end": 878,
"char_start": 877,
"chars": "'"
},
{
"char_end": 889,
"char_start": 887,
"chars": "',"
},
{
"char_end": 891,
"char_start": 890,
"chars": "'"
},
{
"char_end": 895,
"char_start": 894,
"chars": ","
},
{
"char_end": 945,
"char_start": 943,
"chars": "',"
},
{
"char_end": 947,
"char_start": 946,
"chars": "'"
},
{
"char_end": 951,
"char_start": 950,
"chars": ","
},
{
"char_end": 959,
"char_start": 958,
"chars": "]"
},
{
"char_end": 1510,
"char_start": 1509,
"chars": "["
},
{
"char_end": 1520,
"char_start": 1518,
"chars": "',"
},
{
"char_end": 1522,
"char_start": 1521,
"chars": "'"
},
{
"char_end": 1533,
"char_start": 1532,
"chars": ","
},
{
"char_end": 1541,
"char_start": 1540,
"chars": "]"
},
{
"char_end": 1731,
"char_start": 1730,
"chars": "["
},
{
"char_end": 1741,
"char_start": 1739,
"chars": "',"
},
{
"char_end": 1743,
"char_start": 1742,
"chars": "'"
},
{
"char_end": 1752,
"char_start": 1750,
"chars": "',"
},
{
"char_end": 1754,
"char_start": 1753,
"chars": "'"
},
{
"char_end": 1767,
"char_start": 1760,
"chars": "',\n "
},
{
"char_end": 1775,
"char_start": 1768,
"chars": " "
},
{
"char_end": 1805,
"char_start": 1776,
"chars": " "
},
{
"char_end": 1813,
"char_start": 1812,
"chars": "]"
},
{
"char_end": 1991,
"char_start": 1990,
"chars": "["
},
{
"char_end": 2001,
"char_start": 1999,
"chars": "',"
},
{
"char_end": 2003,
"char_start": 2002,
"chars": "'"
},
{
"char_end": 2014,
"char_start": 2013,
"chars": ","
},
{
"char_end": 2022,
"char_start": 2021,
"chars": "]"
},
{
"char_end": 2063,
"char_start": 2062,
"chars": "["
},
{
"char_end": 2073,
"char_start": 2071,
"chars": "',"
},
{
"char_end": 2075,
"char_start": 2074,
"chars": "'"
},
{
"char_end": 2084,
"char_start": 2082,
"chars": "',"
},
{
"char_end": 2086,
"char_start": 2085,
"chars": "'"
},
{
"char_end": 2094,
"char_start": 2093,
"chars": ","
},
{
"char_end": 2102,
"char_start": 2101,
"chars": "]"
},
{
"char_end": 2237,
"char_start": 2236,
"chars": "["
},
{
"char_end": 2247,
"char_start": 2245,
"chars": "',"
},
{
"char_end": 2249,
"char_start": 2248,
"chars": "'"
},
{
"char_end": 2258,
"char_start": 2256,
"chars": "',"
},
{
"char_end": 2260,
"char_start": 2259,
"chars": "'"
},
{
"char_end": 2268,
"char_start": 2267,
"chars": ","
},
{
"char_end": 2276,
"char_start": 2275,
"chars": "]"
}
],
"deleted": [
{
"char_end": 855,
"char_start": 854,
"chars": "("
},
{
"char_end": 885,
"char_start": 884,
"chars": " "
},
{
"char_end": 940,
"char_start": 937,
"chars": " %s"
},
{
"char_end": 943,
"char_start": 941,
"chars": " %"
},
{
"char_end": 951,
"char_start": 950,
"chars": ")"
},
{
"char_end": 1522,
"char_start": 1519,
"chars": " %s"
},
{
"char_end": 1525,
"char_start": 1523,
"chars": " %"
},
{
"char_end": 1748,
"char_start": 1745,
"chars": "%s'"
},
{
"char_end": 1750,
"char_start": 1749,
"chars": "%"
},
{
"char_end": 1955,
"char_start": 1952,
"chars": " %s"
},
{
"char_end": 1958,
"char_start": 1956,
"chars": " %"
},
{
"char_end": 2031,
"char_start": 2028,
"chars": " %s"
},
{
"char_end": 2034,
"char_start": 2032,
"chars": " %"
},
{
"char_end": 2201,
"char_start": 2198,
"chars": " %s"
},
{
"char_end": 2204,
"char_start": 2202,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_ensure_vdisk_no_fc_mappings",
"line_changes": {
"added": [
{
"char_end": 896,
"char_start": 820,
"line": " ssh_cmd = ['svctask', 'chfcmap', '-copyrate', '50',\n",
"line_no": 20
},
{
"char_end": 960,
"char_start": 896,
"line": " '-autodelete', 'on', map_id]\n",
"line_no": 21
},
{
"char_end": 1543,
"char_start": 1467,
"line": " self._run_ssh(['svctask', 'stopfcmap', map_id])\n",
"line_no": 31
},
{
"char_end": 1763,
"char_start": 1688,
"line": " self._run_ssh(['svctask', 'rmfcmap', '-force',\n",
"line_no": 35
},
{
"char_end": 1815,
"char_start": 1763,
"line": " map_id])\n",
"line_no": 36
},
{
"char_end": 2024,
"char_start": 1952,
"line": " self._run_ssh(['svctask', 'stopfcmap', map_id])\n",
"line_no": 40
},
{
"char_end": 2104,
"char_start": 2024,
"line": " self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])\n",
"line_no": 41
},
{
"char_end": 2278,
"char_start": 2198,
"line": " self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])\n",
"line_no": 44
}
],
"deleted": [
{
"char_end": 887,
"char_start": 820,
"line": " ssh_cmd = ('svctask chfcmap -copyrate 50 '\n",
"line_no": 20
},
{
"char_end": 952,
"char_start": 887,
"line": " '-autodelete on %s' % map_id)\n",
"line_no": 21
},
{
"char_end": 1534,
"char_start": 1459,
"line": " self._run_ssh('svctask stopfcmap %s' % map_id)\n",
"line_no": 31
},
{
"char_end": 1759,
"char_start": 1679,
"line": " self._run_ssh('svctask rmfcmap -force %s' % map_id)\n",
"line_no": 35
},
{
"char_end": 1967,
"char_start": 1896,
"line": " self._run_ssh('svctask stopfcmap %s' % map_id)\n",
"line_no": 39
},
{
"char_end": 2043,
"char_start": 1967,
"line": " self._run_ssh('svctask rmfcmap -force %s' % map_id)\n",
"line_no": 40
},
{
"char_end": 2213,
"char_start": 2137,
"line": " self._run_ssh('svctask rmfcmap -force %s' % map_id)\n",
"line_no": 43
}
]
},
"vul_type": "cwe-078"
}
| 120
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def tcp_forward(self, host_port, device_port):\n \"\"\"Starts tcp forwarding.",
" Args:\n host_port: Port number to use on the computer.\n device_port: Port number to use on the android device.\n \"\"\"",
" self.forward('tcp:%d tcp:%d' % (host_port, device_port))"
] |
[
1,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 260,
"char_start": 259,
"chars": "["
},
{
"char_end": 293,
"char_start": 282,
"chars": "'tcp:%d' % "
},
{
"char_end": 305,
"char_start": 304,
"chars": "]"
}
],
"deleted": [
{
"char_end": 273,
"char_start": 266,
"chars": " tcp:%d"
},
{
"char_end": 278,
"char_start": 277,
"chars": "("
},
{
"char_end": 301,
"char_start": 300,
"chars": ")"
}
]
},
"commit_link": "github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee",
"file_name": "mobly/controllers/android_device_lib/adb.py",
"func_name": "tcp_forward",
"line_changes": {
"added": [
{
"char_end": 306,
"char_start": 238,
"line": " self.forward(['tcp:%d' % host_port, 'tcp:%d' % device_port])\n",
"line_no": 8
}
],
"deleted": [
{
"char_end": 302,
"char_start": 238,
"line": " self.forward('tcp:%d tcp:%d' % (host_port, device_port))\n",
"line_no": 8
}
]
},
"vul_type": "cwe-078"
}
| 121
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def tcp_forward(self, host_port, device_port):\n \"\"\"Starts tcp forwarding.",
" Args:\n host_port: Port number to use on the computer.\n device_port: Port number to use on the android device.\n \"\"\"",
" self.forward(['tcp:%d' % host_port, 'tcp:%d' % device_port])"
] |
[
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 260,
"char_start": 259,
"chars": "["
},
{
"char_end": 293,
"char_start": 282,
"chars": "'tcp:%d' % "
},
{
"char_end": 305,
"char_start": 304,
"chars": "]"
}
],
"deleted": [
{
"char_end": 273,
"char_start": 266,
"chars": " tcp:%d"
},
{
"char_end": 278,
"char_start": 277,
"chars": "("
},
{
"char_end": 301,
"char_start": 300,
"chars": ")"
}
]
},
"commit_link": "github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee",
"file_name": "mobly/controllers/android_device_lib/adb.py",
"func_name": "tcp_forward",
"line_changes": {
"added": [
{
"char_end": 306,
"char_start": 238,
"line": " self.forward(['tcp:%d' % host_port, 'tcp:%d' % device_port])\n",
"line_no": 8
}
],
"deleted": [
{
"char_end": 302,
"char_start": 238,
"line": " self.forward('tcp:%d tcp:%d' % (host_port, device_port))\n",
"line_no": 8
}
]
},
"vul_type": "cwe-078"
}
| 121
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def repack(host, targets, channel='stable'):",
"",
" url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'\n req = requests.get(url)\n req.raise_for_status()\n manifest = toml.loads(req.content)\n if manifest['manifest-version'] != '2':\n print('ERROR: unrecognized manifest version %s.' % manifest['manifest-version'])\n return\n print('Using manifest for rust %s as of %s.' % (channel, manifest['date']))\n rustc_version, rustc = package(manifest, 'rustc', host)\n if rustc['available']:\n print('rustc %s\\n %s\\n %s' % (rustc_version, rustc['url'], rustc['hash']))\n fetch(rustc['url'])\n cargo_version, cargo = package(manifest, 'cargo', host)\n if cargo['available']:\n print('cargo %s\\n %s\\n %s' % (cargo_version, cargo['url'], cargo['hash']))\n fetch(cargo['url'])\n stds = []\n for target in targets:\n version, info = package(manifest, 'rust-std', target)\n if info['available']:\n print('rust-std %s\\n %s\\n %s' % (version, info['url'], info['hash']))\n fetch(info['url'])\n stds.append(info)\n print('Installing packages...')\n tar_basename = 'rustc-%s-repack' % host\n install_dir = 'rustc'",
" os.system('rm -rf %s' % install_dir)",
" install(os.path.basename(rustc['url']), install_dir)\n install(os.path.basename(cargo['url']), install_dir)\n for std in stds:\n install(os.path.basename(std['url']), install_dir)\n print('Tarring %s...' % tar_basename)",
" os.system('tar cjf %s.tar.bz2 %s/*' % (tar_basename, install_dir))\n os.system('rm -rf %s' % install_dir)"
] |
[
1,
0,
1,
0,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 90,
"char_start": 47,
"chars": "print(\"Repacking rust for %s...\" % host)\n "
},
{
"char_end": 1211,
"char_start": 1206,
"chars": "subpr"
},
{
"char_end": 1214,
"char_start": 1212,
"chars": "ce"
},
{
"char_end": 1219,
"char_start": 1216,
"chars": ".ch"
},
{
"char_end": 1227,
"char_start": 1220,
"chars": "ck_call"
},
{
"char_end": 1229,
"char_start": 1228,
"chars": "["
},
{
"char_end": 1234,
"char_start": 1232,
"chars": "',"
},
{
"char_end": 1236,
"char_start": 1235,
"chars": "'"
},
{
"char_end": 1241,
"char_start": 1240,
"chars": ","
},
{
"char_end": 1254,
"char_start": 1253,
"chars": "]"
},
{
"char_end": 1487,
"char_start": 1482,
"chars": "subpr"
},
{
"char_end": 1491,
"char_start": 1488,
"chars": "ces"
},
{
"char_end": 1495,
"char_start": 1493,
"chars": "ch"
},
{
"char_end": 1503,
"char_start": 1496,
"chars": "ck_call"
},
{
"char_end": 1505,
"char_start": 1504,
"chars": "["
},
{
"char_end": 1511,
"char_start": 1509,
"chars": "',"
},
{
"char_end": 1513,
"char_start": 1512,
"chars": "'"
},
{
"char_end": 1518,
"char_start": 1517,
"chars": ","
},
{
"char_end": 1544,
"char_start": 1531,
"chars": " + '.tar.bz2'"
},
{
"char_end": 1558,
"char_start": 1557,
"chars": "]"
},
{
"char_end": 1567,
"char_start": 1562,
"chars": "subpr"
},
{
"char_end": 1570,
"char_start": 1568,
"chars": "ce"
},
{
"char_end": 1575,
"char_start": 1572,
"chars": ".ch"
},
{
"char_end": 1583,
"char_start": 1576,
"chars": "ck_call"
},
{
"char_end": 1585,
"char_start": 1584,
"chars": "["
},
{
"char_end": 1590,
"char_start": 1588,
"chars": "',"
},
{
"char_end": 1592,
"char_start": 1591,
"chars": "'"
},
{
"char_end": 1597,
"char_start": 1596,
"chars": ","
},
{
"char_end": 1610,
"char_start": 1609,
"chars": "]"
}
],
"deleted": [
{
"char_end": 1170,
"char_start": 1166,
"chars": "syst"
},
{
"char_end": 1172,
"char_start": 1171,
"chars": "m"
},
{
"char_end": 1183,
"char_start": 1180,
"chars": " %s"
},
{
"char_end": 1186,
"char_start": 1184,
"chars": " %"
},
{
"char_end": 1427,
"char_start": 1426,
"chars": "o"
},
{
"char_end": 1429,
"char_start": 1428,
"chars": "."
},
{
"char_end": 1431,
"char_start": 1430,
"chars": "y"
},
{
"char_end": 1433,
"char_start": 1432,
"chars": "t"
},
{
"char_end": 1435,
"char_start": 1434,
"chars": "m"
},
{
"char_end": 1460,
"char_start": 1444,
"chars": " %s.tar.bz2 %s/*"
},
{
"char_end": 1465,
"char_start": 1462,
"chars": "% ("
},
{
"char_end": 1491,
"char_start": 1490,
"chars": ")"
},
{
"char_end": 1502,
"char_start": 1498,
"chars": "syst"
},
{
"char_end": 1504,
"char_start": 1503,
"chars": "m"
},
{
"char_end": 1515,
"char_start": 1512,
"chars": " %s"
},
{
"char_end": 1518,
"char_start": 1516,
"chars": " %"
}
]
},
"commit_link": "github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb",
"file_name": "repack_rust.py",
"func_name": "repack",
"line_changes": {
"added": [
{
"char_end": 88,
"char_start": 45,
"line": " print(\"Repacking rust for %s...\" % host)\n",
"line_no": 2
},
{
"char_end": 1256,
"char_start": 1204,
"line": " subprocess.check_call(['rm', '-rf', install_dir])\n",
"line_no": 29
},
{
"char_end": 1560,
"char_start": 1480,
"line": " subprocess.check_call(['tar', 'cjf', tar_basename + '.tar.bz2', install_dir])\n",
"line_no": 35
},
{
"char_end": 1611,
"char_start": 1560,
"line": " subprocess.check_call(['rm', '-rf', install_dir])\n",
"line_no": 36
}
],
"deleted": [
{
"char_end": 1200,
"char_start": 1161,
"line": " os.system('rm -rf %s' % install_dir)\n",
"line_no": 28
},
{
"char_end": 1493,
"char_start": 1424,
"line": " os.system('tar cjf %s.tar.bz2 %s/*' % (tar_basename, install_dir))\n",
"line_no": 34
},
{
"char_end": 1531,
"char_start": 1493,
"line": " os.system('rm -rf %s' % install_dir)\n",
"line_no": 35
}
]
},
"vul_type": "cwe-078"
}
| 122
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def repack(host, targets, channel='stable'):",
" print(\"Repacking rust for %s...\" % host)",
" url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'\n req = requests.get(url)\n req.raise_for_status()\n manifest = toml.loads(req.content)\n if manifest['manifest-version'] != '2':\n print('ERROR: unrecognized manifest version %s.' % manifest['manifest-version'])\n return\n print('Using manifest for rust %s as of %s.' % (channel, manifest['date']))\n rustc_version, rustc = package(manifest, 'rustc', host)\n if rustc['available']:\n print('rustc %s\\n %s\\n %s' % (rustc_version, rustc['url'], rustc['hash']))\n fetch(rustc['url'])\n cargo_version, cargo = package(manifest, 'cargo', host)\n if cargo['available']:\n print('cargo %s\\n %s\\n %s' % (cargo_version, cargo['url'], cargo['hash']))\n fetch(cargo['url'])\n stds = []\n for target in targets:\n version, info = package(manifest, 'rust-std', target)\n if info['available']:\n print('rust-std %s\\n %s\\n %s' % (version, info['url'], info['hash']))\n fetch(info['url'])\n stds.append(info)\n print('Installing packages...')\n tar_basename = 'rustc-%s-repack' % host\n install_dir = 'rustc'",
" subprocess.check_call(['rm', '-rf', install_dir])",
" install(os.path.basename(rustc['url']), install_dir)\n install(os.path.basename(cargo['url']), install_dir)\n for std in stds:\n install(os.path.basename(std['url']), install_dir)\n print('Tarring %s...' % tar_basename)",
" subprocess.check_call(['tar', 'cjf', tar_basename + '.tar.bz2', install_dir])\n subprocess.check_call(['rm', '-rf', install_dir])"
] |
[
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 90,
"char_start": 47,
"chars": "print(\"Repacking rust for %s...\" % host)\n "
},
{
"char_end": 1211,
"char_start": 1206,
"chars": "subpr"
},
{
"char_end": 1214,
"char_start": 1212,
"chars": "ce"
},
{
"char_end": 1219,
"char_start": 1216,
"chars": ".ch"
},
{
"char_end": 1227,
"char_start": 1220,
"chars": "ck_call"
},
{
"char_end": 1229,
"char_start": 1228,
"chars": "["
},
{
"char_end": 1234,
"char_start": 1232,
"chars": "',"
},
{
"char_end": 1236,
"char_start": 1235,
"chars": "'"
},
{
"char_end": 1241,
"char_start": 1240,
"chars": ","
},
{
"char_end": 1254,
"char_start": 1253,
"chars": "]"
},
{
"char_end": 1487,
"char_start": 1482,
"chars": "subpr"
},
{
"char_end": 1491,
"char_start": 1488,
"chars": "ces"
},
{
"char_end": 1495,
"char_start": 1493,
"chars": "ch"
},
{
"char_end": 1503,
"char_start": 1496,
"chars": "ck_call"
},
{
"char_end": 1505,
"char_start": 1504,
"chars": "["
},
{
"char_end": 1511,
"char_start": 1509,
"chars": "',"
},
{
"char_end": 1513,
"char_start": 1512,
"chars": "'"
},
{
"char_end": 1518,
"char_start": 1517,
"chars": ","
},
{
"char_end": 1544,
"char_start": 1531,
"chars": " + '.tar.bz2'"
},
{
"char_end": 1558,
"char_start": 1557,
"chars": "]"
},
{
"char_end": 1567,
"char_start": 1562,
"chars": "subpr"
},
{
"char_end": 1570,
"char_start": 1568,
"chars": "ce"
},
{
"char_end": 1575,
"char_start": 1572,
"chars": ".ch"
},
{
"char_end": 1583,
"char_start": 1576,
"chars": "ck_call"
},
{
"char_end": 1585,
"char_start": 1584,
"chars": "["
},
{
"char_end": 1590,
"char_start": 1588,
"chars": "',"
},
{
"char_end": 1592,
"char_start": 1591,
"chars": "'"
},
{
"char_end": 1597,
"char_start": 1596,
"chars": ","
},
{
"char_end": 1610,
"char_start": 1609,
"chars": "]"
}
],
"deleted": [
{
"char_end": 1170,
"char_start": 1166,
"chars": "syst"
},
{
"char_end": 1172,
"char_start": 1171,
"chars": "m"
},
{
"char_end": 1183,
"char_start": 1180,
"chars": " %s"
},
{
"char_end": 1186,
"char_start": 1184,
"chars": " %"
},
{
"char_end": 1427,
"char_start": 1426,
"chars": "o"
},
{
"char_end": 1429,
"char_start": 1428,
"chars": "."
},
{
"char_end": 1431,
"char_start": 1430,
"chars": "y"
},
{
"char_end": 1433,
"char_start": 1432,
"chars": "t"
},
{
"char_end": 1435,
"char_start": 1434,
"chars": "m"
},
{
"char_end": 1460,
"char_start": 1444,
"chars": " %s.tar.bz2 %s/*"
},
{
"char_end": 1465,
"char_start": 1462,
"chars": "% ("
},
{
"char_end": 1491,
"char_start": 1490,
"chars": ")"
},
{
"char_end": 1502,
"char_start": 1498,
"chars": "syst"
},
{
"char_end": 1504,
"char_start": 1503,
"chars": "m"
},
{
"char_end": 1515,
"char_start": 1512,
"chars": " %s"
},
{
"char_end": 1518,
"char_start": 1516,
"chars": " %"
}
]
},
"commit_link": "github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb",
"file_name": "repack_rust.py",
"func_name": "repack",
"line_changes": {
"added": [
{
"char_end": 88,
"char_start": 45,
"line": " print(\"Repacking rust for %s...\" % host)\n",
"line_no": 2
},
{
"char_end": 1256,
"char_start": 1204,
"line": " subprocess.check_call(['rm', '-rf', install_dir])\n",
"line_no": 29
},
{
"char_end": 1560,
"char_start": 1480,
"line": " subprocess.check_call(['tar', 'cjf', tar_basename + '.tar.bz2', install_dir])\n",
"line_no": 35
},
{
"char_end": 1611,
"char_start": 1560,
"line": " subprocess.check_call(['rm', '-rf', install_dir])\n",
"line_no": 36
}
],
"deleted": [
{
"char_end": 1200,
"char_start": 1161,
"line": " os.system('rm -rf %s' % install_dir)\n",
"line_no": 28
},
{
"char_end": 1493,
"char_start": 1424,
"line": " os.system('tar cjf %s.tar.bz2 %s/*' % (tar_basename, install_dir))\n",
"line_no": 34
},
{
"char_end": 1531,
"char_start": 1493,
"line": " os.system('rm -rf %s' % install_dir)\n",
"line_no": 35
}
]
},
"vul_type": "cwe-078"
}
| 122
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def extend_volume(self, volume, new_size):\n volume_name = self._get_3par_vol_name(volume['id'])\n old_size = volume.size\n growth_size = int(new_size) - old_size\n LOG.debug(\"Extending Volume %s from %s to %s, by %s GB.\" %\n (volume_name, old_size, new_size, growth_size))\n try:",
" self._cli_run(\"growvv -f %s %sg\" % (volume_name, growth_size),\n None)",
" except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error extending volume %s\") % volume)"
] |
[
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 359,
"char_start": 357,
"chars": "['"
},
{
"char_end": 367,
"char_start": 365,
"chars": "',"
},
{
"char_end": 369,
"char_start": 368,
"chars": "'"
},
{
"char_end": 373,
"char_start": 371,
"chars": "',"
},
{
"char_end": 395,
"char_start": 387,
"chars": "'%dg' % "
},
{
"char_end": 407,
"char_start": 406,
"chars": "]"
}
],
"deleted": [
{
"char_end": 358,
"char_start": 357,
"chars": "\""
},
{
"char_end": 375,
"char_start": 367,
"chars": " %s %sg\""
},
{
"char_end": 379,
"char_start": 376,
"chars": "% ("
},
{
"char_end": 436,
"char_start": 403,
"chars": "),\n None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "extend_volume",
"line_changes": {
"added": [
{
"char_end": 409,
"char_start": 331,
"line": " self._cli_run(['growvv', '-f', volume_name, '%dg' % growth_size])\n",
"line_no": 8
}
],
"deleted": [
{
"char_end": 406,
"char_start": 331,
"line": " self._cli_run(\"growvv -f %s %sg\" % (volume_name, growth_size),\n",
"line_no": 8
},
{
"char_end": 438,
"char_start": 406,
"line": " None)\n",
"line_no": 9
}
]
},
"vul_type": "cwe-078"
}
| 123
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def extend_volume(self, volume, new_size):\n volume_name = self._get_3par_vol_name(volume['id'])\n old_size = volume.size\n growth_size = int(new_size) - old_size\n LOG.debug(\"Extending Volume %s from %s to %s, by %s GB.\" %\n (volume_name, old_size, new_size, growth_size))\n try:",
" self._cli_run(['growvv', '-f', volume_name, '%dg' % growth_size])",
" except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error extending volume %s\") % volume)"
] |
[
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 359,
"char_start": 357,
"chars": "['"
},
{
"char_end": 367,
"char_start": 365,
"chars": "',"
},
{
"char_end": 369,
"char_start": 368,
"chars": "'"
},
{
"char_end": 373,
"char_start": 371,
"chars": "',"
},
{
"char_end": 395,
"char_start": 387,
"chars": "'%dg' % "
},
{
"char_end": 407,
"char_start": 406,
"chars": "]"
}
],
"deleted": [
{
"char_end": 358,
"char_start": 357,
"chars": "\""
},
{
"char_end": 375,
"char_start": 367,
"chars": " %s %sg\""
},
{
"char_end": 379,
"char_start": 376,
"chars": "% ("
},
{
"char_end": 436,
"char_start": 403,
"chars": "),\n None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "extend_volume",
"line_changes": {
"added": [
{
"char_end": 409,
"char_start": 331,
"line": " self._cli_run(['growvv', '-f', volume_name, '%dg' % growth_size])\n",
"line_no": 8
}
],
"deleted": [
{
"char_end": 406,
"char_start": 331,
"line": " self._cli_run(\"growvv -f %s %sg\" % (volume_name, growth_size),\n",
"line_no": 8
},
{
"char_end": 438,
"char_start": 406,
"line": " None)\n",
"line_no": 9
}
]
},
"vul_type": "cwe-078"
}
| 123
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _remove_volume_set(self, vvs_name):\n # Must first clear the QoS rules before removing the volume set",
" self._cli_run('setqos -clear vvset:%s' % (vvs_name), None)\n self._cli_run('removevvset -f %s' % (vvs_name), None)"
] |
[
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 139,
"char_start": 138,
"chars": "["
},
{
"char_end": 148,
"char_start": 146,
"chars": "',"
},
{
"char_end": 150,
"char_start": 149,
"chars": "'"
},
{
"char_end": 158,
"char_start": 156,
"chars": "',"
},
{
"char_end": 160,
"char_start": 159,
"chars": "'"
},
{
"char_end": 183,
"char_start": 182,
"chars": "]"
},
{
"char_end": 208,
"char_start": 207,
"chars": "["
},
{
"char_end": 222,
"char_start": 220,
"chars": "',"
},
{
"char_end": 224,
"char_start": 223,
"chars": "'"
},
{
"char_end": 228,
"char_start": 227,
"chars": ","
},
{
"char_end": 238,
"char_start": 237,
"chars": "]"
}
],
"deleted": [
{
"char_end": 181,
"char_start": 175,
"chars": ", None"
},
{
"char_end": 223,
"char_start": 220,
"chars": " %s"
},
{
"char_end": 226,
"char_start": 224,
"chars": " %"
},
{
"char_end": 228,
"char_start": 227,
"chars": "("
},
{
"char_end": 243,
"char_start": 236,
"chars": "), None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "_remove_volume_set",
"line_changes": {
"added": [
{
"char_end": 185,
"char_start": 116,
"line": " self._cli_run(['setqos', '-clear', 'vvset:%s' % (vvs_name)])\n",
"line_no": 3
},
{
"char_end": 239,
"char_start": 185,
"line": " self._cli_run(['removevvset', '-f', vvs_name])\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 183,
"char_start": 116,
"line": " self._cli_run('setqos -clear vvset:%s' % (vvs_name), None)\n",
"line_no": 3
},
{
"char_end": 244,
"char_start": 183,
"line": " self._cli_run('removevvset -f %s' % (vvs_name), None)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-078"
}
| 124
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _remove_volume_set(self, vvs_name):\n # Must first clear the QoS rules before removing the volume set",
" self._cli_run(['setqos', '-clear', 'vvset:%s' % (vvs_name)])\n self._cli_run(['removevvset', '-f', vvs_name])"
] |
[
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 139,
"char_start": 138,
"chars": "["
},
{
"char_end": 148,
"char_start": 146,
"chars": "',"
},
{
"char_end": 150,
"char_start": 149,
"chars": "'"
},
{
"char_end": 158,
"char_start": 156,
"chars": "',"
},
{
"char_end": 160,
"char_start": 159,
"chars": "'"
},
{
"char_end": 183,
"char_start": 182,
"chars": "]"
},
{
"char_end": 208,
"char_start": 207,
"chars": "["
},
{
"char_end": 222,
"char_start": 220,
"chars": "',"
},
{
"char_end": 224,
"char_start": 223,
"chars": "'"
},
{
"char_end": 228,
"char_start": 227,
"chars": ","
},
{
"char_end": 238,
"char_start": 237,
"chars": "]"
}
],
"deleted": [
{
"char_end": 181,
"char_start": 175,
"chars": ", None"
},
{
"char_end": 223,
"char_start": 220,
"chars": " %s"
},
{
"char_end": 226,
"char_start": 224,
"chars": " %"
},
{
"char_end": 228,
"char_start": 227,
"chars": "("
},
{
"char_end": 243,
"char_start": 236,
"chars": "), None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "_remove_volume_set",
"line_changes": {
"added": [
{
"char_end": 185,
"char_start": 116,
"line": " self._cli_run(['setqos', '-clear', 'vvset:%s' % (vvs_name)])\n",
"line_no": 3
},
{
"char_end": 239,
"char_start": 185,
"line": " self._cli_run(['removevvset', '-f', vvs_name])\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 183,
"char_start": 116,
"line": " self._cli_run('setqos -clear vvset:%s' % (vvs_name), None)\n",
"line_no": 3
},
{
"char_end": 244,
"char_start": 183,
"line": " self._cli_run('removevvset -f %s' % (vvs_name), None)\n",
"line_no": 4
}
]
},
"vul_type": "cwe-078"
}
| 124
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _get_3par_hostname_from_wwn_iqn(self, wwns_iqn):",
" out = self._cli_run('showhost -d', None)",
" # wwns_iqn may be a list of strings or a single\n # string. So, if necessary, create a list to loop.\n if not isinstance(wwns_iqn, list):\n wwn_iqn_list = [wwns_iqn]\n else:\n wwn_iqn_list = wwns_iqn",
" for wwn_iqn in wwn_iqn_list:\n for showhost in out:\n if (wwn_iqn.upper() in showhost.upper()):\n return showhost.split(',')[1]"
] |
[
1,
0,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 86,
"char_start": 85,
"chars": "["
},
{
"char_end": 97,
"char_start": 95,
"chars": "',"
},
{
"char_end": 99,
"char_start": 98,
"chars": "'"
},
{
"char_end": 103,
"char_start": 102,
"chars": "]"
}
],
"deleted": [
{
"char_end": 104,
"char_start": 98,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "_get_3par_hostname_from_wwn_iqn",
"line_changes": {
"added": [
{
"char_end": 105,
"char_start": 57,
"line": " out = self._cli_run(['showhost', '-d'])\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 106,
"char_start": 57,
"line": " out = self._cli_run('showhost -d', None)\n",
"line_no": 2
}
]
},
"vul_type": "cwe-078"
}
| 125
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _get_3par_hostname_from_wwn_iqn(self, wwns_iqn):",
" out = self._cli_run(['showhost', '-d'])",
" # wwns_iqn may be a list of strings or a single\n # string. So, if necessary, create a list to loop.\n if not isinstance(wwns_iqn, list):\n wwn_iqn_list = [wwns_iqn]\n else:\n wwn_iqn_list = wwns_iqn",
" for wwn_iqn in wwn_iqn_list:\n for showhost in out:\n if (wwn_iqn.upper() in showhost.upper()):\n return showhost.split(',')[1]"
] |
[
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 86,
"char_start": 85,
"chars": "["
},
{
"char_end": 97,
"char_start": 95,
"chars": "',"
},
{
"char_end": 99,
"char_start": 98,
"chars": "'"
},
{
"char_end": 103,
"char_start": 102,
"chars": "]"
}
],
"deleted": [
{
"char_end": 104,
"char_start": 98,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "_get_3par_hostname_from_wwn_iqn",
"line_changes": {
"added": [
{
"char_end": 105,
"char_start": 57,
"line": " out = self._cli_run(['showhost', '-d'])\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 106,
"char_start": 57,
"line": " out = self._cli_run('showhost -d', None)\n",
"line_no": 2
}
]
},
"vul_type": "cwe-078"
}
| 125
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def get_ports(self):\n # First get the active FC ports",
" out = self._cli_run('showport', None)",
"\n # strip out header\n # N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type,\n # Protocol,Label,Partner,FailoverState\n out = out[1:len(out) - 2]",
" ports = {'FC': [], 'iSCSI': {}}\n for line in out:\n tmp = line.split(',')",
" if tmp:\n if tmp[1] == 'target' and tmp[2] == 'ready':\n if tmp[6] == 'FC':\n ports['FC'].append(tmp[4])",
" # now get the active iSCSI ports",
" out = self._cli_run('showport -iscsi', None)",
"\n # strip out header\n # N:S:P,State,IPAddr,Netmask,Gateway,\n # TPGT,MTU,Rate,DHCP,iSNS_Addr,iSNS_Port\n out = out[1:len(out) - 2]\n for line in out:\n tmp = line.split(',')",
" if tmp and len(tmp) > 2:\n if tmp[1] == 'ready':\n ports['iSCSI'][tmp[2]] = {}",
" # now get the nsp and iqn",
" result = self._cli_run('showport -iscsiname', None)",
" if result:\n # first line is header\n # nsp, ip,iqn\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 2:\n if info[1] in ports['iSCSI']:\n nsp = info[0]\n ip_addr = info[1]\n iqn = info[2]\n ports['iSCSI'][ip_addr] = {'nsp': nsp,\n 'iqn': iqn\n }",
" LOG.debug(\"PORTS = %s\" % pprint.pformat(ports))\n return ports"
] |
[
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 94,
"char_start": 93,
"chars": "["
},
{
"char_end": 105,
"char_start": 104,
"chars": "]"
},
{
"char_end": 628,
"char_start": 627,
"chars": "["
},
{
"char_end": 639,
"char_start": 637,
"chars": "',"
},
{
"char_end": 641,
"char_start": 640,
"chars": "'"
},
{
"char_end": 649,
"char_start": 648,
"chars": "]"
},
{
"char_end": 1058,
"char_start": 1057,
"chars": "["
},
{
"char_end": 1069,
"char_start": 1067,
"chars": "',"
},
{
"char_end": 1071,
"char_start": 1070,
"chars": "'"
},
{
"char_end": 1083,
"char_start": 1082,
"chars": "]"
}
],
"deleted": [
{
"char_end": 109,
"char_start": 103,
"chars": ", None"
},
{
"char_end": 654,
"char_start": 648,
"chars": ", None"
},
{
"char_end": 1089,
"char_start": 1083,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "get_ports",
"line_changes": {
"added": [
{
"char_end": 107,
"char_start": 65,
"line": " out = self._cli_run(['showport'])\n",
"line_no": 3
},
{
"char_end": 651,
"char_start": 599,
"line": " out = self._cli_run(['showport', '-iscsi'])\n",
"line_no": 20
},
{
"char_end": 1085,
"char_start": 1026,
"line": " result = self._cli_run(['showport', '-iscsiname'])\n",
"line_no": 34
}
],
"deleted": [
{
"char_end": 111,
"char_start": 65,
"line": " out = self._cli_run('showport', None)\n",
"line_no": 3
},
{
"char_end": 656,
"char_start": 603,
"line": " out = self._cli_run('showport -iscsi', None)\n",
"line_no": 20
},
{
"char_end": 1091,
"char_start": 1031,
"line": " result = self._cli_run('showport -iscsiname', None)\n",
"line_no": 34
}
]
},
"vul_type": "cwe-078"
}
| 126
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def get_ports(self):\n # First get the active FC ports",
" out = self._cli_run(['showport'])",
"\n # strip out header\n # N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type,\n # Protocol,Label,Partner,FailoverState\n out = out[1:len(out) - 2]",
" ports = {'FC': [], 'iSCSI': {}}\n for line in out:\n tmp = line.split(',')",
" if tmp:\n if tmp[1] == 'target' and tmp[2] == 'ready':\n if tmp[6] == 'FC':\n ports['FC'].append(tmp[4])",
" # now get the active iSCSI ports",
" out = self._cli_run(['showport', '-iscsi'])",
"\n # strip out header\n # N:S:P,State,IPAddr,Netmask,Gateway,\n # TPGT,MTU,Rate,DHCP,iSNS_Addr,iSNS_Port\n out = out[1:len(out) - 2]\n for line in out:\n tmp = line.split(',')",
" if tmp and len(tmp) > 2:\n if tmp[1] == 'ready':\n ports['iSCSI'][tmp[2]] = {}",
" # now get the nsp and iqn",
" result = self._cli_run(['showport', '-iscsiname'])",
" if result:\n # first line is header\n # nsp, ip,iqn\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 2:\n if info[1] in ports['iSCSI']:\n nsp = info[0]\n ip_addr = info[1]\n iqn = info[2]\n ports['iSCSI'][ip_addr] = {'nsp': nsp,\n 'iqn': iqn\n }",
" LOG.debug(\"PORTS = %s\" % pprint.pformat(ports))\n return ports"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 94,
"char_start": 93,
"chars": "["
},
{
"char_end": 105,
"char_start": 104,
"chars": "]"
},
{
"char_end": 628,
"char_start": 627,
"chars": "["
},
{
"char_end": 639,
"char_start": 637,
"chars": "',"
},
{
"char_end": 641,
"char_start": 640,
"chars": "'"
},
{
"char_end": 649,
"char_start": 648,
"chars": "]"
},
{
"char_end": 1058,
"char_start": 1057,
"chars": "["
},
{
"char_end": 1069,
"char_start": 1067,
"chars": "',"
},
{
"char_end": 1071,
"char_start": 1070,
"chars": "'"
},
{
"char_end": 1083,
"char_start": 1082,
"chars": "]"
}
],
"deleted": [
{
"char_end": 109,
"char_start": 103,
"chars": ", None"
},
{
"char_end": 654,
"char_start": 648,
"chars": ", None"
},
{
"char_end": 1089,
"char_start": 1083,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "get_ports",
"line_changes": {
"added": [
{
"char_end": 107,
"char_start": 65,
"line": " out = self._cli_run(['showport'])\n",
"line_no": 3
},
{
"char_end": 651,
"char_start": 599,
"line": " out = self._cli_run(['showport', '-iscsi'])\n",
"line_no": 20
},
{
"char_end": 1085,
"char_start": 1026,
"line": " result = self._cli_run(['showport', '-iscsiname'])\n",
"line_no": 34
}
],
"deleted": [
{
"char_end": 111,
"char_start": 65,
"line": " out = self._cli_run('showport', None)\n",
"line_no": 3
},
{
"char_end": 656,
"char_start": 603,
"line": " out = self._cli_run('showport -iscsi', None)\n",
"line_no": 20
},
{
"char_end": 1091,
"char_start": 1031,
"line": " result = self._cli_run('showport -iscsiname', None)\n",
"line_no": 34
}
]
},
"vul_type": "cwe-078"
}
| 126
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_get_least_used_nsp(self):\n self.flags(lock_path=self.tempdir)",
" #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n",
" show_vlun_cmd = 'showvlun -a -showcols Port'",
" _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])",
" self.mox.ReplayAll()\n # in use count 11 12\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:8:1'])\n self.assertEqual(nsp, '0:2:1')",
" # in use count 11 10\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:2:1'])\n self.assertEqual(nsp, '1:2:1')",
" # in use count 0 10\n nsp = self.driver._get_least_used_nsp(['1:1:1', '1:2:1'])\n self.assertEqual(nsp, '1:1:1')"
] |
[
1,
1,
0,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 307,
"char_start": 306,
"chars": "["
},
{
"char_end": 318,
"char_start": 316,
"chars": "',"
},
{
"char_end": 320,
"char_start": 319,
"chars": "'"
},
{
"char_end": 324,
"char_start": 322,
"chars": "',"
},
{
"char_end": 326,
"char_start": 325,
"chars": "'"
},
{
"char_end": 337,
"char_start": 335,
"chars": "',"
},
{
"char_end": 339,
"char_start": 338,
"chars": "'"
},
{
"char_end": 345,
"char_start": 344,
"chars": "]"
}
],
"deleted": []
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/tests/test_hp3par.py",
"func_name": "test_get_least_used_nsp",
"line_changes": {
"added": [
{
"char_end": 346,
"char_start": 282,
"line": " show_vlun_cmd = ['showvlun', '-a', '-showcols', 'Port']\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 335,
"char_start": 282,
"line": " show_vlun_cmd = 'showvlun -a -showcols Port'\n",
"line_no": 9
}
]
},
"vul_type": "cwe-078"
}
| 127
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def test_get_least_used_nsp(self):\n self.flags(lock_path=self.tempdir)",
" #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n",
" show_vlun_cmd = ['showvlun', '-a', '-showcols', 'Port']",
" _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])",
" self.mox.ReplayAll()\n # in use count 11 12\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:8:1'])\n self.assertEqual(nsp, '0:2:1')",
" # in use count 11 10\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:2:1'])\n self.assertEqual(nsp, '1:2:1')",
" # in use count 0 10\n nsp = self.driver._get_least_used_nsp(['1:1:1', '1:2:1'])\n self.assertEqual(nsp, '1:1:1')"
] |
[
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 307,
"char_start": 306,
"chars": "["
},
{
"char_end": 318,
"char_start": 316,
"chars": "',"
},
{
"char_end": 320,
"char_start": 319,
"chars": "'"
},
{
"char_end": 324,
"char_start": 322,
"chars": "',"
},
{
"char_end": 326,
"char_start": 325,
"chars": "'"
},
{
"char_end": 337,
"char_start": 335,
"chars": "',"
},
{
"char_end": 339,
"char_start": 338,
"chars": "'"
},
{
"char_end": 345,
"char_start": 344,
"chars": "]"
}
],
"deleted": []
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/tests/test_hp3par.py",
"func_name": "test_get_least_used_nsp",
"line_changes": {
"added": [
{
"char_end": 346,
"char_start": 282,
"line": " show_vlun_cmd = ['showvlun', '-a', '-showcols', 'Port']\n",
"line_no": 9
}
],
"deleted": [
{
"char_end": 335,
"char_start": 282,
"line": " show_vlun_cmd = 'showvlun -a -showcols Port'\n",
"line_no": 9
}
]
},
"vul_type": "cwe-078"
}
| 127
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _cmd_to_dict(self, cmd):\n arg_list = cmd.split()",
" no_param_args = [\n 'autodelete',\n 'autoexpand',\n 'bytes',\n 'compressed',\n 'force',\n 'nohdr',\n ]\n one_param_args = [\n 'chapsecret',\n 'cleanrate',\n 'copyrate',\n 'delim',\n 'filtervalue',\n 'grainsize',\n 'hbawwpn',\n 'host',\n 'iogrp',\n 'iscsiname',\n 'mdiskgrp',\n 'name',\n 'rsize',\n 'scsi',\n 'size',\n 'source',\n 'target',\n 'unit',\n 'easytier',\n 'warning',\n 'wwpn',\n ]",
" # Handle the special case of lsnode which is a two-word command\n # Use the one word version of the command internally\n if arg_list[0] in ('svcinfo', 'svctask'):\n if arg_list[1] == 'lsnode':\n if len(arg_list) > 4: # e.g. svcinfo lsnode -delim ! <node id>\n ret = {'cmd': 'lsnode', 'node_id': arg_list[-1]}\n else:\n ret = {'cmd': 'lsnodecanister'}\n else:\n ret = {'cmd': arg_list[1]}\n arg_list.pop(0)\n else:\n ret = {'cmd': arg_list[0]}",
" skip = False\n for i in range(1, len(arg_list)):\n if skip:\n skip = False\n continue\n if arg_list[i][0] == '-':\n if arg_list[i][1:] in no_param_args:\n ret[arg_list[i][1:]] = True\n elif arg_list[i][1:] in one_param_args:\n ret[arg_list[i][1:]] = arg_list[i + 1]\n skip = True\n else:\n raise exception.InvalidInput(\n reason=_('unrecognized argument %s') % arg_list[i])\n else:\n ret['obj'] = arg_list[i]\n return ret"
] |
[
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 37,
"char_start": 36,
"chars": ":"
}
],
"deleted": [
{
"char_end": 41,
"char_start": 27,
"chars": "cmd):\n "
},
{
"char_end": 62,
"char_start": 49,
"chars": " = cmd.split("
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/tests/test_storwize_svc.py",
"func_name": "_cmd_to_dict",
"line_changes": {
"added": [
{
"char_end": 38,
"char_start": 0,
"line": " def _cmd_to_dict(self, arg_list):\n",
"line_no": 1
}
],
"deleted": [
{
"char_end": 33,
"char_start": 0,
"line": " def _cmd_to_dict(self, cmd):\n",
"line_no": 1
}
]
},
"vul_type": "cwe-078"
}
| 128
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _cmd_to_dict(self, arg_list):",
" no_param_args = [\n 'autodelete',\n 'autoexpand',\n 'bytes',\n 'compressed',\n 'force',\n 'nohdr',\n ]\n one_param_args = [\n 'chapsecret',\n 'cleanrate',\n 'copyrate',\n 'delim',\n 'filtervalue',\n 'grainsize',\n 'hbawwpn',\n 'host',\n 'iogrp',\n 'iscsiname',\n 'mdiskgrp',\n 'name',\n 'rsize',\n 'scsi',\n 'size',\n 'source',\n 'target',\n 'unit',\n 'easytier',\n 'warning',\n 'wwpn',\n ]",
" # Handle the special case of lsnode which is a two-word command\n # Use the one word version of the command internally\n if arg_list[0] in ('svcinfo', 'svctask'):\n if arg_list[1] == 'lsnode':\n if len(arg_list) > 4: # e.g. svcinfo lsnode -delim ! <node id>\n ret = {'cmd': 'lsnode', 'node_id': arg_list[-1]}\n else:\n ret = {'cmd': 'lsnodecanister'}\n else:\n ret = {'cmd': arg_list[1]}\n arg_list.pop(0)\n else:\n ret = {'cmd': arg_list[0]}",
" skip = False\n for i in range(1, len(arg_list)):\n if skip:\n skip = False\n continue\n if arg_list[i][0] == '-':\n if arg_list[i][1:] in no_param_args:\n ret[arg_list[i][1:]] = True\n elif arg_list[i][1:] in one_param_args:\n ret[arg_list[i][1:]] = arg_list[i + 1]\n skip = True\n else:\n raise exception.InvalidInput(\n reason=_('unrecognized argument %s') % arg_list[i])\n else:\n ret['obj'] = arg_list[i]\n return ret"
] |
[
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 37,
"char_start": 36,
"chars": ":"
}
],
"deleted": [
{
"char_end": 41,
"char_start": 27,
"chars": "cmd):\n "
},
{
"char_end": 62,
"char_start": 49,
"chars": " = cmd.split("
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/tests/test_storwize_svc.py",
"func_name": "_cmd_to_dict",
"line_changes": {
"added": [
{
"char_end": 38,
"char_start": 0,
"line": " def _cmd_to_dict(self, arg_list):\n",
"line_no": 1
}
],
"deleted": [
{
"char_end": 33,
"char_start": 0,
"line": " def _cmd_to_dict(self, cmd):\n",
"line_no": 1
}
]
},
"vul_type": "cwe-078"
}
| 128
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _cli_run(self, verb, cli_args):",
" \"\"\"Runs a CLI command over SSH, without doing any result parsing.\"\"\"",
" cli_arg_strings = []\n if cli_args:\n for k, v in cli_args.items():\n if k == '':\n cli_arg_strings.append(\" %s\" % k)\n else:\n cli_arg_strings.append(\" %s=%s\" % (k, v))",
" cmd = verb + ''.join(cli_arg_strings)",
" LOG.debug(\"SSH CMD = %s \" % cmd)",
" (stdout, stderr) = self._run_ssh(cmd, False)",
" # we have to strip out the input and exit lines\n tmp = stdout.split(\"\\r\\n\")\n out = tmp[5:len(tmp) - 2]\n return out"
] |
[
0,
1,
0,
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 26,
"char_start": 24,
"chars": "md"
}
],
"deleted": [
{
"char_end": 29,
"char_start": 23,
"chars": "verb, "
},
{
"char_end": 37,
"char_start": 30,
"chars": "li_args"
},
{
"char_end": 421,
"char_start": 116,
"chars": "\n cli_arg_strings = []\n if cli_args:\n for k, v in cli_args.items():\n if k == '':\n cli_arg_strings.append(\" %s\" % k)\n else:\n cli_arg_strings.append(\" %s=%s\" % (k, v))\n\n cmd = verb + ''.join(cli_arg_strings)"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "_cli_run",
"line_changes": {
"added": [
{
"char_end": 29,
"char_start": 0,
"line": " def _cli_run(self, cmd):\n",
"line_no": 1
}
],
"deleted": [
{
"char_end": 40,
"char_start": 0,
"line": " def _cli_run(self, verb, cli_args):\n",
"line_no": 1
},
{
"char_end": 146,
"char_start": 117,
"line": " cli_arg_strings = []\n",
"line_no": 3
},
{
"char_end": 167,
"char_start": 146,
"line": " if cli_args:\n",
"line_no": 4
},
{
"char_end": 209,
"char_start": 167,
"line": " for k, v in cli_args.items():\n",
"line_no": 5
},
{
"char_end": 237,
"char_start": 209,
"line": " if k == '':\n",
"line_no": 6
},
{
"char_end": 291,
"char_start": 237,
"line": " cli_arg_strings.append(\" %s\" % k)\n",
"line_no": 7
},
{
"char_end": 313,
"char_start": 291,
"line": " else:\n",
"line_no": 8
},
{
"char_end": 375,
"char_start": 313,
"line": " cli_arg_strings.append(\" %s=%s\" % (k, v))\n",
"line_no": 9
},
{
"char_end": 376,
"char_start": 375,
"line": "\n",
"line_no": 10
},
{
"char_end": 422,
"char_start": 376,
"line": " cmd = verb + ''.join(cli_arg_strings)\n",
"line_no": 11
}
]
},
"vul_type": "cwe-078"
}
| 129
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _cli_run(self, cmd):",
" \"\"\"Runs a CLI command over SSH, without doing any result parsing.\"\"\"",
"",
" LOG.debug(\"SSH CMD = %s \" % cmd)",
" (stdout, stderr) = self._run_ssh(cmd, False)",
" # we have to strip out the input and exit lines\n tmp = stdout.split(\"\\r\\n\")\n out = tmp[5:len(tmp) - 2]\n return out"
] |
[
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 26,
"char_start": 24,
"chars": "md"
}
],
"deleted": [
{
"char_end": 29,
"char_start": 23,
"chars": "verb, "
},
{
"char_end": 37,
"char_start": 30,
"chars": "li_args"
},
{
"char_end": 421,
"char_start": 116,
"chars": "\n cli_arg_strings = []\n if cli_args:\n for k, v in cli_args.items():\n if k == '':\n cli_arg_strings.append(\" %s\" % k)\n else:\n cli_arg_strings.append(\" %s=%s\" % (k, v))\n\n cmd = verb + ''.join(cli_arg_strings)"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "_cli_run",
"line_changes": {
"added": [
{
"char_end": 29,
"char_start": 0,
"line": " def _cli_run(self, cmd):\n",
"line_no": 1
}
],
"deleted": [
{
"char_end": 40,
"char_start": 0,
"line": " def _cli_run(self, verb, cli_args):\n",
"line_no": 1
},
{
"char_end": 146,
"char_start": 117,
"line": " cli_arg_strings = []\n",
"line_no": 3
},
{
"char_end": 167,
"char_start": 146,
"line": " if cli_args:\n",
"line_no": 4
},
{
"char_end": 209,
"char_start": 167,
"line": " for k, v in cli_args.items():\n",
"line_no": 5
},
{
"char_end": 237,
"char_start": 209,
"line": " if k == '':\n",
"line_no": 6
},
{
"char_end": 291,
"char_start": 237,
"line": " cli_arg_strings.append(\" %s\" % k)\n",
"line_no": 7
},
{
"char_end": 313,
"char_start": 291,
"line": " else:\n",
"line_no": 8
},
{
"char_end": 375,
"char_start": 313,
"line": " cli_arg_strings.append(\" %s=%s\" % (k, v))\n",
"line_no": 9
},
{
"char_end": 376,
"char_start": 375,
"line": "\n",
"line_no": 10
},
{
"char_end": 422,
"char_start": 376,
"line": " cmd = verb + ''.join(cli_arg_strings)\n",
"line_no": 11
}
]
},
"vul_type": "cwe-078"
}
| 129
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):",
" # XXX see if we want to keep an external call here\n if verbose:\n zipoptions = \"-r\"\n else:\n zipoptions = \"-rq\"",
" from distutils.errors import DistutilsExecError\n from distutils.spawn import spawn",
" try:",
" spawn([\"zip\", zipoptions, zip_filename, base_dir], dry_run=dry_run)\n except DistutilsExecError:",
" # XXX really should distinguish between \"couldn't find\n # external 'zip' command\" and \"zip failed\".\n raise ExecError, \\\n (\"unable to create zip file '%s': \"\n \"could neither import the 'zipfile' module nor \"\n \"find a standalone zip utility\") % zip_filename"
] |
[
0,
1,
0,
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 65,
"char_start": 63,
"chars": ", "
},
{
"char_end": 69,
"char_start": 66,
"chars": "ogg"
},
{
"char_end": 71,
"char_start": 70,
"chars": "r"
},
{
"char_end": 213,
"char_start": 212,
"chars": "c"
},
{
"char_end": 215,
"char_start": 214,
"chars": "d"
},
{
"char_end": 232,
"char_start": 216,
"chars": "= [\"zip\", zipopt"
},
{
"char_end": 235,
"char_start": 233,
"chars": "on"
},
{
"char_end": 243,
"char_start": 236,
"chars": ", zip_f"
},
{
"char_end": 254,
"char_start": 245,
"chars": "ename, ba"
},
{
"char_end": 259,
"char_start": 256,
"chars": "_di"
},
{
"char_end": 265,
"char_start": 260,
"chars": "]\n "
},
{
"char_end": 270,
"char_start": 267,
"chars": "f l"
},
{
"char_end": 274,
"char_start": 271,
"chars": "gge"
},
{
"char_end": 281,
"char_start": 278,
"chars": " no"
},
{
"char_end": 297,
"char_start": 282,
"chars": " None:\n "
},
{
"char_end": 301,
"char_start": 298,
"chars": "ogg"
},
{
"char_end": 307,
"char_start": 303,
"chars": ".inf"
},
{
"char_end": 323,
"char_start": 308,
"chars": "(' '.join(cmd))"
},
{
"char_end": 329,
"char_start": 328,
"chars": "i"
},
{
"char_end": 336,
"char_start": 332,
"chars": "ry_r"
},
{
"char_end": 350,
"char_start": 337,
"chars": "n:\n re"
},
{
"char_end": 353,
"char_start": 351,
"chars": "ur"
},
{
"char_end": 358,
"char_start": 354,
"chars": "\n "
},
{
"char_end": 369,
"char_start": 367,
"chars": "ub"
},
{
"char_end": 376,
"char_start": 370,
"chars": "rocess"
},
{
"char_end": 397,
"char_start": 395,
"chars": "ub"
},
{
"char_end": 399,
"char_start": 398,
"chars": "r"
},
{
"char_end": 401,
"char_start": 400,
"chars": "c"
},
{
"char_end": 403,
"char_start": 402,
"chars": "s"
},
{
"char_end": 407,
"char_start": 404,
"chars": ".ch"
},
{
"char_end": 410,
"char_start": 408,
"chars": "ck"
},
{
"char_end": 418,
"char_start": 411,
"chars": "call(cm"
},
{
"char_end": 440,
"char_start": 434,
"chars": "bproce"
},
{
"char_end": 447,
"char_start": 441,
"chars": "s.Call"
},
{
"char_end": 452,
"char_start": 448,
"chars": "dPro"
},
{
"char_end": 456,
"char_start": 453,
"chars": "ess"
}
],
"deleted": [
{
"char_end": 60,
"char_start": 54,
"chars": "=False"
},
{
"char_end": 72,
"char_start": 69,
"chars": "=Fa"
},
{
"char_end": 74,
"char_start": 73,
"chars": "s"
},
{
"char_end": 219,
"char_start": 216,
"chars": "fro"
},
{
"char_end": 222,
"char_start": 221,
"chars": "d"
},
{
"char_end": 226,
"char_start": 223,
"chars": "stu"
},
{
"char_end": 231,
"char_start": 230,
"chars": "."
},
{
"char_end": 237,
"char_start": 233,
"chars": "rors"
},
{
"char_end": 241,
"char_start": 239,
"chars": "mp"
},
{
"char_end": 244,
"char_start": 243,
"chars": "t"
},
{
"char_end": 246,
"char_start": 245,
"chars": "D"
},
{
"char_end": 250,
"char_start": 248,
"chars": "tu"
},
{
"char_end": 252,
"char_start": 251,
"chars": "i"
},
{
"char_end": 256,
"char_start": 253,
"chars": "sEx"
},
{
"char_end": 259,
"char_start": 257,
"chars": "cE"
},
{
"char_end": 261,
"char_start": 260,
"chars": "r"
},
{
"char_end": 263,
"char_start": 262,
"chars": "r"
},
{
"char_end": 272,
"char_start": 270,
"chars": "om"
},
{
"char_end": 276,
"char_start": 273,
"chars": "dis"
},
{
"char_end": 287,
"char_start": 278,
"chars": "tils.spaw"
},
{
"char_end": 301,
"char_start": 298,
"chars": "awn"
},
{
"char_end": 336,
"char_start": 321,
"chars": "awn([\"zip\", zip"
},
{
"char_end": 342,
"char_start": 337,
"chars": "ption"
},
{
"char_end": 348,
"char_start": 343,
"chars": ", zip"
},
{
"char_end": 351,
"char_start": 349,
"chars": "fi"
},
{
"char_end": 355,
"char_start": 352,
"chars": "ena"
},
{
"char_end": 378,
"char_start": 356,
"chars": "e, base_dir], dry_run="
},
{
"char_end": 385,
"char_start": 379,
"chars": "ry_run"
},
{
"char_end": 400,
"char_start": 398,
"chars": "Di"
},
{
"char_end": 402,
"char_start": 401,
"chars": "t"
},
{
"char_end": 405,
"char_start": 403,
"chars": "ti"
},
{
"char_end": 409,
"char_start": 406,
"chars": "sEx"
}
]
},
"commit_link": "github.com/python/cpython/commit/add531a1e55b0a739b0f42582f1c9747e5649ace",
"file_name": "Lib/shutil.py",
"func_name": "_call_external_zip",
"line_changes": {
"added": [
{
"char_end": 74,
"char_start": 0,
"line": "def _call_external_zip(base_dir, zip_filename, verbose, dry_run, logger):\n",
"line_no": 1
},
{
"char_end": 262,
"char_start": 208,
"line": " cmd = [\"zip\", zipoptions, zip_filename, base_dir]\n",
"line_no": 7
},
{
"char_end": 289,
"char_start": 262,
"line": " if logger is not None:\n",
"line_no": 8
},
{
"char_end": 324,
"char_start": 289,
"line": " logger.info(' '.join(cmd))\n",
"line_no": 9
},
{
"char_end": 340,
"char_start": 324,
"line": " if dry_run:\n",
"line_no": 10
},
{
"char_end": 355,
"char_start": 340,
"line": " return\n",
"line_no": 11
},
{
"char_end": 377,
"char_start": 355,
"line": " import subprocess\n",
"line_no": 12
},
{
"char_end": 421,
"char_start": 386,
"line": " subprocess.check_call(cmd)\n",
"line_no": 14
},
{
"char_end": 463,
"char_start": 421,
"line": " except subprocess.CalledProcessError:\n",
"line_no": 15
}
],
"deleted": [
{
"char_end": 78,
"char_start": 0,
"line": "def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):\n",
"line_no": 1
},
{
"char_end": 264,
"char_start": 212,
"line": " from distutils.errors import DistutilsExecError\n",
"line_no": 7
},
{
"char_end": 302,
"char_start": 264,
"line": " from distutils.spawn import spawn\n",
"line_no": 8
},
{
"char_end": 387,
"char_start": 311,
"line": " spawn([\"zip\", zipoptions, zip_filename, base_dir], dry_run=dry_run)\n",
"line_no": 10
},
{
"char_end": 418,
"char_start": 387,
"line": " except DistutilsExecError:\n",
"line_no": 11
}
]
},
"vul_type": "cwe-078"
}
| 130
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _call_external_zip(base_dir, zip_filename, verbose, dry_run, logger):",
" # XXX see if we want to keep an external call here\n if verbose:\n zipoptions = \"-r\"\n else:\n zipoptions = \"-rq\"",
" cmd = [\"zip\", zipoptions, zip_filename, base_dir]\n if logger is not None:\n logger.info(' '.join(cmd))\n if dry_run:\n return\n import subprocess",
" try:",
" subprocess.check_call(cmd)\n except subprocess.CalledProcessError:",
" # XXX really should distinguish between \"couldn't find\n # external 'zip' command\" and \"zip failed\".\n raise ExecError, \\\n (\"unable to create zip file '%s': \"\n \"could neither import the 'zipfile' module nor \"\n \"find a standalone zip utility\") % zip_filename"
] |
[
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 65,
"char_start": 63,
"chars": ", "
},
{
"char_end": 69,
"char_start": 66,
"chars": "ogg"
},
{
"char_end": 71,
"char_start": 70,
"chars": "r"
},
{
"char_end": 213,
"char_start": 212,
"chars": "c"
},
{
"char_end": 215,
"char_start": 214,
"chars": "d"
},
{
"char_end": 232,
"char_start": 216,
"chars": "= [\"zip\", zipopt"
},
{
"char_end": 235,
"char_start": 233,
"chars": "on"
},
{
"char_end": 243,
"char_start": 236,
"chars": ", zip_f"
},
{
"char_end": 254,
"char_start": 245,
"chars": "ename, ba"
},
{
"char_end": 259,
"char_start": 256,
"chars": "_di"
},
{
"char_end": 265,
"char_start": 260,
"chars": "]\n "
},
{
"char_end": 270,
"char_start": 267,
"chars": "f l"
},
{
"char_end": 274,
"char_start": 271,
"chars": "gge"
},
{
"char_end": 281,
"char_start": 278,
"chars": " no"
},
{
"char_end": 297,
"char_start": 282,
"chars": " None:\n "
},
{
"char_end": 301,
"char_start": 298,
"chars": "ogg"
},
{
"char_end": 307,
"char_start": 303,
"chars": ".inf"
},
{
"char_end": 323,
"char_start": 308,
"chars": "(' '.join(cmd))"
},
{
"char_end": 329,
"char_start": 328,
"chars": "i"
},
{
"char_end": 336,
"char_start": 332,
"chars": "ry_r"
},
{
"char_end": 350,
"char_start": 337,
"chars": "n:\n re"
},
{
"char_end": 353,
"char_start": 351,
"chars": "ur"
},
{
"char_end": 358,
"char_start": 354,
"chars": "\n "
},
{
"char_end": 369,
"char_start": 367,
"chars": "ub"
},
{
"char_end": 376,
"char_start": 370,
"chars": "rocess"
},
{
"char_end": 397,
"char_start": 395,
"chars": "ub"
},
{
"char_end": 399,
"char_start": 398,
"chars": "r"
},
{
"char_end": 401,
"char_start": 400,
"chars": "c"
},
{
"char_end": 403,
"char_start": 402,
"chars": "s"
},
{
"char_end": 407,
"char_start": 404,
"chars": ".ch"
},
{
"char_end": 410,
"char_start": 408,
"chars": "ck"
},
{
"char_end": 418,
"char_start": 411,
"chars": "call(cm"
},
{
"char_end": 440,
"char_start": 434,
"chars": "bproce"
},
{
"char_end": 447,
"char_start": 441,
"chars": "s.Call"
},
{
"char_end": 452,
"char_start": 448,
"chars": "dPro"
},
{
"char_end": 456,
"char_start": 453,
"chars": "ess"
}
],
"deleted": [
{
"char_end": 60,
"char_start": 54,
"chars": "=False"
},
{
"char_end": 72,
"char_start": 69,
"chars": "=Fa"
},
{
"char_end": 74,
"char_start": 73,
"chars": "s"
},
{
"char_end": 219,
"char_start": 216,
"chars": "fro"
},
{
"char_end": 222,
"char_start": 221,
"chars": "d"
},
{
"char_end": 226,
"char_start": 223,
"chars": "stu"
},
{
"char_end": 231,
"char_start": 230,
"chars": "."
},
{
"char_end": 237,
"char_start": 233,
"chars": "rors"
},
{
"char_end": 241,
"char_start": 239,
"chars": "mp"
},
{
"char_end": 244,
"char_start": 243,
"chars": "t"
},
{
"char_end": 246,
"char_start": 245,
"chars": "D"
},
{
"char_end": 250,
"char_start": 248,
"chars": "tu"
},
{
"char_end": 252,
"char_start": 251,
"chars": "i"
},
{
"char_end": 256,
"char_start": 253,
"chars": "sEx"
},
{
"char_end": 259,
"char_start": 257,
"chars": "cE"
},
{
"char_end": 261,
"char_start": 260,
"chars": "r"
},
{
"char_end": 263,
"char_start": 262,
"chars": "r"
},
{
"char_end": 272,
"char_start": 270,
"chars": "om"
},
{
"char_end": 276,
"char_start": 273,
"chars": "dis"
},
{
"char_end": 287,
"char_start": 278,
"chars": "tils.spaw"
},
{
"char_end": 301,
"char_start": 298,
"chars": "awn"
},
{
"char_end": 336,
"char_start": 321,
"chars": "awn([\"zip\", zip"
},
{
"char_end": 342,
"char_start": 337,
"chars": "ption"
},
{
"char_end": 348,
"char_start": 343,
"chars": ", zip"
},
{
"char_end": 351,
"char_start": 349,
"chars": "fi"
},
{
"char_end": 355,
"char_start": 352,
"chars": "ena"
},
{
"char_end": 378,
"char_start": 356,
"chars": "e, base_dir], dry_run="
},
{
"char_end": 385,
"char_start": 379,
"chars": "ry_run"
},
{
"char_end": 400,
"char_start": 398,
"chars": "Di"
},
{
"char_end": 402,
"char_start": 401,
"chars": "t"
},
{
"char_end": 405,
"char_start": 403,
"chars": "ti"
},
{
"char_end": 409,
"char_start": 406,
"chars": "sEx"
}
]
},
"commit_link": "github.com/python/cpython/commit/add531a1e55b0a739b0f42582f1c9747e5649ace",
"file_name": "Lib/shutil.py",
"func_name": "_call_external_zip",
"line_changes": {
"added": [
{
"char_end": 74,
"char_start": 0,
"line": "def _call_external_zip(base_dir, zip_filename, verbose, dry_run, logger):\n",
"line_no": 1
},
{
"char_end": 262,
"char_start": 208,
"line": " cmd = [\"zip\", zipoptions, zip_filename, base_dir]\n",
"line_no": 7
},
{
"char_end": 289,
"char_start": 262,
"line": " if logger is not None:\n",
"line_no": 8
},
{
"char_end": 324,
"char_start": 289,
"line": " logger.info(' '.join(cmd))\n",
"line_no": 9
},
{
"char_end": 340,
"char_start": 324,
"line": " if dry_run:\n",
"line_no": 10
},
{
"char_end": 355,
"char_start": 340,
"line": " return\n",
"line_no": 11
},
{
"char_end": 377,
"char_start": 355,
"line": " import subprocess\n",
"line_no": 12
},
{
"char_end": 421,
"char_start": 386,
"line": " subprocess.check_call(cmd)\n",
"line_no": 14
},
{
"char_end": 463,
"char_start": 421,
"line": " except subprocess.CalledProcessError:\n",
"line_no": 15
}
],
"deleted": [
{
"char_end": 78,
"char_start": 0,
"line": "def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):\n",
"line_no": 1
},
{
"char_end": 264,
"char_start": 212,
"line": " from distutils.errors import DistutilsExecError\n",
"line_no": 7
},
{
"char_end": 302,
"char_start": 264,
"line": " from distutils.spawn import spawn\n",
"line_no": 8
},
{
"char_end": 387,
"char_start": 311,
"line": " spawn([\"zip\", zipoptions, zip_filename, base_dir], dry_run=dry_run)\n",
"line_no": 10
},
{
"char_end": 418,
"char_start": 387,
"line": " except DistutilsExecError:\n",
"line_no": 11
}
]
},
"vul_type": "cwe-078"
}
| 130
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _create_host(self, connector):\n \"\"\"Create a new host on the storage system.",
" We create a host name and associate it with the given connection\n information.",
" \"\"\"",
" LOG.debug(_('enter: _create_host: host %s') % connector['host'])",
" rand_id = str(random.randint(0, 99999999)).zfill(8)\n host_name = '%s-%s' % (self._connector_to_hostname_prefix(connector),\n rand_id)",
" # Get all port information from the connector\n ports = []\n if 'initiator' in connector:\n ports.append('-iscsiname %s' % connector['initiator'])\n if 'wwpns' in connector:\n for wwpn in connector['wwpns']:\n ports.append('-hbawwpn %s' % wwpn)",
" # When creating a host, we need one port\n self._driver_assert(len(ports), _('_create_host: No connector ports'))\n port1 = ports.pop(0)",
" ssh_cmd = ('svctask mkhost -force %(port1)s -name \"%(host_name)s\"' %\n {'port1': port1, 'host_name': host_name})",
" out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return('successfully created' in out,\n '_create_host', ssh_cmd, out, err)",
" # Add any additional ports to the host\n for port in ports:",
" ssh_cmd = ('svctask addhostport -force %s %s' % (port, host_name))",
" out, err = self._run_ssh(ssh_cmd)",
" LOG.debug(_('leave: _create_host: host %(host)s - %(host_name)s') %\n {'host': connector['host'], 'host_name': host_name})\n return host_name"
] |
[
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 966,
"char_start": 924,
"chars": "arg_name, arg_val = port1.split()\n "
},
{
"char_end": 977,
"char_start": 976,
"chars": "["
},
{
"char_end": 987,
"char_start": 985,
"chars": "',"
},
{
"char_end": 989,
"char_start": 988,
"chars": "'"
},
{
"char_end": 997,
"char_start": 995,
"chars": "',"
},
{
"char_end": 999,
"char_start": 998,
"chars": "'"
},
{
"char_end": 1007,
"char_start": 1005,
"chars": "',"
},
{
"char_end": 1009,
"char_start": 1008,
"chars": "a"
},
{
"char_end": 1012,
"char_start": 1010,
"chars": "g_"
},
{
"char_end": 1017,
"char_start": 1016,
"chars": ","
},
{
"char_end": 1021,
"char_start": 1018,
"chars": "arg"
},
{
"char_end": 1029,
"char_start": 1022,
"chars": "val, '-"
},
{
"char_end": 1035,
"char_start": 1034,
"chars": ","
},
{
"char_end": 1060,
"char_start": 1056,
"chars": "\"%s\""
},
{
"char_end": 1063,
"char_start": 1062,
"chars": "%"
},
{
"char_end": 1074,
"char_start": 1073,
"chars": "]"
},
{
"char_end": 1367,
"char_start": 1322,
"chars": " arg_name, arg_val = port.split()\n"
},
{
"char_end": 1390,
"char_start": 1389,
"chars": "["
},
{
"char_end": 1400,
"char_start": 1398,
"chars": "',"
},
{
"char_end": 1402,
"char_start": 1401,
"chars": "'"
},
{
"char_end": 1415,
"char_start": 1413,
"chars": "',"
},
{
"char_end": 1417,
"char_start": 1416,
"chars": "'"
},
{
"char_end": 1425,
"char_start": 1424,
"chars": ","
},
{
"char_end": 1435,
"char_start": 1426,
"chars": "arg_name,"
},
{
"char_end": 1437,
"char_start": 1436,
"chars": "a"
},
{
"char_end": 1443,
"char_start": 1438,
"chars": "g_val"
},
{
"char_end": 1467,
"char_start": 1444,
"chars": "\n "
},
{
"char_end": 1478,
"char_start": 1477,
"chars": "]"
}
],
"deleted": [
{
"char_end": 935,
"char_start": 934,
"chars": "("
},
{
"char_end": 962,
"char_start": 958,
"chars": "%(po"
},
{
"char_end": 969,
"char_start": 963,
"chars": "t1)s -"
},
{
"char_end": 981,
"char_start": 974,
"chars": "\"%(host"
},
{
"char_end": 989,
"char_start": 986,
"chars": ")s\""
},
{
"char_end": 992,
"char_start": 990,
"chars": " %"
},
{
"char_end": 1013,
"char_start": 1012,
"chars": "{"
},
{
"char_end": 1019,
"char_start": 1014,
"chars": "port1"
},
{
"char_end": 1021,
"char_start": 1020,
"chars": ":"
},
{
"char_end": 1041,
"char_start": 1022,
"chars": "port1, 'host_name':"
},
{
"char_end": 1053,
"char_start": 1051,
"chars": "})"
},
{
"char_end": 1324,
"char_start": 1323,
"chars": "("
},
{
"char_end": 1357,
"char_start": 1351,
"chars": " %s %s"
},
{
"char_end": 1360,
"char_start": 1359,
"chars": "%"
},
{
"char_end": 1364,
"char_start": 1361,
"chars": "(po"
},
{
"char_end": 1366,
"char_start": 1365,
"chars": "t"
},
{
"char_end": 1379,
"char_start": 1377,
"chars": "))"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_create_host",
"line_changes": {
"added": [
{
"char_end": 958,
"char_start": 916,
"line": " arg_name, arg_val = port1.split()\n",
"line_no": 26
},
{
"char_end": 1036,
"char_start": 958,
"line": " ssh_cmd = ['svctask', 'mkhost', '-force', arg_name, arg_val, '-name',\n",
"line_no": 27
},
{
"char_end": 1075,
"char_start": 1036,
"line": " '\"%s\"' % host_name]\n",
"line_no": 28
},
{
"char_end": 1367,
"char_start": 1322,
"line": " arg_name, arg_val = port.split()\n",
"line_no": 35
},
{
"char_end": 1445,
"char_start": 1367,
"line": " ssh_cmd = ['svctask', 'addhostport', '-force', arg_name, arg_val,\n",
"line_no": 36
},
{
"char_end": 1479,
"char_start": 1445,
"line": " host_name]\n",
"line_no": 37
}
],
"deleted": [
{
"char_end": 993,
"char_start": 916,
"line": " ssh_cmd = ('svctask mkhost -force %(port1)s -name \"%(host_name)s\"' %\n",
"line_no": 26
},
{
"char_end": 1054,
"char_start": 993,
"line": " {'port1': port1, 'host_name': host_name})\n",
"line_no": 27
},
{
"char_end": 1380,
"char_start": 1301,
"line": " ssh_cmd = ('svctask addhostport -force %s %s' % (port, host_name))\n",
"line_no": 34
}
]
},
"vul_type": "cwe-078"
}
| 131
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _create_host(self, connector):\n \"\"\"Create a new host on the storage system.",
" We create a host name and associate it with the given connection\n information.",
" \"\"\"",
" LOG.debug(_('enter: _create_host: host %s') % connector['host'])",
" rand_id = str(random.randint(0, 99999999)).zfill(8)\n host_name = '%s-%s' % (self._connector_to_hostname_prefix(connector),\n rand_id)",
" # Get all port information from the connector\n ports = []\n if 'initiator' in connector:\n ports.append('-iscsiname %s' % connector['initiator'])\n if 'wwpns' in connector:\n for wwpn in connector['wwpns']:\n ports.append('-hbawwpn %s' % wwpn)",
" # When creating a host, we need one port\n self._driver_assert(len(ports), _('_create_host: No connector ports'))\n port1 = ports.pop(0)",
" arg_name, arg_val = port1.split()\n ssh_cmd = ['svctask', 'mkhost', '-force', arg_name, arg_val, '-name',\n '\"%s\"' % host_name]",
" out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return('successfully created' in out,\n '_create_host', ssh_cmd, out, err)",
" # Add any additional ports to the host\n for port in ports:",
" arg_name, arg_val = port.split()\n ssh_cmd = ['svctask', 'addhostport', '-force', arg_name, arg_val,\n host_name]",
" out, err = self._run_ssh(ssh_cmd)",
" LOG.debug(_('leave: _create_host: host %(host)s - %(host_name)s') %\n {'host': connector['host'], 'host_name': host_name})\n return host_name"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 966,
"char_start": 924,
"chars": "arg_name, arg_val = port1.split()\n "
},
{
"char_end": 977,
"char_start": 976,
"chars": "["
},
{
"char_end": 987,
"char_start": 985,
"chars": "',"
},
{
"char_end": 989,
"char_start": 988,
"chars": "'"
},
{
"char_end": 997,
"char_start": 995,
"chars": "',"
},
{
"char_end": 999,
"char_start": 998,
"chars": "'"
},
{
"char_end": 1007,
"char_start": 1005,
"chars": "',"
},
{
"char_end": 1009,
"char_start": 1008,
"chars": "a"
},
{
"char_end": 1012,
"char_start": 1010,
"chars": "g_"
},
{
"char_end": 1017,
"char_start": 1016,
"chars": ","
},
{
"char_end": 1021,
"char_start": 1018,
"chars": "arg"
},
{
"char_end": 1029,
"char_start": 1022,
"chars": "val, '-"
},
{
"char_end": 1035,
"char_start": 1034,
"chars": ","
},
{
"char_end": 1060,
"char_start": 1056,
"chars": "\"%s\""
},
{
"char_end": 1063,
"char_start": 1062,
"chars": "%"
},
{
"char_end": 1074,
"char_start": 1073,
"chars": "]"
},
{
"char_end": 1367,
"char_start": 1322,
"chars": " arg_name, arg_val = port.split()\n"
},
{
"char_end": 1390,
"char_start": 1389,
"chars": "["
},
{
"char_end": 1400,
"char_start": 1398,
"chars": "',"
},
{
"char_end": 1402,
"char_start": 1401,
"chars": "'"
},
{
"char_end": 1415,
"char_start": 1413,
"chars": "',"
},
{
"char_end": 1417,
"char_start": 1416,
"chars": "'"
},
{
"char_end": 1425,
"char_start": 1424,
"chars": ","
},
{
"char_end": 1435,
"char_start": 1426,
"chars": "arg_name,"
},
{
"char_end": 1437,
"char_start": 1436,
"chars": "a"
},
{
"char_end": 1443,
"char_start": 1438,
"chars": "g_val"
},
{
"char_end": 1467,
"char_start": 1444,
"chars": "\n "
},
{
"char_end": 1478,
"char_start": 1477,
"chars": "]"
}
],
"deleted": [
{
"char_end": 935,
"char_start": 934,
"chars": "("
},
{
"char_end": 962,
"char_start": 958,
"chars": "%(po"
},
{
"char_end": 969,
"char_start": 963,
"chars": "t1)s -"
},
{
"char_end": 981,
"char_start": 974,
"chars": "\"%(host"
},
{
"char_end": 989,
"char_start": 986,
"chars": ")s\""
},
{
"char_end": 992,
"char_start": 990,
"chars": " %"
},
{
"char_end": 1013,
"char_start": 1012,
"chars": "{"
},
{
"char_end": 1019,
"char_start": 1014,
"chars": "port1"
},
{
"char_end": 1021,
"char_start": 1020,
"chars": ":"
},
{
"char_end": 1041,
"char_start": 1022,
"chars": "port1, 'host_name':"
},
{
"char_end": 1053,
"char_start": 1051,
"chars": "})"
},
{
"char_end": 1324,
"char_start": 1323,
"chars": "("
},
{
"char_end": 1357,
"char_start": 1351,
"chars": " %s %s"
},
{
"char_end": 1360,
"char_start": 1359,
"chars": "%"
},
{
"char_end": 1364,
"char_start": 1361,
"chars": "(po"
},
{
"char_end": 1366,
"char_start": 1365,
"chars": "t"
},
{
"char_end": 1379,
"char_start": 1377,
"chars": "))"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_create_host",
"line_changes": {
"added": [
{
"char_end": 958,
"char_start": 916,
"line": " arg_name, arg_val = port1.split()\n",
"line_no": 26
},
{
"char_end": 1036,
"char_start": 958,
"line": " ssh_cmd = ['svctask', 'mkhost', '-force', arg_name, arg_val, '-name',\n",
"line_no": 27
},
{
"char_end": 1075,
"char_start": 1036,
"line": " '\"%s\"' % host_name]\n",
"line_no": 28
},
{
"char_end": 1367,
"char_start": 1322,
"line": " arg_name, arg_val = port.split()\n",
"line_no": 35
},
{
"char_end": 1445,
"char_start": 1367,
"line": " ssh_cmd = ['svctask', 'addhostport', '-force', arg_name, arg_val,\n",
"line_no": 36
},
{
"char_end": 1479,
"char_start": 1445,
"line": " host_name]\n",
"line_no": 37
}
],
"deleted": [
{
"char_end": 993,
"char_start": 916,
"line": " ssh_cmd = ('svctask mkhost -force %(port1)s -name \"%(host_name)s\"' %\n",
"line_no": 26
},
{
"char_end": 1054,
"char_start": 993,
"line": " {'port1': port1, 'host_name': host_name})\n",
"line_no": 27
},
{
"char_end": 1380,
"char_start": 1301,
"line": " ssh_cmd = ('svctask addhostport -force %s %s' % (port, host_name))\n",
"line_no": 34
}
]
},
"vul_type": "cwe-078"
}
| 131
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _get_iscsi_ip_addrs(self):",
" generator = self._port_conf_generator('svcinfo lsportip')",
" header = next(generator, None)\n if not header:\n return",
" for port_data in generator:\n try:\n port_node_id = port_data['node_id']\n port_ipv4 = port_data['IP_address']\n port_ipv6 = port_data['IP_address_6']\n state = port_data['state']\n except KeyError:\n self._handle_keyerror('lsportip', header)",
" if port_node_id in self._storage_nodes and (\n state == 'configured' or state == 'online'):\n node = self._storage_nodes[port_node_id]\n if len(port_ipv4):\n node['ipv4'].append(port_ipv4)\n if len(port_ipv6):\n node['ipv6'].append(port_ipv6)"
] |
[
1,
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 82,
"char_start": 81,
"chars": "["
},
{
"char_end": 92,
"char_start": 90,
"chars": "',"
},
{
"char_end": 94,
"char_start": 93,
"chars": "'"
},
{
"char_end": 104,
"char_start": 103,
"chars": "]"
}
],
"deleted": []
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_get_iscsi_ip_addrs",
"line_changes": {
"added": [
{
"char_end": 106,
"char_start": 35,
"line": " generator = self._port_conf_generator(['svcinfo', 'lsportip'])\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 101,
"char_start": 35,
"line": " generator = self._port_conf_generator('svcinfo lsportip')\n",
"line_no": 2
}
]
},
"vul_type": "cwe-078"
}
| 132
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _get_iscsi_ip_addrs(self):",
" generator = self._port_conf_generator(['svcinfo', 'lsportip'])",
" header = next(generator, None)\n if not header:\n return",
" for port_data in generator:\n try:\n port_node_id = port_data['node_id']\n port_ipv4 = port_data['IP_address']\n port_ipv6 = port_data['IP_address_6']\n state = port_data['state']\n except KeyError:\n self._handle_keyerror('lsportip', header)",
" if port_node_id in self._storage_nodes and (\n state == 'configured' or state == 'online'):\n node = self._storage_nodes[port_node_id]\n if len(port_ipv4):\n node['ipv4'].append(port_ipv4)\n if len(port_ipv6):\n node['ipv6'].append(port_ipv6)"
] |
[
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 82,
"char_start": 81,
"chars": "["
},
{
"char_end": 92,
"char_start": 90,
"chars": "',"
},
{
"char_end": 94,
"char_start": 93,
"chars": "'"
},
{
"char_end": 104,
"char_start": 103,
"chars": "]"
}
],
"deleted": []
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_get_iscsi_ip_addrs",
"line_changes": {
"added": [
{
"char_end": 106,
"char_start": 35,
"line": " generator = self._port_conf_generator(['svcinfo', 'lsportip'])\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 101,
"char_start": 35,
"line": " generator = self._port_conf_generator('svcinfo lsportip')\n",
"line_no": 2
}
]
},
"vul_type": "cwe-078"
}
| 132
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def talk(myText):\r\n if( myText.find( \"twitter\" ) >= 0 ):\r\n myText += \"0\"\r\n myText = myText[7:-1]\r\n try:\r\n\t myText = twitter.getTweet( myText )\r\n\texcept:\r\n\t print( \"!!!ERROR: INVALID TWITTER CREDENTIALS. Please read README.md for instructions.\")\r\n return\r\n \r\n os.system( \"espeak \\\",...\\\" 2>/dev/null\" ) # Sometimes the beginning of audio can get cut off. Insert silence.\r\n time.sleep( 0.5 )\r",
" os.system( \"espeak -w speech.wav \\\"\" + myText + \"\\\" -s 130\" )\r",
" audio.play(\"speech.wav\")\r\n return myText"
] |
[
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 450,
"char_start": 445,
"chars": "subpr"
},
{
"char_end": 454,
"char_start": 451,
"chars": "ces"
},
{
"char_end": 460,
"char_start": 456,
"chars": "call"
},
{
"char_end": 462,
"char_start": 461,
"chars": "["
},
{
"char_end": 471,
"char_start": 469,
"chars": "\","
},
{
"char_end": 473,
"char_start": 472,
"chars": "\""
},
{
"char_end": 477,
"char_start": 475,
"chars": "\","
},
{
"char_end": 479,
"char_start": 478,
"chars": "\""
},
{
"char_end": 491,
"char_start": 490,
"chars": ","
},
{
"char_end": 499,
"char_start": 498,
"chars": ","
},
{
"char_end": 505,
"char_start": 503,
"chars": "\","
},
{
"char_end": 507,
"char_start": 506,
"chars": "\""
},
{
"char_end": 512,
"char_start": 511,
"chars": "]"
}
],
"deleted": [
{
"char_end": 448,
"char_start": 447,
"chars": "."
},
{
"char_end": 454,
"char_start": 449,
"chars": "ystem"
},
{
"char_end": 456,
"char_start": 455,
"chars": " "
},
{
"char_end": 479,
"char_start": 477,
"chars": " \\"
},
{
"char_end": 483,
"char_start": 480,
"chars": "\" +"
},
{
"char_end": 492,
"char_start": 490,
"chars": " +"
},
{
"char_end": 497,
"char_start": 494,
"chars": "\\\" "
},
{
"char_end": 505,
"char_start": 504,
"chars": " "
}
]
},
"commit_link": "github.com/ntc-chip-revived/ChippyRuxpin/commit/0cd7d78e4d806852fd75fee03c24cce322f76014",
"file_name": "chippyRuxpin.py",
"func_name": "talk",
"line_changes": {
"added": [
{
"char_end": 515,
"char_start": 441,
"line": " subprocess.call([\"espeak\", \"-w\", \"speech.wav\", myText, \"-s\", \"130\"])\r\n",
"line_no": 13
}
],
"deleted": [
{
"char_end": 508,
"char_start": 441,
"line": " os.system( \"espeak -w speech.wav \\\"\" + myText + \"\\\" -s 130\" )\r\n",
"line_no": 13
}
]
},
"vul_type": "cwe-078"
}
| 133
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def talk(myText):\r\n if( myText.find( \"twitter\" ) >= 0 ):\r\n myText += \"0\"\r\n myText = myText[7:-1]\r\n try:\r\n\t myText = twitter.getTweet( myText )\r\n\texcept:\r\n\t print( \"!!!ERROR: INVALID TWITTER CREDENTIALS. Please read README.md for instructions.\")\r\n return\r\n \r\n os.system( \"espeak \\\",...\\\" 2>/dev/null\" ) # Sometimes the beginning of audio can get cut off. Insert silence.\r\n time.sleep( 0.5 )\r",
" subprocess.call([\"espeak\", \"-w\", \"speech.wav\", myText, \"-s\", \"130\"])\r",
" audio.play(\"speech.wav\")\r\n return myText"
] |
[
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 450,
"char_start": 445,
"chars": "subpr"
},
{
"char_end": 454,
"char_start": 451,
"chars": "ces"
},
{
"char_end": 460,
"char_start": 456,
"chars": "call"
},
{
"char_end": 462,
"char_start": 461,
"chars": "["
},
{
"char_end": 471,
"char_start": 469,
"chars": "\","
},
{
"char_end": 473,
"char_start": 472,
"chars": "\""
},
{
"char_end": 477,
"char_start": 475,
"chars": "\","
},
{
"char_end": 479,
"char_start": 478,
"chars": "\""
},
{
"char_end": 491,
"char_start": 490,
"chars": ","
},
{
"char_end": 499,
"char_start": 498,
"chars": ","
},
{
"char_end": 505,
"char_start": 503,
"chars": "\","
},
{
"char_end": 507,
"char_start": 506,
"chars": "\""
},
{
"char_end": 512,
"char_start": 511,
"chars": "]"
}
],
"deleted": [
{
"char_end": 448,
"char_start": 447,
"chars": "."
},
{
"char_end": 454,
"char_start": 449,
"chars": "ystem"
},
{
"char_end": 456,
"char_start": 455,
"chars": " "
},
{
"char_end": 479,
"char_start": 477,
"chars": " \\"
},
{
"char_end": 483,
"char_start": 480,
"chars": "\" +"
},
{
"char_end": 492,
"char_start": 490,
"chars": " +"
},
{
"char_end": 497,
"char_start": 494,
"chars": "\\\" "
},
{
"char_end": 505,
"char_start": 504,
"chars": " "
}
]
},
"commit_link": "github.com/ntc-chip-revived/ChippyRuxpin/commit/0cd7d78e4d806852fd75fee03c24cce322f76014",
"file_name": "chippyRuxpin.py",
"func_name": "talk",
"line_changes": {
"added": [
{
"char_end": 515,
"char_start": 441,
"line": " subprocess.call([\"espeak\", \"-w\", \"speech.wav\", myText, \"-s\", \"130\"])\r\n",
"line_no": 13
}
],
"deleted": [
{
"char_end": 508,
"char_start": 441,
"line": " os.system( \"espeak -w speech.wav \\\"\" + myText + \"\\\" -s 130\" )\r\n",
"line_no": 13
}
]
},
"vul_type": "cwe-078"
}
| 133
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _exec_cmd(self, cmd):\n \"\"\"Executes adb commands in a new shell.",
" This is specific to executing adb binary because stderr is not a good\n indicator of cmd execution status.",
"\n Args:",
" cmds: A string that is the adb command to execute.",
"\n Returns:\n The output of the adb command run if exit code is 0.",
" Raises:\n AdbError is raised if the adb command exit code is not 0.\n \"\"\"\n proc = subprocess.Popen(",
" cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)",
" (out, err) = proc.communicate()\n ret = proc.returncode",
" logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', cmd, out,",
" err, ret)\n if ret == 0:\n return out\n else:",
" raise AdbError(cmd=cmd, stdout=out, stderr=err, ret_code=ret)"
] |
[
0,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 35,
"char_start": 24,
"chars": "args, shell"
},
{
"char_end": 73,
"char_start": 70,
"chars": ".\n\n"
},
{
"char_end": 80,
"char_start": 76,
"chars": " "
},
{
"char_end": 84,
"char_start": 81,
"chars": "Arg"
},
{
"char_end": 86,
"char_start": 85,
"chars": ":"
},
{
"char_end": 102,
"char_start": 96,
"chars": " arg"
},
{
"char_end": 104,
"char_start": 103,
"chars": ":"
},
{
"char_end": 108,
"char_start": 106,
"chars": "tr"
},
{
"char_end": 116,
"char_start": 109,
"chars": "ng or l"
},
{
"char_end": 118,
"char_start": 117,
"chars": "s"
},
{
"char_end": 120,
"char_start": 119,
"chars": " "
},
{
"char_end": 122,
"char_start": 121,
"chars": "f"
},
{
"char_end": 124,
"char_start": 123,
"chars": "s"
},
{
"char_end": 126,
"char_start": 125,
"chars": "r"
},
{
"char_end": 131,
"char_start": 129,
"chars": "s,"
},
{
"char_end": 137,
"char_start": 132,
"chars": "progr"
},
{
"char_end": 139,
"char_start": 138,
"chars": "m"
},
{
"char_end": 145,
"char_start": 142,
"chars": "gum"
},
{
"char_end": 148,
"char_start": 146,
"chars": "nt"
},
{
"char_end": 151,
"char_start": 149,
"chars": ".\n"
},
{
"char_end": 168,
"char_start": 167,
"chars": "S"
},
{
"char_end": 177,
"char_start": 170,
"chars": " subpro"
},
{
"char_end": 183,
"char_start": 178,
"chars": "ess.P"
},
{
"char_end": 186,
"char_start": 184,
"chars": "pe"
},
{
"char_end": 189,
"char_start": 187,
"chars": "()"
},
{
"char_end": 197,
"char_start": 190,
"chars": "documen"
},
{
"char_end": 203,
"char_start": 200,
"chars": "ion"
},
{
"char_end": 223,
"char_start": 217,
"chars": "shell:"
},
{
"char_end": 229,
"char_start": 224,
"chars": "bool,"
},
{
"char_end": 234,
"char_start": 230,
"chars": "True"
},
{
"char_end": 237,
"char_start": 235,
"chars": "to"
},
{
"char_end": 241,
"char_start": 238,
"chars": "run"
},
{
"char_end": 246,
"char_start": 242,
"chars": "this"
},
{
"char_end": 250,
"char_start": 248,
"chars": "om"
},
{
"char_end": 253,
"char_start": 251,
"chars": "an"
},
{
"char_end": 257,
"char_start": 256,
"chars": "h"
},
{
"char_end": 260,
"char_start": 258,
"chars": "ou"
},
{
"char_end": 262,
"char_start": 261,
"chars": "h"
},
{
"char_end": 270,
"char_start": 265,
"chars": "e sys"
},
{
"char_end": 273,
"char_start": 271,
"chars": "em"
},
{
"char_end": 293,
"char_start": 277,
"chars": "ll,\n "
},
{
"char_end": 298,
"char_start": 294,
"chars": " F"
},
{
"char_end": 302,
"char_start": 299,
"chars": "lse"
},
{
"char_end": 304,
"char_start": 303,
"chars": "t"
},
{
"char_end": 307,
"char_start": 305,
"chars": " i"
},
{
"char_end": 316,
"char_start": 308,
"chars": "voke it "
},
{
"char_end": 321,
"char_start": 317,
"chars": "irec"
},
{
"char_end": 325,
"char_start": 322,
"chars": "ly."
},
{
"char_end": 327,
"char_start": 326,
"chars": "S"
},
{
"char_end": 336,
"char_start": 329,
"chars": " subpro"
},
{
"char_end": 353,
"char_start": 338,
"chars": "ss.Popen() docs"
},
{
"char_end": 586,
"char_start": 582,
"chars": "args"
},
{
"char_end": 644,
"char_start": 642,
"chars": "sh"
},
{
"char_end": 647,
"char_start": 645,
"chars": "ll"
},
{
"char_end": 789,
"char_start": 785,
"chars": "args"
},
{
"char_end": 921,
"char_start": 917,
"chars": "args"
}
],
"deleted": [
{
"char_end": 27,
"char_start": 24,
"chars": "cmd"
},
{
"char_end": 65,
"char_start": 63,
"chars": "in"
},
{
"char_end": 67,
"char_start": 66,
"chars": "a"
},
{
"char_end": 71,
"char_start": 68,
"chars": "new"
},
{
"char_end": 79,
"char_start": 73,
"chars": "hell.\n"
},
{
"char_end": 92,
"char_start": 88,
"chars": "This"
},
{
"char_end": 94,
"char_start": 93,
"chars": "i"
},
{
"char_end": 102,
"char_start": 97,
"chars": "pecif"
},
{
"char_end": 104,
"char_start": 103,
"chars": "c"
},
{
"char_end": 113,
"char_start": 108,
"chars": "execu"
},
{
"char_end": 121,
"char_start": 119,
"chars": "db"
},
{
"char_end": 125,
"char_start": 122,
"chars": "bin"
},
{
"char_end": 133,
"char_start": 127,
"chars": "y beca"
},
{
"char_end": 135,
"char_start": 134,
"chars": "s"
},
{
"char_end": 138,
"char_start": 136,
"chars": " s"
},
{
"char_end": 145,
"char_start": 139,
"chars": "derr i"
},
{
"char_end": 150,
"char_start": 147,
"chars": "not"
},
{
"char_end": 152,
"char_start": 151,
"chars": "a"
},
{
"char_end": 158,
"char_start": 153,
"chars": "good\n"
},
{
"char_end": 175,
"char_start": 166,
"chars": "indicator"
},
{
"char_end": 178,
"char_start": 176,
"chars": "of"
},
{
"char_end": 182,
"char_start": 179,
"chars": "cmd"
},
{
"char_end": 185,
"char_start": 184,
"chars": "x"
},
{
"char_end": 187,
"char_start": 186,
"chars": "c"
},
{
"char_end": 190,
"char_start": 188,
"chars": "ti"
},
{
"char_end": 194,
"char_start": 193,
"chars": "s"
},
{
"char_end": 199,
"char_start": 197,
"chars": "us"
},
{
"char_end": 201,
"char_start": 200,
"chars": "\n"
},
{
"char_end": 218,
"char_start": 210,
"chars": "Args:\n "
},
{
"char_end": 233,
"char_start": 231,
"chars": "s:"
},
{
"char_end": 237,
"char_start": 234,
"chars": "A s"
},
{
"char_end": 241,
"char_start": 239,
"chars": "in"
},
{
"char_end": 247,
"char_start": 245,
"chars": "at"
},
{
"char_end": 249,
"char_start": 248,
"chars": "i"
},
{
"char_end": 251,
"char_start": 250,
"chars": " "
},
{
"char_end": 258,
"char_start": 255,
"chars": "adb"
},
{
"char_end": 263,
"char_start": 259,
"chars": "comm"
},
{
"char_end": 266,
"char_start": 264,
"chars": "nd"
},
{
"char_end": 272,
"char_start": 271,
"chars": "x"
},
{
"char_end": 275,
"char_start": 274,
"chars": "u"
},
{
"char_end": 509,
"char_start": 506,
"chars": "cmd"
},
{
"char_end": 568,
"char_start": 565,
"chars": "Tru"
},
{
"char_end": 710,
"char_start": 707,
"chars": "cmd"
},
{
"char_end": 841,
"char_start": 838,
"chars": "cmd"
}
]
},
"commit_link": "github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee",
"file_name": "mobly/controllers/android_device_lib/adb.py",
"func_name": "_exec_cmd",
"line_changes": {
"added": [
{
"char_end": 38,
"char_start": 0,
"line": " def _exec_cmd(self, args, shell):\n",
"line_no": 1
},
{
"char_end": 72,
"char_start": 38,
"line": " \"\"\"Executes adb commands.\n",
"line_no": 2
},
{
"char_end": 151,
"char_start": 87,
"line": " args: string or list of strings, program arguments.\n",
"line_no": 5
},
{
"char_end": 205,
"char_start": 151,
"line": " See subprocess.Popen() documentation.\n",
"line_no": 6
},
{
"char_end": 281,
"char_start": 205,
"line": " shell: bool, True to run this command through the system shell,\n",
"line_no": 7
},
{
"char_end": 355,
"char_start": 281,
"line": " False to invoke it directly. See subprocess.Popen() docs.\n",
"line_no": 8
},
{
"char_end": 649,
"char_start": 570,
"line": " args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell)\n",
"line_no": 17
},
{
"char_end": 796,
"char_start": 719,
"line": " logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', args, out,\n",
"line_no": 20
}
],
"deleted": [
{
"char_end": 30,
"char_start": 0,
"line": " def _exec_cmd(self, cmd):\n",
"line_no": 1
},
{
"char_end": 279,
"char_start": 216,
"line": " cmds: A string that is the adb command to execute.\n",
"line_no": 8
},
{
"char_end": 571,
"char_start": 494,
"line": " cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\n",
"line_no": 17
},
{
"char_end": 717,
"char_start": 641,
"line": " logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', cmd, out,\n",
"line_no": 20
},
{
"char_end": 880,
"char_start": 807,
"line": " raise AdbError(cmd=cmd, stdout=out, stderr=err, ret_code=ret)\n",
"line_no": 25
}
]
},
"vul_type": "cwe-078"
}
| 134
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _exec_cmd(self, args, shell):\n \"\"\"Executes adb commands.",
"\n Args:",
" args: string or list of strings, program arguments.\n See subprocess.Popen() documentation.\n shell: bool, True to run this command through the system shell,\n False to invoke it directly. See subprocess.Popen() docs.",
"\n Returns:\n The output of the adb command run if exit code is 0.",
" Raises:\n AdbError is raised if the adb command exit code is not 0.\n \"\"\"\n proc = subprocess.Popen(",
" args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell)",
" (out, err) = proc.communicate()\n ret = proc.returncode",
" logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', args, out,",
" err, ret)\n if ret == 0:\n return out\n else:",
" raise AdbError(cmd=args, stdout=out, stderr=err, ret_code=ret)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 35,
"char_start": 24,
"chars": "args, shell"
},
{
"char_end": 73,
"char_start": 70,
"chars": ".\n\n"
},
{
"char_end": 80,
"char_start": 76,
"chars": " "
},
{
"char_end": 84,
"char_start": 81,
"chars": "Arg"
},
{
"char_end": 86,
"char_start": 85,
"chars": ":"
},
{
"char_end": 102,
"char_start": 96,
"chars": " arg"
},
{
"char_end": 104,
"char_start": 103,
"chars": ":"
},
{
"char_end": 108,
"char_start": 106,
"chars": "tr"
},
{
"char_end": 116,
"char_start": 109,
"chars": "ng or l"
},
{
"char_end": 118,
"char_start": 117,
"chars": "s"
},
{
"char_end": 120,
"char_start": 119,
"chars": " "
},
{
"char_end": 122,
"char_start": 121,
"chars": "f"
},
{
"char_end": 124,
"char_start": 123,
"chars": "s"
},
{
"char_end": 126,
"char_start": 125,
"chars": "r"
},
{
"char_end": 131,
"char_start": 129,
"chars": "s,"
},
{
"char_end": 137,
"char_start": 132,
"chars": "progr"
},
{
"char_end": 139,
"char_start": 138,
"chars": "m"
},
{
"char_end": 145,
"char_start": 142,
"chars": "gum"
},
{
"char_end": 148,
"char_start": 146,
"chars": "nt"
},
{
"char_end": 151,
"char_start": 149,
"chars": ".\n"
},
{
"char_end": 168,
"char_start": 167,
"chars": "S"
},
{
"char_end": 177,
"char_start": 170,
"chars": " subpro"
},
{
"char_end": 183,
"char_start": 178,
"chars": "ess.P"
},
{
"char_end": 186,
"char_start": 184,
"chars": "pe"
},
{
"char_end": 189,
"char_start": 187,
"chars": "()"
},
{
"char_end": 197,
"char_start": 190,
"chars": "documen"
},
{
"char_end": 203,
"char_start": 200,
"chars": "ion"
},
{
"char_end": 223,
"char_start": 217,
"chars": "shell:"
},
{
"char_end": 229,
"char_start": 224,
"chars": "bool,"
},
{
"char_end": 234,
"char_start": 230,
"chars": "True"
},
{
"char_end": 237,
"char_start": 235,
"chars": "to"
},
{
"char_end": 241,
"char_start": 238,
"chars": "run"
},
{
"char_end": 246,
"char_start": 242,
"chars": "this"
},
{
"char_end": 250,
"char_start": 248,
"chars": "om"
},
{
"char_end": 253,
"char_start": 251,
"chars": "an"
},
{
"char_end": 257,
"char_start": 256,
"chars": "h"
},
{
"char_end": 260,
"char_start": 258,
"chars": "ou"
},
{
"char_end": 262,
"char_start": 261,
"chars": "h"
},
{
"char_end": 270,
"char_start": 265,
"chars": "e sys"
},
{
"char_end": 273,
"char_start": 271,
"chars": "em"
},
{
"char_end": 293,
"char_start": 277,
"chars": "ll,\n "
},
{
"char_end": 298,
"char_start": 294,
"chars": " F"
},
{
"char_end": 302,
"char_start": 299,
"chars": "lse"
},
{
"char_end": 304,
"char_start": 303,
"chars": "t"
},
{
"char_end": 307,
"char_start": 305,
"chars": " i"
},
{
"char_end": 316,
"char_start": 308,
"chars": "voke it "
},
{
"char_end": 321,
"char_start": 317,
"chars": "irec"
},
{
"char_end": 325,
"char_start": 322,
"chars": "ly."
},
{
"char_end": 327,
"char_start": 326,
"chars": "S"
},
{
"char_end": 336,
"char_start": 329,
"chars": " subpro"
},
{
"char_end": 353,
"char_start": 338,
"chars": "ss.Popen() docs"
},
{
"char_end": 586,
"char_start": 582,
"chars": "args"
},
{
"char_end": 644,
"char_start": 642,
"chars": "sh"
},
{
"char_end": 647,
"char_start": 645,
"chars": "ll"
},
{
"char_end": 789,
"char_start": 785,
"chars": "args"
},
{
"char_end": 921,
"char_start": 917,
"chars": "args"
}
],
"deleted": [
{
"char_end": 27,
"char_start": 24,
"chars": "cmd"
},
{
"char_end": 65,
"char_start": 63,
"chars": "in"
},
{
"char_end": 67,
"char_start": 66,
"chars": "a"
},
{
"char_end": 71,
"char_start": 68,
"chars": "new"
},
{
"char_end": 79,
"char_start": 73,
"chars": "hell.\n"
},
{
"char_end": 92,
"char_start": 88,
"chars": "This"
},
{
"char_end": 94,
"char_start": 93,
"chars": "i"
},
{
"char_end": 102,
"char_start": 97,
"chars": "pecif"
},
{
"char_end": 104,
"char_start": 103,
"chars": "c"
},
{
"char_end": 113,
"char_start": 108,
"chars": "execu"
},
{
"char_end": 121,
"char_start": 119,
"chars": "db"
},
{
"char_end": 125,
"char_start": 122,
"chars": "bin"
},
{
"char_end": 133,
"char_start": 127,
"chars": "y beca"
},
{
"char_end": 135,
"char_start": 134,
"chars": "s"
},
{
"char_end": 138,
"char_start": 136,
"chars": " s"
},
{
"char_end": 145,
"char_start": 139,
"chars": "derr i"
},
{
"char_end": 150,
"char_start": 147,
"chars": "not"
},
{
"char_end": 152,
"char_start": 151,
"chars": "a"
},
{
"char_end": 158,
"char_start": 153,
"chars": "good\n"
},
{
"char_end": 175,
"char_start": 166,
"chars": "indicator"
},
{
"char_end": 178,
"char_start": 176,
"chars": "of"
},
{
"char_end": 182,
"char_start": 179,
"chars": "cmd"
},
{
"char_end": 185,
"char_start": 184,
"chars": "x"
},
{
"char_end": 187,
"char_start": 186,
"chars": "c"
},
{
"char_end": 190,
"char_start": 188,
"chars": "ti"
},
{
"char_end": 194,
"char_start": 193,
"chars": "s"
},
{
"char_end": 199,
"char_start": 197,
"chars": "us"
},
{
"char_end": 201,
"char_start": 200,
"chars": "\n"
},
{
"char_end": 218,
"char_start": 210,
"chars": "Args:\n "
},
{
"char_end": 233,
"char_start": 231,
"chars": "s:"
},
{
"char_end": 237,
"char_start": 234,
"chars": "A s"
},
{
"char_end": 241,
"char_start": 239,
"chars": "in"
},
{
"char_end": 247,
"char_start": 245,
"chars": "at"
},
{
"char_end": 249,
"char_start": 248,
"chars": "i"
},
{
"char_end": 251,
"char_start": 250,
"chars": " "
},
{
"char_end": 258,
"char_start": 255,
"chars": "adb"
},
{
"char_end": 263,
"char_start": 259,
"chars": "comm"
},
{
"char_end": 266,
"char_start": 264,
"chars": "nd"
},
{
"char_end": 272,
"char_start": 271,
"chars": "x"
},
{
"char_end": 275,
"char_start": 274,
"chars": "u"
},
{
"char_end": 509,
"char_start": 506,
"chars": "cmd"
},
{
"char_end": 568,
"char_start": 565,
"chars": "Tru"
},
{
"char_end": 710,
"char_start": 707,
"chars": "cmd"
},
{
"char_end": 841,
"char_start": 838,
"chars": "cmd"
}
]
},
"commit_link": "github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee",
"file_name": "mobly/controllers/android_device_lib/adb.py",
"func_name": "_exec_cmd",
"line_changes": {
"added": [
{
"char_end": 38,
"char_start": 0,
"line": " def _exec_cmd(self, args, shell):\n",
"line_no": 1
},
{
"char_end": 72,
"char_start": 38,
"line": " \"\"\"Executes adb commands.\n",
"line_no": 2
},
{
"char_end": 151,
"char_start": 87,
"line": " args: string or list of strings, program arguments.\n",
"line_no": 5
},
{
"char_end": 205,
"char_start": 151,
"line": " See subprocess.Popen() documentation.\n",
"line_no": 6
},
{
"char_end": 281,
"char_start": 205,
"line": " shell: bool, True to run this command through the system shell,\n",
"line_no": 7
},
{
"char_end": 355,
"char_start": 281,
"line": " False to invoke it directly. See subprocess.Popen() docs.\n",
"line_no": 8
},
{
"char_end": 649,
"char_start": 570,
"line": " args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell)\n",
"line_no": 17
},
{
"char_end": 796,
"char_start": 719,
"line": " logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', args, out,\n",
"line_no": 20
}
],
"deleted": [
{
"char_end": 30,
"char_start": 0,
"line": " def _exec_cmd(self, cmd):\n",
"line_no": 1
},
{
"char_end": 279,
"char_start": 216,
"line": " cmds: A string that is the adb command to execute.\n",
"line_no": 8
},
{
"char_end": 571,
"char_start": 494,
"line": " cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\n",
"line_no": 17
},
{
"char_end": 717,
"char_start": 641,
"line": " logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', cmd, out,\n",
"line_no": 20
},
{
"char_end": 880,
"char_start": 807,
"line": " raise AdbError(cmd=cmd, stdout=out, stderr=err, ret_code=ret)\n",
"line_no": 25
}
]
},
"vul_type": "cwe-078"
}
| 134
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _get_conn_fc_wwpns(self, host_name):\n wwpns = []",
" cmd = 'svcinfo lsfabric -host %s' % host_name",
" generator = self._port_conf_generator(cmd)\n header = next(generator, None)\n if not header:\n return wwpns",
" for port_data in generator:\n try:\n wwpns.append(port_data['local_wwpn'])\n except KeyError as e:\n self._handle_keyerror('lsfabric', header)",
" return wwpns"
] |
[
1,
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 79,
"char_start": 78,
"chars": "["
},
{
"char_end": 89,
"char_start": 87,
"chars": "',"
},
{
"char_end": 91,
"char_start": 90,
"chars": "'"
},
{
"char_end": 101,
"char_start": 99,
"chars": "',"
},
{
"char_end": 103,
"char_start": 102,
"chars": "'"
},
{
"char_end": 110,
"char_start": 109,
"chars": ","
},
{
"char_end": 121,
"char_start": 120,
"chars": "]"
}
],
"deleted": [
{
"char_end": 104,
"char_start": 101,
"chars": " %s"
},
{
"char_end": 107,
"char_start": 105,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_get_conn_fc_wwpns",
"line_changes": {
"added": [
{
"char_end": 122,
"char_start": 64,
"line": " cmd = ['svcinfo', 'lsfabric', '-host', host_name]\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 118,
"char_start": 64,
"line": " cmd = 'svcinfo lsfabric -host %s' % host_name\n",
"line_no": 3
}
]
},
"vul_type": "cwe-078"
}
| 135
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _get_conn_fc_wwpns(self, host_name):\n wwpns = []",
" cmd = ['svcinfo', 'lsfabric', '-host', host_name]",
" generator = self._port_conf_generator(cmd)\n header = next(generator, None)\n if not header:\n return wwpns",
" for port_data in generator:\n try:\n wwpns.append(port_data['local_wwpn'])\n except KeyError as e:\n self._handle_keyerror('lsfabric', header)",
" return wwpns"
] |
[
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 79,
"char_start": 78,
"chars": "["
},
{
"char_end": 89,
"char_start": 87,
"chars": "',"
},
{
"char_end": 91,
"char_start": 90,
"chars": "'"
},
{
"char_end": 101,
"char_start": 99,
"chars": "',"
},
{
"char_end": 103,
"char_start": 102,
"chars": "'"
},
{
"char_end": 110,
"char_start": 109,
"chars": ","
},
{
"char_end": 121,
"char_start": 120,
"chars": "]"
}
],
"deleted": [
{
"char_end": 104,
"char_start": 101,
"chars": " %s"
},
{
"char_end": 107,
"char_start": 105,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_get_conn_fc_wwpns",
"line_changes": {
"added": [
{
"char_end": 122,
"char_start": 64,
"line": " cmd = ['svcinfo', 'lsfabric', '-host', host_name]\n",
"line_no": 3
}
],
"deleted": [
{
"char_end": 118,
"char_start": 64,
"line": " cmd = 'svcinfo lsfabric -host %s' % host_name\n",
"line_no": 3
}
]
},
"vul_type": "cwe-078"
}
| 135
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):\n \"\"\"Create a 3PAR host.",
" Create a 3PAR host, if there is already a host on the 3par using\n the same iqn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"",
" cmd = 'createhost -iscsi -persona %s -domain %s %s %s' % \\\n (persona_id, domain, hostname, iscsi_iqn)\n out = self.common._cli_run(cmd, None)",
" if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n return hostname"
] |
[
1,
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 306,
"char_start": 305,
"chars": "["
},
{
"char_end": 319,
"char_start": 317,
"chars": "',"
},
{
"char_end": 321,
"char_start": 320,
"chars": "'"
},
{
"char_end": 329,
"char_start": 327,
"chars": "',"
},
{
"char_end": 331,
"char_start": 330,
"chars": "'"
},
{
"char_end": 341,
"char_start": 339,
"chars": "',"
},
{
"char_end": 345,
"char_start": 342,
"chars": "per"
},
{
"char_end": 353,
"char_start": 346,
"chars": "ona_id,"
},
{
"char_end": 355,
"char_start": 354,
"chars": "'"
},
{
"char_end": 364,
"char_start": 363,
"chars": ","
},
{
"char_end": 408,
"char_start": 407,
"chars": "]"
}
],
"deleted": [
{
"char_end": 334,
"char_start": 333,
"chars": "%"
},
{
"char_end": 352,
"char_start": 343,
"chars": " %s %s %s"
},
{
"char_end": 357,
"char_start": 353,
"chars": " % \\"
},
{
"char_end": 384,
"char_start": 372,
"chars": "(persona_id,"
},
{
"char_end": 413,
"char_start": 412,
"chars": ")"
},
{
"char_end": 458,
"char_start": 452,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_iscsi.py",
"func_name": "_create_3par_iscsi_host",
"line_changes": {
"added": [
{
"char_end": 365,
"char_start": 291,
"line": " cmd = ['createhost', '-iscsi', '-persona', persona_id, '-domain',\n",
"line_no": 8
},
{
"char_end": 409,
"char_start": 365,
"line": " domain, hostname, iscsi_iqn]\n",
"line_no": 9
},
{
"char_end": 449,
"char_start": 409,
"line": " out = self.common._cli_run(cmd)\n",
"line_no": 10
}
],
"deleted": [
{
"char_end": 358,
"char_start": 291,
"line": " cmd = 'createhost -iscsi -persona %s -domain %s %s %s' % \\\n",
"line_no": 8
},
{
"char_end": 414,
"char_start": 358,
"line": " (persona_id, domain, hostname, iscsi_iqn)\n",
"line_no": 9
},
{
"char_end": 460,
"char_start": 414,
"line": " out = self.common._cli_run(cmd, None)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-078"
}
| 136
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):\n \"\"\"Create a 3PAR host.",
" Create a 3PAR host, if there is already a host on the 3par using\n the same iqn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"",
" cmd = ['createhost', '-iscsi', '-persona', persona_id, '-domain',\n domain, hostname, iscsi_iqn]\n out = self.common._cli_run(cmd)",
" if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n return hostname"
] |
[
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 306,
"char_start": 305,
"chars": "["
},
{
"char_end": 319,
"char_start": 317,
"chars": "',"
},
{
"char_end": 321,
"char_start": 320,
"chars": "'"
},
{
"char_end": 329,
"char_start": 327,
"chars": "',"
},
{
"char_end": 331,
"char_start": 330,
"chars": "'"
},
{
"char_end": 341,
"char_start": 339,
"chars": "',"
},
{
"char_end": 345,
"char_start": 342,
"chars": "per"
},
{
"char_end": 353,
"char_start": 346,
"chars": "ona_id,"
},
{
"char_end": 355,
"char_start": 354,
"chars": "'"
},
{
"char_end": 364,
"char_start": 363,
"chars": ","
},
{
"char_end": 408,
"char_start": 407,
"chars": "]"
}
],
"deleted": [
{
"char_end": 334,
"char_start": 333,
"chars": "%"
},
{
"char_end": 352,
"char_start": 343,
"chars": " %s %s %s"
},
{
"char_end": 357,
"char_start": 353,
"chars": " % \\"
},
{
"char_end": 384,
"char_start": 372,
"chars": "(persona_id,"
},
{
"char_end": 413,
"char_start": 412,
"chars": ")"
},
{
"char_end": 458,
"char_start": 452,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_iscsi.py",
"func_name": "_create_3par_iscsi_host",
"line_changes": {
"added": [
{
"char_end": 365,
"char_start": 291,
"line": " cmd = ['createhost', '-iscsi', '-persona', persona_id, '-domain',\n",
"line_no": 8
},
{
"char_end": 409,
"char_start": 365,
"line": " domain, hostname, iscsi_iqn]\n",
"line_no": 9
},
{
"char_end": 449,
"char_start": 409,
"line": " out = self.common._cli_run(cmd)\n",
"line_no": 10
}
],
"deleted": [
{
"char_end": 358,
"char_start": 291,
"line": " cmd = 'createhost -iscsi -persona %s -domain %s %s %s' % \\\n",
"line_no": 8
},
{
"char_end": 414,
"char_start": 358,
"line": " (persona_id, domain, hostname, iscsi_iqn)\n",
"line_no": 9
},
{
"char_end": 460,
"char_start": 414,
"line": " out = self.common._cli_run(cmd, None)\n",
"line_no": 10
}
]
},
"vul_type": "cwe-078"
}
| 136
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _delete_3par_host(self, hostname):",
" self._cli_run('removehost %s' % hostname, None)"
] |
[
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 66,
"char_start": 65,
"chars": "["
},
{
"char_end": 79,
"char_start": 78,
"chars": ","
},
{
"char_end": 89,
"char_start": 88,
"chars": "]"
}
],
"deleted": [
{
"char_end": 79,
"char_start": 76,
"chars": " %s"
},
{
"char_end": 82,
"char_start": 80,
"chars": " %"
},
{
"char_end": 97,
"char_start": 91,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "_delete_3par_host",
"line_changes": {
"added": [
{
"char_end": 90,
"char_start": 43,
"line": " self._cli_run(['removehost', hostname])\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 98,
"char_start": 43,
"line": " self._cli_run('removehost %s' % hostname, None)\n",
"line_no": 2
}
]
},
"vul_type": "cwe-078"
}
| 137
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _delete_3par_host(self, hostname):",
" self._cli_run(['removehost', hostname])"
] |
[
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 66,
"char_start": 65,
"chars": "["
},
{
"char_end": 79,
"char_start": 78,
"chars": ","
},
{
"char_end": 89,
"char_start": 88,
"chars": "]"
}
],
"deleted": [
{
"char_end": 79,
"char_start": 76,
"chars": " %s"
},
{
"char_end": 82,
"char_start": 80,
"chars": " %"
},
{
"char_end": 97,
"char_start": 91,
"chars": ", None"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f",
"file_name": "cinder/volume/drivers/san/hp/hp_3par_common.py",
"func_name": "_delete_3par_host",
"line_changes": {
"added": [
{
"char_end": 90,
"char_start": 43,
"line": " self._cli_run(['removehost', hostname])\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 98,
"char_start": 43,
"line": " self._cli_run('removehost %s' % hostname, None)\n",
"line_no": 2
}
]
},
"vul_type": "cwe-078"
}
| 137
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def process_statistics(self, metadata, _):\n args = [metadata.hostname, '-p', metadata.profile, '-g',\n ':'.join([g for g in metadata.groups])]",
"",
" for notifier in os.listdir(self.data):",
"",
" if ((notifier[-1] == '~') or\n (notifier[:2] == '.#') or\n (notifier[-4:] == '.swp') or\n (notifier in ['SCCS', '.svn', '4913'])):\n continue",
" npath = self.data + '/' + notifier\n self.logger.debug(\"Running %s %s\" % (npath, \" \".join(args)))\n async_run(npath, args)"
] |
[
1,
0,
1,
0,
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 219,
"char_start": 176,
"chars": "self.debug_log(\"running triggers\")\n "
},
{
"char_end": 309,
"char_start": 257,
"chars": "\n self.debug_log(\"running %s\" % notifier)"
},
{
"char_end": 553,
"char_start": 540,
"chars": "os.path.join("
},
{
"char_end": 563,
"char_start": 562,
"chars": ","
},
{
"char_end": 573,
"char_start": 572,
"chars": ")"
},
{
"char_end": 602,
"char_start": 601,
"chars": "["
},
{
"char_end": 610,
"char_start": 607,
"chars": "] +"
}
],
"deleted": [
{
"char_end": 462,
"char_start": 454,
"chars": " + '/' +"
},
{
"char_end": 557,
"char_start": 489,
"chars": "logger.debug(\"Running %s %s\" % (npath, \" \".join(args)))\n "
},
{
"char_end": 573,
"char_start": 572,
"chars": ","
}
]
},
"commit_link": "github.com/Bcfg2/bcfg2/commit/a524967e8d5c4c22e49cd619aed20c87a316c0be",
"file_name": "src/lib/Server/Plugins/Trigger.py",
"func_name": "process_statistics",
"line_changes": {
"added": [
{
"char_end": 211,
"char_start": 168,
"line": " self.debug_log(\"running triggers\")\n",
"line_no": 4
},
{
"char_end": 310,
"char_start": 258,
"line": " self.debug_log(\"running %s\" % notifier)\n",
"line_no": 6
},
{
"char_end": 574,
"char_start": 520,
"line": " npath = os.path.join(self.data, notifier)\n",
"line_no": 12
},
{
"char_end": 616,
"char_start": 574,
"line": " self.async_run([npath] + args)",
"line_no": 13
}
],
"deleted": [
{
"char_end": 472,
"char_start": 425,
"line": " npath = self.data + '/' + notifier\n",
"line_no": 10
},
{
"char_end": 545,
"char_start": 472,
"line": " self.logger.debug(\"Running %s %s\" % (npath, \" \".join(args)))\n",
"line_no": 11
},
{
"char_end": 579,
"char_start": 545,
"line": " async_run(npath, args)\n",
"line_no": 12
}
]
},
"vul_type": "cwe-078"
}
| 138
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def process_statistics(self, metadata, _):\n args = [metadata.hostname, '-p', metadata.profile, '-g',\n ':'.join([g for g in metadata.groups])]",
" self.debug_log(\"running triggers\")",
" for notifier in os.listdir(self.data):",
" self.debug_log(\"running %s\" % notifier)",
" if ((notifier[-1] == '~') or\n (notifier[:2] == '.#') or\n (notifier[-4:] == '.swp') or\n (notifier in ['SCCS', '.svn', '4913'])):\n continue",
" npath = os.path.join(self.data, notifier)\n self.async_run([npath] + args)"
] |
[
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 219,
"char_start": 176,
"chars": "self.debug_log(\"running triggers\")\n "
},
{
"char_end": 309,
"char_start": 257,
"chars": "\n self.debug_log(\"running %s\" % notifier)"
},
{
"char_end": 553,
"char_start": 540,
"chars": "os.path.join("
},
{
"char_end": 563,
"char_start": 562,
"chars": ","
},
{
"char_end": 573,
"char_start": 572,
"chars": ")"
},
{
"char_end": 602,
"char_start": 601,
"chars": "["
},
{
"char_end": 610,
"char_start": 607,
"chars": "] +"
}
],
"deleted": [
{
"char_end": 462,
"char_start": 454,
"chars": " + '/' +"
},
{
"char_end": 557,
"char_start": 489,
"chars": "logger.debug(\"Running %s %s\" % (npath, \" \".join(args)))\n "
},
{
"char_end": 573,
"char_start": 572,
"chars": ","
}
]
},
"commit_link": "github.com/Bcfg2/bcfg2/commit/a524967e8d5c4c22e49cd619aed20c87a316c0be",
"file_name": "src/lib/Server/Plugins/Trigger.py",
"func_name": "process_statistics",
"line_changes": {
"added": [
{
"char_end": 211,
"char_start": 168,
"line": " self.debug_log(\"running triggers\")\n",
"line_no": 4
},
{
"char_end": 310,
"char_start": 258,
"line": " self.debug_log(\"running %s\" % notifier)\n",
"line_no": 6
},
{
"char_end": 574,
"char_start": 520,
"line": " npath = os.path.join(self.data, notifier)\n",
"line_no": 12
},
{
"char_end": 616,
"char_start": 574,
"line": " self.async_run([npath] + args)",
"line_no": 13
}
],
"deleted": [
{
"char_end": 472,
"char_start": 425,
"line": " npath = self.data + '/' + notifier\n",
"line_no": 10
},
{
"char_end": 545,
"char_start": 472,
"line": " self.logger.debug(\"Running %s %s\" % (npath, \" \".join(args)))\n",
"line_no": 11
},
{
"char_end": 579,
"char_start": 545,
"line": " async_run(npath, args)\n",
"line_no": 12
}
]
},
"vul_type": "cwe-078"
}
| 138
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _delete_host(self, host_name):\n \"\"\"Delete a host on the storage system.\"\"\"",
" LOG.debug(_('enter: _delete_host: host %s ') % host_name)\n",
" ssh_cmd = 'svctask rmhost %s ' % host_name",
" out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_delete_host', ssh_cmd, out, err)",
" LOG.debug(_('leave: _delete_host: host %s ') % host_name)"
] |
[
1,
1,
0,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 177,
"char_start": 176,
"chars": "["
},
{
"char_end": 187,
"char_start": 185,
"chars": "',"
},
{
"char_end": 189,
"char_start": 188,
"chars": "'"
},
{
"char_end": 197,
"char_start": 196,
"chars": ","
},
{
"char_end": 208,
"char_start": 207,
"chars": "]"
}
],
"deleted": [
{
"char_end": 195,
"char_start": 191,
"chars": " %s "
},
{
"char_end": 198,
"char_start": 196,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_delete_host",
"line_changes": {
"added": [
{
"char_end": 209,
"char_start": 158,
"line": " ssh_cmd = ['svctask', 'rmhost', host_name]\n",
"line_no": 6
}
],
"deleted": [
{
"char_end": 209,
"char_start": 158,
"line": " ssh_cmd = 'svctask rmhost %s ' % host_name\n",
"line_no": 6
}
]
},
"vul_type": "cwe-078"
}
| 139
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _delete_host(self, host_name):\n \"\"\"Delete a host on the storage system.\"\"\"",
" LOG.debug(_('enter: _delete_host: host %s ') % host_name)\n",
" ssh_cmd = ['svctask', 'rmhost', host_name]",
" out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_delete_host', ssh_cmd, out, err)",
" LOG.debug(_('leave: _delete_host: host %s ') % host_name)"
] |
[
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 177,
"char_start": 176,
"chars": "["
},
{
"char_end": 187,
"char_start": 185,
"chars": "',"
},
{
"char_end": 189,
"char_start": 188,
"chars": "'"
},
{
"char_end": 197,
"char_start": 196,
"chars": ","
},
{
"char_end": 208,
"char_start": 207,
"chars": "]"
}
],
"deleted": [
{
"char_end": 195,
"char_start": 191,
"chars": " %s "
},
{
"char_end": 198,
"char_start": 196,
"chars": " %"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_delete_host",
"line_changes": {
"added": [
{
"char_end": 209,
"char_start": 158,
"line": " ssh_cmd = ['svctask', 'rmhost', host_name]\n",
"line_no": 6
}
],
"deleted": [
{
"char_end": 209,
"char_start": 158,
"line": " ssh_cmd = 'svctask rmhost %s ' % host_name\n",
"line_no": 6
}
]
},
"vul_type": "cwe-078"
}
| 139
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def fetch(url):\n '''Download and verify a package url.'''\n base = os.path.basename(url)\n print('Fetching %s...' % base)\n fetch_file(url + '.asc')\n fetch_file(url)\n fetch_file(url + '.sha256')\n fetch_file(url + '.asc.sha256')\n print('Verifying %s...' % base)\n # TODO: check for verification failure.",
" os.system('shasum -c %s.sha256' % base)\n os.system('shasum -c %s.asc.sha256' % base)\n os.system('gpg --verify %s.asc %s' % (base, base))\n os.system('keybase verify %s.asc' % base)"
] |
[
1,
0
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 315,
"char_start": 310,
"chars": "subpr"
},
{
"char_end": 319,
"char_start": 316,
"chars": "ces"
},
{
"char_end": 323,
"char_start": 321,
"chars": "ch"
},
{
"char_end": 331,
"char_start": 324,
"chars": "ck_call"
},
{
"char_end": 333,
"char_start": 332,
"chars": "["
},
{
"char_end": 342,
"char_start": 340,
"chars": "',"
},
{
"char_end": 344,
"char_start": 343,
"chars": "'"
},
{
"char_end": 348,
"char_start": 346,
"chars": "',"
},
{
"char_end": 351,
"char_start": 349,
"chars": "ba"
},
{
"char_end": 357,
"char_start": 352,
"chars": "e + '"
},
{
"char_end": 366,
"char_start": 365,
"chars": "]"
},
{
"char_end": 378,
"char_start": 371,
"chars": "ubproce"
},
{
"char_end": 383,
"char_start": 380,
"chars": ".ch"
},
{
"char_end": 391,
"char_start": 384,
"chars": "ck_call"
},
{
"char_end": 393,
"char_start": 392,
"chars": "["
},
{
"char_end": 402,
"char_start": 400,
"chars": "',"
},
{
"char_end": 404,
"char_start": 403,
"chars": "'"
},
{
"char_end": 408,
"char_start": 406,
"chars": "',"
},
{
"char_end": 411,
"char_start": 409,
"chars": "ba"
},
{
"char_end": 417,
"char_start": 412,
"chars": "e + '"
},
{
"char_end": 430,
"char_start": 429,
"chars": "]"
},
{
"char_end": 442,
"char_start": 435,
"chars": "ubproce"
},
{
"char_end": 447,
"char_start": 444,
"chars": ".ch"
},
{
"char_end": 455,
"char_start": 448,
"chars": "ck_call"
},
{
"char_end": 457,
"char_start": 456,
"chars": "["
},
{
"char_end": 463,
"char_start": 461,
"chars": "',"
},
{
"char_end": 465,
"char_start": 464,
"chars": "'"
},
{
"char_end": 475,
"char_start": 473,
"chars": "',"
},
{
"char_end": 478,
"char_start": 476,
"chars": "ba"
},
{
"char_end": 484,
"char_start": 479,
"chars": "e + '"
},
{
"char_end": 496,
"char_start": 495,
"chars": "]"
},
{
"char_end": 505,
"char_start": 500,
"chars": "subpr"
},
{
"char_end": 508,
"char_start": 506,
"chars": "ce"
},
{
"char_end": 513,
"char_start": 510,
"chars": ".ch"
},
{
"char_end": 521,
"char_start": 514,
"chars": "ck_call"
},
{
"char_end": 523,
"char_start": 522,
"chars": "["
},
{
"char_end": 533,
"char_start": 531,
"chars": "',"
},
{
"char_end": 535,
"char_start": 534,
"chars": "'"
},
{
"char_end": 543,
"char_start": 541,
"chars": "',"
},
{
"char_end": 546,
"char_start": 544,
"chars": "ba"
},
{
"char_end": 552,
"char_start": 547,
"chars": "e + '"
},
{
"char_end": 558,
"char_start": 557,
"chars": "]"
}
],
"deleted": [
{
"char_end": 313,
"char_start": 312,
"chars": "."
},
{
"char_end": 317,
"char_start": 314,
"chars": "yst"
},
{
"char_end": 319,
"char_start": 318,
"chars": "m"
},
{
"char_end": 332,
"char_start": 331,
"chars": "%"
},
{
"char_end": 348,
"char_start": 341,
"chars": " % base"
},
{
"char_end": 355,
"char_start": 353,
"chars": "s."
},
{
"char_end": 357,
"char_start": 356,
"chars": "y"
},
{
"char_end": 359,
"char_start": 358,
"chars": "t"
},
{
"char_end": 361,
"char_start": 360,
"chars": "m"
},
{
"char_end": 374,
"char_start": 373,
"chars": "%"
},
{
"char_end": 394,
"char_start": 387,
"chars": " % base"
},
{
"char_end": 401,
"char_start": 400,
"chars": "."
},
{
"char_end": 405,
"char_start": 402,
"chars": "yst"
},
{
"char_end": 407,
"char_start": 406,
"chars": "m"
},
{
"char_end": 425,
"char_start": 422,
"chars": "%s."
},
{
"char_end": 432,
"char_start": 427,
"chars": "c %s'"
},
{
"char_end": 434,
"char_start": 433,
"chars": "%"
},
{
"char_end": 437,
"char_start": 435,
"chars": "(b"
},
{
"char_end": 440,
"char_start": 439,
"chars": "e"
},
{
"char_end": 447,
"char_start": 446,
"chars": ")"
},
{
"char_end": 454,
"char_start": 453,
"chars": "."
},
{
"char_end": 458,
"char_start": 455,
"chars": "yst"
},
{
"char_end": 460,
"char_start": 459,
"chars": "m"
},
{
"char_end": 480,
"char_start": 477,
"chars": "%s."
},
{
"char_end": 484,
"char_start": 482,
"chars": "c'"
},
{
"char_end": 486,
"char_start": 485,
"chars": "%"
},
{
"char_end": 488,
"char_start": 487,
"chars": "b"
},
{
"char_end": 491,
"char_start": 490,
"chars": "e"
}
]
},
"commit_link": "github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb",
"file_name": "repack_rust.py",
"func_name": "fetch",
"line_changes": {
"added": [
{
"char_end": 368,
"char_start": 308,
"line": " subprocess.check_call(['shasum', '-c', base + '.sha256'])\n",
"line_no": 11
},
{
"char_end": 432,
"char_start": 368,
"line": " subprocess.check_call(['shasum', '-c', base + '.asc.sha256'])\n",
"line_no": 12
},
{
"char_end": 498,
"char_start": 432,
"line": " subprocess.check_call(['gpg', '--verify', base + '.asc', base])\n",
"line_no": 13
},
{
"char_end": 559,
"char_start": 498,
"line": " subprocess.check_call(['keybase', 'verify', base + '.asc'])\n",
"line_no": 14
}
],
"deleted": [
{
"char_end": 350,
"char_start": 308,
"line": " os.system('shasum -c %s.sha256' % base)\n",
"line_no": 11
},
{
"char_end": 396,
"char_start": 350,
"line": " os.system('shasum -c %s.asc.sha256' % base)\n",
"line_no": 12
},
{
"char_end": 449,
"char_start": 396,
"line": " os.system('gpg --verify %s.asc %s' % (base, base))\n",
"line_no": 13
},
{
"char_end": 492,
"char_start": 449,
"line": " os.system('keybase verify %s.asc' % base)\n",
"line_no": 14
}
]
},
"vul_type": "cwe-078"
}
| 140
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def fetch(url):\n '''Download and verify a package url.'''\n base = os.path.basename(url)\n print('Fetching %s...' % base)\n fetch_file(url + '.asc')\n fetch_file(url)\n fetch_file(url + '.sha256')\n fetch_file(url + '.asc.sha256')\n print('Verifying %s...' % base)\n # TODO: check for verification failure.",
" subprocess.check_call(['shasum', '-c', base + '.sha256'])\n subprocess.check_call(['shasum', '-c', base + '.asc.sha256'])\n subprocess.check_call(['gpg', '--verify', base + '.asc', base])\n subprocess.check_call(['keybase', 'verify', base + '.asc'])"
] |
[
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 315,
"char_start": 310,
"chars": "subpr"
},
{
"char_end": 319,
"char_start": 316,
"chars": "ces"
},
{
"char_end": 323,
"char_start": 321,
"chars": "ch"
},
{
"char_end": 331,
"char_start": 324,
"chars": "ck_call"
},
{
"char_end": 333,
"char_start": 332,
"chars": "["
},
{
"char_end": 342,
"char_start": 340,
"chars": "',"
},
{
"char_end": 344,
"char_start": 343,
"chars": "'"
},
{
"char_end": 348,
"char_start": 346,
"chars": "',"
},
{
"char_end": 351,
"char_start": 349,
"chars": "ba"
},
{
"char_end": 357,
"char_start": 352,
"chars": "e + '"
},
{
"char_end": 366,
"char_start": 365,
"chars": "]"
},
{
"char_end": 378,
"char_start": 371,
"chars": "ubproce"
},
{
"char_end": 383,
"char_start": 380,
"chars": ".ch"
},
{
"char_end": 391,
"char_start": 384,
"chars": "ck_call"
},
{
"char_end": 393,
"char_start": 392,
"chars": "["
},
{
"char_end": 402,
"char_start": 400,
"chars": "',"
},
{
"char_end": 404,
"char_start": 403,
"chars": "'"
},
{
"char_end": 408,
"char_start": 406,
"chars": "',"
},
{
"char_end": 411,
"char_start": 409,
"chars": "ba"
},
{
"char_end": 417,
"char_start": 412,
"chars": "e + '"
},
{
"char_end": 430,
"char_start": 429,
"chars": "]"
},
{
"char_end": 442,
"char_start": 435,
"chars": "ubproce"
},
{
"char_end": 447,
"char_start": 444,
"chars": ".ch"
},
{
"char_end": 455,
"char_start": 448,
"chars": "ck_call"
},
{
"char_end": 457,
"char_start": 456,
"chars": "["
},
{
"char_end": 463,
"char_start": 461,
"chars": "',"
},
{
"char_end": 465,
"char_start": 464,
"chars": "'"
},
{
"char_end": 475,
"char_start": 473,
"chars": "',"
},
{
"char_end": 478,
"char_start": 476,
"chars": "ba"
},
{
"char_end": 484,
"char_start": 479,
"chars": "e + '"
},
{
"char_end": 496,
"char_start": 495,
"chars": "]"
},
{
"char_end": 505,
"char_start": 500,
"chars": "subpr"
},
{
"char_end": 508,
"char_start": 506,
"chars": "ce"
},
{
"char_end": 513,
"char_start": 510,
"chars": ".ch"
},
{
"char_end": 521,
"char_start": 514,
"chars": "ck_call"
},
{
"char_end": 523,
"char_start": 522,
"chars": "["
},
{
"char_end": 533,
"char_start": 531,
"chars": "',"
},
{
"char_end": 535,
"char_start": 534,
"chars": "'"
},
{
"char_end": 543,
"char_start": 541,
"chars": "',"
},
{
"char_end": 546,
"char_start": 544,
"chars": "ba"
},
{
"char_end": 552,
"char_start": 547,
"chars": "e + '"
},
{
"char_end": 558,
"char_start": 557,
"chars": "]"
}
],
"deleted": [
{
"char_end": 313,
"char_start": 312,
"chars": "."
},
{
"char_end": 317,
"char_start": 314,
"chars": "yst"
},
{
"char_end": 319,
"char_start": 318,
"chars": "m"
},
{
"char_end": 332,
"char_start": 331,
"chars": "%"
},
{
"char_end": 348,
"char_start": 341,
"chars": " % base"
},
{
"char_end": 355,
"char_start": 353,
"chars": "s."
},
{
"char_end": 357,
"char_start": 356,
"chars": "y"
},
{
"char_end": 359,
"char_start": 358,
"chars": "t"
},
{
"char_end": 361,
"char_start": 360,
"chars": "m"
},
{
"char_end": 374,
"char_start": 373,
"chars": "%"
},
{
"char_end": 394,
"char_start": 387,
"chars": " % base"
},
{
"char_end": 401,
"char_start": 400,
"chars": "."
},
{
"char_end": 405,
"char_start": 402,
"chars": "yst"
},
{
"char_end": 407,
"char_start": 406,
"chars": "m"
},
{
"char_end": 425,
"char_start": 422,
"chars": "%s."
},
{
"char_end": 432,
"char_start": 427,
"chars": "c %s'"
},
{
"char_end": 434,
"char_start": 433,
"chars": "%"
},
{
"char_end": 437,
"char_start": 435,
"chars": "(b"
},
{
"char_end": 440,
"char_start": 439,
"chars": "e"
},
{
"char_end": 447,
"char_start": 446,
"chars": ")"
},
{
"char_end": 454,
"char_start": 453,
"chars": "."
},
{
"char_end": 458,
"char_start": 455,
"chars": "yst"
},
{
"char_end": 460,
"char_start": 459,
"chars": "m"
},
{
"char_end": 480,
"char_start": 477,
"chars": "%s."
},
{
"char_end": 484,
"char_start": 482,
"chars": "c'"
},
{
"char_end": 486,
"char_start": 485,
"chars": "%"
},
{
"char_end": 488,
"char_start": 487,
"chars": "b"
},
{
"char_end": 491,
"char_start": 490,
"chars": "e"
}
]
},
"commit_link": "github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb",
"file_name": "repack_rust.py",
"func_name": "fetch",
"line_changes": {
"added": [
{
"char_end": 368,
"char_start": 308,
"line": " subprocess.check_call(['shasum', '-c', base + '.sha256'])\n",
"line_no": 11
},
{
"char_end": 432,
"char_start": 368,
"line": " subprocess.check_call(['shasum', '-c', base + '.asc.sha256'])\n",
"line_no": 12
},
{
"char_end": 498,
"char_start": 432,
"line": " subprocess.check_call(['gpg', '--verify', base + '.asc', base])\n",
"line_no": 13
},
{
"char_end": 559,
"char_start": 498,
"line": " subprocess.check_call(['keybase', 'verify', base + '.asc'])\n",
"line_no": 14
}
],
"deleted": [
{
"char_end": 350,
"char_start": 308,
"line": " os.system('shasum -c %s.sha256' % base)\n",
"line_no": 11
},
{
"char_end": 396,
"char_start": 350,
"line": " os.system('shasum -c %s.asc.sha256' % base)\n",
"line_no": 12
},
{
"char_end": 449,
"char_start": 396,
"line": " os.system('gpg --verify %s.asc %s' % (base, base))\n",
"line_no": 13
},
{
"char_end": 492,
"char_start": 449,
"line": " os.system('keybase verify %s.asc' % base)\n",
"line_no": 14
}
]
},
"vul_type": "cwe-078"
}
| 140
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _formatCredentials(self, data, name):\n \"\"\"\n Credentials are of the form\n RCLONE_CONFIG_CURRENT_TYPE=s3\n ^ ^ ^ ^\n [mandatory ][name ][key][value]\n \"\"\"",
" prefix = \"RCLONE_CONFIG_{}\".format(name.upper())\n",
" credentials = ''\n credentials += \"{}_TYPE='{}' \".format(prefix, data.type)",
"\n def _addCredential(credentials, env_key, data_key):\n value = getattr(data, data_key, None)\n if value is not None:",
" credentials += \"{}='{}' \".format(env_key, value)",
" return credentials",
"\n if data.type == 's3':\n credentials = _addCredential(credentials,\n '{}_REGION'.format(prefix),\n 's3_region'\n )\n credentials = _addCredential(credentials,\n '{}_ACCESS_KEY_ID'.format(prefix),\n 's3_access_key_id'\n )\n credentials = _addCredential(credentials,\n '{}_SECRET_ACCESS_KEY'.format(prefix),\n 's3_secret_access_key'\n )",
" credentials = _addCredential(credentials,\n '{}_ENDPOINT'.format(prefix),\n 's3_endpoint'\n )\n credentials = _addCredential(credentials,\n '{}_V2_AUTH'.format(prefix),\n 's3_v2_auth'\n )",
" elif data.type == 'azureblob':\n credentials = _addCredential(credentials,\n '{}_ACCOUNT'.format(prefix),\n 'azure_account'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'azure_key'\n )",
" elif data.type == 'swift':\n credentials = _addCredential(credentials,\n '{}_USER'.format(prefix),\n 'swift_user'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'swift_key'\n )\n credentials = _addCredential(credentials,\n '{}_AUTH'.format(prefix),\n 'swift_auth'\n )\n credentials = _addCredential(credentials,\n '{}_TENANT'.format(prefix),\n 'swift_tenant'\n )",
" elif data.type == 'google cloud storage':\n credentials = _addCredential(credentials,\n '{}_CLIENT_ID'.format(prefix),\n 'gcp_client_id'\n )\n credentials = _addCredential(credentials,\n '{}_SERVICE_ACCOUNT_CREDENTIALS'.format(prefix),\n 'gcp_service_account_credentials'\n )\n credentials = _addCredential(credentials,\n '{}_PROJECT_NUMBER'.format(prefix),\n 'gcp_project_number'\n )\n credentials = _addCredential(credentials,\n '{}_OBJECT_ACL'.format(prefix),\n 'gcp_object_acl'\n )\n credentials = _addCredential(credentials,\n '{}_BUCKET_ACL'.format(prefix),\n 'gcp_bucket_acl'\n )",
" else:\n logging.error(\"Connection type unknown: {}\".format(data.type))",
" return credentials"
] |
[
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 307,
"char_start": 305,
"chars": "{}"
},
{
"char_end": 329,
"char_start": 327,
"chars": "['"
},
{
"char_end": 355,
"char_start": 351,
"chars": ")] ="
},
{
"char_end": 539,
"char_start": 538,
"chars": "["
},
{
"char_end": 549,
"char_start": 546,
"chars": "] ="
}
],
"deleted": [
{
"char_end": 307,
"char_start": 305,
"chars": "''"
},
{
"char_end": 332,
"char_start": 327,
"chars": " += \""
},
{
"char_end": 340,
"char_start": 339,
"chars": "="
},
{
"char_end": 346,
"char_start": 341,
"chars": "{}' \""
},
{
"char_end": 361,
"char_start": 360,
"chars": ","
},
{
"char_end": 372,
"char_start": 371,
"chars": ")"
},
{
"char_end": 567,
"char_start": 545,
"chars": " += \"{}='{}' \".format("
},
{
"char_end": 575,
"char_start": 574,
"chars": ","
},
{
"char_end": 582,
"char_start": 581,
"chars": ")"
}
]
},
"commit_link": "github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db",
"file_name": "src/backend/api/utils/rclone_connection.py",
"func_name": "_formatCredentials",
"line_changes": {
"added": [
{
"char_end": 308,
"char_start": 283,
"line": " credentials = {}\n",
"line_no": 11
},
{
"char_end": 366,
"char_start": 308,
"line": " credentials['{}_TYPE'.format(prefix)] = data.type\n",
"line_no": 12
},
{
"char_end": 556,
"char_start": 511,
"line": " credentials[env_key] = value\n",
"line_no": 17
}
],
"deleted": [
{
"char_end": 308,
"char_start": 283,
"line": " credentials = ''\n",
"line_no": 11
},
{
"char_end": 373,
"char_start": 308,
"line": " credentials += \"{}_TYPE='{}' \".format(prefix, data.type)\n",
"line_no": 12
},
{
"char_end": 583,
"char_start": 518,
"line": " credentials += \"{}='{}' \".format(env_key, value)\n",
"line_no": 17
}
]
},
"vul_type": "cwe-078"
}
| 141
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _formatCredentials(self, data, name):\n \"\"\"\n Credentials are of the form\n RCLONE_CONFIG_CURRENT_TYPE=s3\n ^ ^ ^ ^\n [mandatory ][name ][key][value]\n \"\"\"",
" prefix = \"RCLONE_CONFIG_{}\".format(name.upper())\n",
" credentials = {}\n credentials['{}_TYPE'.format(prefix)] = data.type",
"\n def _addCredential(credentials, env_key, data_key):\n value = getattr(data, data_key, None)\n if value is not None:",
" credentials[env_key] = value",
" return credentials",
"\n if data.type == 's3':\n credentials = _addCredential(credentials,\n '{}_REGION'.format(prefix),\n 's3_region'\n )\n credentials = _addCredential(credentials,\n '{}_ACCESS_KEY_ID'.format(prefix),\n 's3_access_key_id'\n )\n credentials = _addCredential(credentials,\n '{}_SECRET_ACCESS_KEY'.format(prefix),\n 's3_secret_access_key'\n )",
" credentials = _addCredential(credentials,\n '{}_ENDPOINT'.format(prefix),\n 's3_endpoint'\n )\n credentials = _addCredential(credentials,\n '{}_V2_AUTH'.format(prefix),\n 's3_v2_auth'\n )",
" elif data.type == 'azureblob':\n credentials = _addCredential(credentials,\n '{}_ACCOUNT'.format(prefix),\n 'azure_account'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'azure_key'\n )",
" elif data.type == 'swift':\n credentials = _addCredential(credentials,\n '{}_USER'.format(prefix),\n 'swift_user'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'swift_key'\n )\n credentials = _addCredential(credentials,\n '{}_AUTH'.format(prefix),\n 'swift_auth'\n )\n credentials = _addCredential(credentials,\n '{}_TENANT'.format(prefix),\n 'swift_tenant'\n )",
" elif data.type == 'google cloud storage':\n credentials = _addCredential(credentials,\n '{}_CLIENT_ID'.format(prefix),\n 'gcp_client_id'\n )\n credentials = _addCredential(credentials,\n '{}_SERVICE_ACCOUNT_CREDENTIALS'.format(prefix),\n 'gcp_service_account_credentials'\n )\n credentials = _addCredential(credentials,\n '{}_PROJECT_NUMBER'.format(prefix),\n 'gcp_project_number'\n )\n credentials = _addCredential(credentials,\n '{}_OBJECT_ACL'.format(prefix),\n 'gcp_object_acl'\n )\n credentials = _addCredential(credentials,\n '{}_BUCKET_ACL'.format(prefix),\n 'gcp_bucket_acl'\n )",
" else:\n logging.error(\"Connection type unknown: {}\".format(data.type))",
" return credentials"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 307,
"char_start": 305,
"chars": "{}"
},
{
"char_end": 329,
"char_start": 327,
"chars": "['"
},
{
"char_end": 355,
"char_start": 351,
"chars": ")] ="
},
{
"char_end": 539,
"char_start": 538,
"chars": "["
},
{
"char_end": 549,
"char_start": 546,
"chars": "] ="
}
],
"deleted": [
{
"char_end": 307,
"char_start": 305,
"chars": "''"
},
{
"char_end": 332,
"char_start": 327,
"chars": " += \""
},
{
"char_end": 340,
"char_start": 339,
"chars": "="
},
{
"char_end": 346,
"char_start": 341,
"chars": "{}' \""
},
{
"char_end": 361,
"char_start": 360,
"chars": ","
},
{
"char_end": 372,
"char_start": 371,
"chars": ")"
},
{
"char_end": 567,
"char_start": 545,
"chars": " += \"{}='{}' \".format("
},
{
"char_end": 575,
"char_start": 574,
"chars": ","
},
{
"char_end": 582,
"char_start": 581,
"chars": ")"
}
]
},
"commit_link": "github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db",
"file_name": "src/backend/api/utils/rclone_connection.py",
"func_name": "_formatCredentials",
"line_changes": {
"added": [
{
"char_end": 308,
"char_start": 283,
"line": " credentials = {}\n",
"line_no": 11
},
{
"char_end": 366,
"char_start": 308,
"line": " credentials['{}_TYPE'.format(prefix)] = data.type\n",
"line_no": 12
},
{
"char_end": 556,
"char_start": 511,
"line": " credentials[env_key] = value\n",
"line_no": 17
}
],
"deleted": [
{
"char_end": 308,
"char_start": 283,
"line": " credentials = ''\n",
"line_no": 11
},
{
"char_end": 373,
"char_start": 308,
"line": " credentials += \"{}_TYPE='{}' \".format(prefix, data.type)\n",
"line_no": 12
},
{
"char_end": 583,
"char_start": 518,
"line": " credentials += \"{}='{}' \".format(env_key, value)\n",
"line_no": 17
}
]
},
"vul_type": "cwe-078"
}
| 141
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def initHeader(self):\n \"\"\"Initialize the IP header according to the IP format definition.",
" \"\"\"",
" # Ethernet header",
" # Retrieve remote MAC address\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n # Force ARP resolution",
" p = subprocess.Popen(\"ping -c1 {}\".format(self.remoteIP), shell=True)",
" p.wait()\n time.sleep(0.1)",
" dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n raise Exception(\"Cannot resolve IP address to a MAC address for IP: '{}'\".format(self.remoteIP))",
" # Retrieve local MAC address\n srcMacAddr = self.get_interface_addr(bytes(self.interface, 'utf-8'))[1]",
" eth_dst = Field(name='eth.dst', domain=Raw(dstMacAddr))\n eth_src = Field(name='eth.src', domain=Raw(srcMacAddr))\n eth_type = Field(name='eth.type', domain=Raw(b\"\\x08\\x00\"))",
"\n # IP header",
" ip_ver = Field(\n name='ip.version', domain=BitArray(\n value=bitarray('0100'))) # IP Version 4\n ip_ihl = Field(name='ip.hdr_len', domain=BitArray(bitarray('0000')))\n ip_tos = Field(\n name='ip.tos',\n domain=Data(\n dataType=BitArray(nbBits=8),\n originalValue=bitarray('00000000'),\n svas=SVAS.PERSISTENT))\n ip_tot_len = Field(\n name='ip.len', domain=BitArray(bitarray('0000000000000000')))\n ip_id = Field(name='ip.id', domain=BitArray(nbBits=16))\n ip_flags = Field(name='ip.flags', domain=Data(dataType=BitArray(nbBits=3), originalValue=bitarray('000'), svas=SVAS.PERSISTENT))\n ip_frag_off = Field(name='ip.fragment', domain=Data(dataType=BitArray(nbBits=13), originalValue=bitarray('0000000000000'), svas=SVAS.PERSISTENT))\n ip_ttl = Field(name='ip.ttl', domain=Data(dataType=BitArray(nbBits=8), originalValue=bitarray('01000000'), svas=SVAS.PERSISTENT))\n ip_proto = Field(name='ip.proto', domain=Integer(value=self.upperProtocol, unitSize=AbstractType.UNITSIZE_8, endianness=AbstractType.ENDIAN_BIG, sign=AbstractType.SIGN_UNSIGNED))\n ip_checksum = Field(name='ip.checksum', domain=BitArray(bitarray('0000000000000000')))\n ip_saddr = Field(name='ip.src', domain=IPv4(self.localIP))\n ip_daddr = Field(\n name='ip.dst', domain=IPv4(self.remoteIP))\n ip_payload = Field(name='ip.payload', domain=Raw())",
" ip_ihl.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id, ip_flags,\n ip_frag_off,\n ip_ttl, ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=BitArray(nbBits=4), factor=1/float(32))\n ip_tot_len.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload], dataType=Integer(unitSize=AbstractType.UNITSIZE_16, sign=AbstractType.SIGN_UNSIGNED), factor=1/float(8))\n ip_checksum.domain = InternetChecksum(fields=[ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=Raw(nbBytes=2, unitSize=AbstractType.UNITSIZE_16))\n \n self.header = Symbol(name='Ethernet layer', fields=[eth_dst,\n eth_src,\n eth_type,\n ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload])"
] |
[
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 457,
"char_start": 456,
"chars": "["
},
{
"char_end": 463,
"char_start": 458,
"chars": "/bin/"
},
{
"char_end": 469,
"char_start": 467,
"chars": "\","
},
{
"char_end": 471,
"char_start": 470,
"chars": "\""
},
{
"char_end": 477,
"char_start": 475,
"chars": ", "
},
{
"char_end": 491,
"char_start": 490,
"chars": "]"
}
],
"deleted": [
{
"char_end": 468,
"char_start": 465,
"chars": " {}"
},
{
"char_end": 477,
"char_start": 469,
"chars": ".format("
},
{
"char_end": 503,
"char_start": 490,
"chars": "), shell=True"
}
]
},
"commit_link": "github.com/netzob/netzob/commit/557abf64867d715497979b029efedbd2777b912e",
"file_name": "src/netzob/Simulator/Channels/RawEthernetClient.py",
"func_name": "initHeader",
"line_changes": {
"added": [
{
"char_end": 493,
"char_start": 423,
"line": " p = subprocess.Popen([\"/bin/ping\", \"-c1\", self.remoteIP])\n",
"line_no": 15
}
],
"deleted": [
{
"char_end": 505,
"char_start": 423,
"line": " p = subprocess.Popen(\"ping -c1 {}\".format(self.remoteIP), shell=True)\n",
"line_no": 15
}
]
},
"vul_type": "cwe-078"
}
| 142
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def initHeader(self):\n \"\"\"Initialize the IP header according to the IP format definition.",
" \"\"\"",
" # Ethernet header",
" # Retrieve remote MAC address\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n # Force ARP resolution",
" p = subprocess.Popen([\"/bin/ping\", \"-c1\", self.remoteIP])",
" p.wait()\n time.sleep(0.1)",
" dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n raise Exception(\"Cannot resolve IP address to a MAC address for IP: '{}'\".format(self.remoteIP))",
" # Retrieve local MAC address\n srcMacAddr = self.get_interface_addr(bytes(self.interface, 'utf-8'))[1]",
" eth_dst = Field(name='eth.dst', domain=Raw(dstMacAddr))\n eth_src = Field(name='eth.src', domain=Raw(srcMacAddr))\n eth_type = Field(name='eth.type', domain=Raw(b\"\\x08\\x00\"))",
"\n # IP header",
" ip_ver = Field(\n name='ip.version', domain=BitArray(\n value=bitarray('0100'))) # IP Version 4\n ip_ihl = Field(name='ip.hdr_len', domain=BitArray(bitarray('0000')))\n ip_tos = Field(\n name='ip.tos',\n domain=Data(\n dataType=BitArray(nbBits=8),\n originalValue=bitarray('00000000'),\n svas=SVAS.PERSISTENT))\n ip_tot_len = Field(\n name='ip.len', domain=BitArray(bitarray('0000000000000000')))\n ip_id = Field(name='ip.id', domain=BitArray(nbBits=16))\n ip_flags = Field(name='ip.flags', domain=Data(dataType=BitArray(nbBits=3), originalValue=bitarray('000'), svas=SVAS.PERSISTENT))\n ip_frag_off = Field(name='ip.fragment', domain=Data(dataType=BitArray(nbBits=13), originalValue=bitarray('0000000000000'), svas=SVAS.PERSISTENT))\n ip_ttl = Field(name='ip.ttl', domain=Data(dataType=BitArray(nbBits=8), originalValue=bitarray('01000000'), svas=SVAS.PERSISTENT))\n ip_proto = Field(name='ip.proto', domain=Integer(value=self.upperProtocol, unitSize=AbstractType.UNITSIZE_8, endianness=AbstractType.ENDIAN_BIG, sign=AbstractType.SIGN_UNSIGNED))\n ip_checksum = Field(name='ip.checksum', domain=BitArray(bitarray('0000000000000000')))\n ip_saddr = Field(name='ip.src', domain=IPv4(self.localIP))\n ip_daddr = Field(\n name='ip.dst', domain=IPv4(self.remoteIP))\n ip_payload = Field(name='ip.payload', domain=Raw())",
" ip_ihl.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id, ip_flags,\n ip_frag_off,\n ip_ttl, ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=BitArray(nbBits=4), factor=1/float(32))\n ip_tot_len.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload], dataType=Integer(unitSize=AbstractType.UNITSIZE_16, sign=AbstractType.SIGN_UNSIGNED), factor=1/float(8))\n ip_checksum.domain = InternetChecksum(fields=[ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=Raw(nbBytes=2, unitSize=AbstractType.UNITSIZE_16))\n \n self.header = Symbol(name='Ethernet layer', fields=[eth_dst,\n eth_src,\n eth_type,\n ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload])"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 457,
"char_start": 456,
"chars": "["
},
{
"char_end": 463,
"char_start": 458,
"chars": "/bin/"
},
{
"char_end": 469,
"char_start": 467,
"chars": "\","
},
{
"char_end": 471,
"char_start": 470,
"chars": "\""
},
{
"char_end": 477,
"char_start": 475,
"chars": ", "
},
{
"char_end": 491,
"char_start": 490,
"chars": "]"
}
],
"deleted": [
{
"char_end": 468,
"char_start": 465,
"chars": " {}"
},
{
"char_end": 477,
"char_start": 469,
"chars": ".format("
},
{
"char_end": 503,
"char_start": 490,
"chars": "), shell=True"
}
]
},
"commit_link": "github.com/netzob/netzob/commit/557abf64867d715497979b029efedbd2777b912e",
"file_name": "src/netzob/Simulator/Channels/RawEthernetClient.py",
"func_name": "initHeader",
"line_changes": {
"added": [
{
"char_end": 493,
"char_start": 423,
"line": " p = subprocess.Popen([\"/bin/ping\", \"-c1\", self.remoteIP])\n",
"line_no": 15
}
],
"deleted": [
{
"char_end": 505,
"char_start": 423,
"line": " p = subprocess.Popen(\"ping -c1 {}\".format(self.remoteIP), shell=True)\n",
"line_no": 15
}
]
},
"vul_type": "cwe-078"
}
| 142
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def poll(self, poll_input):\n username = poll_input.credentials.username\n password = poll_input.credentials.password\n domain = poll_input.credentials.domain\n \n if domain is None:",
" opt_str = '--ignore-certificate --authonly -u {} -p {} {}:{}'",
" options = opt_str.format(\n username, password,\n poll_input.server, poll_input.port)\n else:",
" opt_str = '--ignore-certificate --authonly -d {} -u {} -p {} {}:{}'",
" options = opt_str.format(\n domain.domain, username, password,\n poll_input.server, poll_input.port)",
" try:\n output = subprocess.check_output('timeout {} xfreerdp {}'.format(poll_input.timeout, options), shell=True, stderr=subprocess.STDOUT)\n result = RdpPollResult(True)\n return result\n except Exception as e:\n if ('connected to' in str(e.output) and 'Authentication failure' not in str(e.output)) or (e.returncode == 131 and 'negotiation' in str(e.output)):\n result = RdpPollResult(True)\n return result\n print(\"{{{{%s}}}}\" % e.output)\n result = RdpPollResult(False, e)\n return result"
] |
[
1,
0,
1,
0,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 277,
"char_start": 275,
"chars": "\\'"
},
{
"char_end": 281,
"char_start": 279,
"chars": "\\'"
},
{
"char_end": 287,
"char_start": 285,
"chars": "\\'"
},
{
"char_end": 291,
"char_start": 289,
"chars": "\\'"
},
{
"char_end": 513,
"char_start": 511,
"chars": "\\'"
},
{
"char_end": 517,
"char_start": 515,
"chars": "\\'"
},
{
"char_end": 523,
"char_start": 521,
"chars": "\\'"
},
{
"char_end": 527,
"char_start": 525,
"chars": "\\'"
}
],
"deleted": []
},
"commit_link": "github.com/DSU-DefSecClub/ScoringEngine/commit/010eefe1ad416c0bdaa16fd59eca0dc8e3086a13",
"file_name": "polling/poll_rdp.py",
"func_name": "poll",
"line_changes": {
"added": [
{
"char_end": 299,
"char_start": 217,
"line": " opt_str = '--ignore-certificate --authonly -u \\'{}\\' -p \\'{}\\' {}:{}'\n",
"line_no": 7
},
{
"char_end": 535,
"char_start": 447,
"line": " opt_str = '--ignore-certificate --authonly -d {} -u \\'{}\\' -p \\'{}\\' {}:{}'\n",
"line_no": 12
}
],
"deleted": [
{
"char_end": 291,
"char_start": 217,
"line": " opt_str = '--ignore-certificate --authonly -u {} -p {} {}:{}'\n",
"line_no": 7
},
{
"char_end": 519,
"char_start": 439,
"line": " opt_str = '--ignore-certificate --authonly -d {} -u {} -p {} {}:{}'\n",
"line_no": 12
}
]
},
"vul_type": "cwe-078"
}
| 143
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def poll(self, poll_input):\n username = poll_input.credentials.username\n password = poll_input.credentials.password\n domain = poll_input.credentials.domain\n \n if domain is None:",
" opt_str = '--ignore-certificate --authonly -u \\'{}\\' -p \\'{}\\' {}:{}'",
" options = opt_str.format(\n username, password,\n poll_input.server, poll_input.port)\n else:",
" opt_str = '--ignore-certificate --authonly -d {} -u \\'{}\\' -p \\'{}\\' {}:{}'",
" options = opt_str.format(\n domain.domain, username, password,\n poll_input.server, poll_input.port)",
" try:\n output = subprocess.check_output('timeout {} xfreerdp {}'.format(poll_input.timeout, options), shell=True, stderr=subprocess.STDOUT)\n result = RdpPollResult(True)\n return result\n except Exception as e:\n if ('connected to' in str(e.output) and 'Authentication failure' not in str(e.output)) or (e.returncode == 131 and 'negotiation' in str(e.output)):\n result = RdpPollResult(True)\n return result\n print(\"{{{{%s}}}}\" % e.output)\n result = RdpPollResult(False, e)\n return result"
] |
[
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 277,
"char_start": 275,
"chars": "\\'"
},
{
"char_end": 281,
"char_start": 279,
"chars": "\\'"
},
{
"char_end": 287,
"char_start": 285,
"chars": "\\'"
},
{
"char_end": 291,
"char_start": 289,
"chars": "\\'"
},
{
"char_end": 513,
"char_start": 511,
"chars": "\\'"
},
{
"char_end": 517,
"char_start": 515,
"chars": "\\'"
},
{
"char_end": 523,
"char_start": 521,
"chars": "\\'"
},
{
"char_end": 527,
"char_start": 525,
"chars": "\\'"
}
],
"deleted": []
},
"commit_link": "github.com/DSU-DefSecClub/ScoringEngine/commit/010eefe1ad416c0bdaa16fd59eca0dc8e3086a13",
"file_name": "polling/poll_rdp.py",
"func_name": "poll",
"line_changes": {
"added": [
{
"char_end": 299,
"char_start": 217,
"line": " opt_str = '--ignore-certificate --authonly -u \\'{}\\' -p \\'{}\\' {}:{}'\n",
"line_no": 7
},
{
"char_end": 535,
"char_start": 447,
"line": " opt_str = '--ignore-certificate --authonly -d {} -u \\'{}\\' -p \\'{}\\' {}:{}'\n",
"line_no": 12
}
],
"deleted": [
{
"char_end": 291,
"char_start": 217,
"line": " opt_str = '--ignore-certificate --authonly -u {} -p {} {}:{}'\n",
"line_no": 7
},
{
"char_end": 519,
"char_start": 439,
"line": " opt_str = '--ignore-certificate --authonly -d {} -u {} -p {} {}:{}'\n",
"line_no": 12
}
]
},
"vul_type": "cwe-078"
}
| 143
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def terminate_connection(self, volume, connector, **kwargs):\n \"\"\"Cleanup after an iSCSI connection has been terminated.",
" When we clean up a terminated connection between a given connector\n and volume, we:\n 1. Translate the given connector to a host name\n 2. Remove the volume-to-host mapping if it exists\n 3. Delete the host if it has no more mappings (hosts are created\n automatically by this driver when mappings are created)\n \"\"\"\n LOG.debug(_('enter: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})",
" vol_name = volume['name']\n host_name = self._get_host_from_connector(connector)\n # Verify that _get_host_from_connector returned the host.\n # This should always succeed as we terminate an existing connection.\n self._driver_assert(\n host_name is not None,\n _('_get_host_from_connector failed to return the host name '\n 'for connector'))",
" # Check if vdisk-host mapping exists, remove if it does\n mapping_data = self._get_hostvdisk_mappings(host_name)\n if vol_name in mapping_data:",
" ssh_cmd = 'svctask rmvdiskhostmap -host %s %s' % \\\n (host_name, vol_name)",
" out, err = self._run_ssh(ssh_cmd)\n # Verify CLI behaviour - no output is returned from\n # rmvdiskhostmap\n self._assert_ssh_return(len(out.strip()) == 0,\n 'terminate_connection', ssh_cmd, out, err)\n del mapping_data[vol_name]\n else:\n LOG.error(_('terminate_connection: No mapping of volume '\n '%(vol_name)s to host %(host_name)s found') %\n {'vol_name': vol_name, 'host_name': host_name})",
" # If this host has no more mappings, delete it\n if not mapping_data:\n self._delete_host(host_name)",
" LOG.debug(_('leave: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})"
] |
[
1,
1,
1,
1,
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 1300,
"char_start": 1299,
"chars": "["
},
{
"char_end": 1310,
"char_start": 1308,
"chars": "',"
},
{
"char_end": 1312,
"char_start": 1311,
"chars": "'"
},
{
"char_end": 1328,
"char_start": 1326,
"chars": "',"
},
{
"char_end": 1330,
"char_start": 1329,
"chars": "'"
},
{
"char_end": 1337,
"char_start": 1335,
"chars": "',"
},
{
"char_end": 1340,
"char_start": 1338,
"chars": "ho"
},
{
"char_end": 1350,
"char_start": 1341,
"chars": "t_name,\n "
},
{
"char_end": 1371,
"char_start": 1367,
"chars": " "
},
{
"char_end": 1381,
"char_start": 1380,
"chars": "]"
}
],
"deleted": [
{
"char_end": 1330,
"char_start": 1329,
"chars": "%"
},
{
"char_end": 1340,
"char_start": 1332,
"chars": "%s' % \\\n"
},
{
"char_end": 1367,
"char_start": 1356,
"chars": "(host_name,"
},
{
"char_end": 1377,
"char_start": 1376,
"chars": ")"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "terminate_connection",
"line_changes": {
"added": [
{
"char_end": 1349,
"char_start": 1277,
"line": " ssh_cmd = ['svctask', 'rmvdiskhostmap', '-host', host_name,\n",
"line_no": 27
},
{
"char_end": 1382,
"char_start": 1349,
"line": " vol_name]\n",
"line_no": 28
}
],
"deleted": [
{
"char_end": 1340,
"char_start": 1277,
"line": " ssh_cmd = 'svctask rmvdiskhostmap -host %s %s' % \\\n",
"line_no": 27
},
{
"char_end": 1378,
"char_start": 1340,
"line": " (host_name, vol_name)\n",
"line_no": 28
}
]
},
"vul_type": "cwe-078"
}
| 144
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def terminate_connection(self, volume, connector, **kwargs):\n \"\"\"Cleanup after an iSCSI connection has been terminated.",
" When we clean up a terminated connection between a given connector\n and volume, we:\n 1. Translate the given connector to a host name\n 2. Remove the volume-to-host mapping if it exists\n 3. Delete the host if it has no more mappings (hosts are created\n automatically by this driver when mappings are created)\n \"\"\"\n LOG.debug(_('enter: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})",
" vol_name = volume['name']\n host_name = self._get_host_from_connector(connector)\n # Verify that _get_host_from_connector returned the host.\n # This should always succeed as we terminate an existing connection.\n self._driver_assert(\n host_name is not None,\n _('_get_host_from_connector failed to return the host name '\n 'for connector'))",
" # Check if vdisk-host mapping exists, remove if it does\n mapping_data = self._get_hostvdisk_mappings(host_name)\n if vol_name in mapping_data:",
" ssh_cmd = ['svctask', 'rmvdiskhostmap', '-host', host_name,\n vol_name]",
" out, err = self._run_ssh(ssh_cmd)\n # Verify CLI behaviour - no output is returned from\n # rmvdiskhostmap\n self._assert_ssh_return(len(out.strip()) == 0,\n 'terminate_connection', ssh_cmd, out, err)\n del mapping_data[vol_name]\n else:\n LOG.error(_('terminate_connection: No mapping of volume '\n '%(vol_name)s to host %(host_name)s found') %\n {'vol_name': vol_name, 'host_name': host_name})",
" # If this host has no more mappings, delete it\n if not mapping_data:\n self._delete_host(host_name)",
" LOG.debug(_('leave: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})"
] |
[
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 1300,
"char_start": 1299,
"chars": "["
},
{
"char_end": 1310,
"char_start": 1308,
"chars": "',"
},
{
"char_end": 1312,
"char_start": 1311,
"chars": "'"
},
{
"char_end": 1328,
"char_start": 1326,
"chars": "',"
},
{
"char_end": 1330,
"char_start": 1329,
"chars": "'"
},
{
"char_end": 1337,
"char_start": 1335,
"chars": "',"
},
{
"char_end": 1340,
"char_start": 1338,
"chars": "ho"
},
{
"char_end": 1350,
"char_start": 1341,
"chars": "t_name,\n "
},
{
"char_end": 1371,
"char_start": 1367,
"chars": " "
},
{
"char_end": 1381,
"char_start": 1380,
"chars": "]"
}
],
"deleted": [
{
"char_end": 1330,
"char_start": 1329,
"chars": "%"
},
{
"char_end": 1340,
"char_start": 1332,
"chars": "%s' % \\\n"
},
{
"char_end": 1367,
"char_start": 1356,
"chars": "(host_name,"
},
{
"char_end": 1377,
"char_start": 1376,
"chars": ")"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "terminate_connection",
"line_changes": {
"added": [
{
"char_end": 1349,
"char_start": 1277,
"line": " ssh_cmd = ['svctask', 'rmvdiskhostmap', '-host', host_name,\n",
"line_no": 27
},
{
"char_end": 1382,
"char_start": 1349,
"line": " vol_name]\n",
"line_no": 28
}
],
"deleted": [
{
"char_end": 1340,
"char_start": 1277,
"line": " ssh_cmd = 'svctask rmvdiskhostmap -host %s %s' % \\\n",
"line_no": 27
},
{
"char_end": 1378,
"char_start": 1340,
"line": " (host_name, vol_name)\n",
"line_no": 28
}
]
},
"vul_type": "cwe-078"
}
| 144
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _port_conf_generator(self, cmd):",
" ssh_cmd = '%s -delim !' % cmd",
" out, err = self._run_ssh(ssh_cmd)",
" if not len(out.strip()):\n return\n port_lines = out.strip().split('\\n')\n if not len(port_lines):\n return",
" header = port_lines.pop(0)\n yield header\n for portip_line in port_lines:\n try:\n port_data = self._get_hdr_dic(header, portip_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('_port_conf_generator',\n ssh_cmd, out, err)\n yield port_data"
] |
[
1,
0,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 64,
"char_start": 59,
"chars": "cmd +"
},
{
"char_end": 67,
"char_start": 65,
"chars": "['"
},
{
"char_end": 75,
"char_start": 73,
"chars": "',"
},
{
"char_end": 77,
"char_start": 76,
"chars": "'"
},
{
"char_end": 80,
"char_start": 79,
"chars": "]"
}
],
"deleted": [
{
"char_end": 62,
"char_start": 59,
"chars": "'%s"
},
{
"char_end": 78,
"char_start": 72,
"chars": " % cmd"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_port_conf_generator",
"line_changes": {
"added": [
{
"char_end": 81,
"char_start": 41,
"line": " ssh_cmd = cmd + ['-delim', '!']\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 79,
"char_start": 41,
"line": " ssh_cmd = '%s -delim !' % cmd\n",
"line_no": 2
}
]
},
"vul_type": "cwe-078"
}
| 145
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def _port_conf_generator(self, cmd):",
" ssh_cmd = cmd + ['-delim', '!']",
" out, err = self._run_ssh(ssh_cmd)",
" if not len(out.strip()):\n return\n port_lines = out.strip().split('\\n')\n if not len(port_lines):\n return",
" header = port_lines.pop(0)\n yield header\n for portip_line in port_lines:\n try:\n port_data = self._get_hdr_dic(header, portip_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('_port_conf_generator',\n ssh_cmd, out, err)\n yield port_data"
] |
[
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 64,
"char_start": 59,
"chars": "cmd +"
},
{
"char_end": 67,
"char_start": 65,
"chars": "['"
},
{
"char_end": 75,
"char_start": 73,
"chars": "',"
},
{
"char_end": 77,
"char_start": 76,
"chars": "'"
},
{
"char_end": 80,
"char_start": 79,
"chars": "]"
}
],
"deleted": [
{
"char_end": 62,
"char_start": 59,
"chars": "'%s"
},
{
"char_end": 78,
"char_start": 72,
"chars": " % cmd"
}
]
},
"commit_link": "github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4",
"file_name": "cinder/volume/drivers/storwize_svc.py",
"func_name": "_port_conf_generator",
"line_changes": {
"added": [
{
"char_end": 81,
"char_start": 41,
"line": " ssh_cmd = cmd + ['-delim', '!']\n",
"line_no": 2
}
],
"deleted": [
{
"char_end": 79,
"char_start": 41,
"line": " ssh_cmd = '%s -delim !' % cmd\n",
"line_no": 2
}
]
},
"vul_type": "cwe-078"
}
| 145
|
cwe-078
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def init_settings(self, ipython_app, kernel_manager, contents_manager,\n cluster_manager, session_manager, kernel_spec_manager,\n config_manager,\n log, base_url, default_url, settings_overrides,\n jinja_env_options=None):",
" _template_path = settings_overrides.get(\n \"template_path\",\n ipython_app.template_file_path,\n )\n if isinstance(_template_path, py3compat.string_types):\n _template_path = (_template_path,)\n template_path = [os.path.expanduser(path) for path in _template_path]\n",
" jenv_opt = jinja_env_options if jinja_env_options else {}",
" env = Environment(loader=FileSystemLoader(template_path), **jenv_opt)\n \n sys_info = get_sys_info()\n if sys_info['commit_source'] == 'repository':\n # don't cache (rely on 304) when working from master\n version_hash = ''\n else:\n # reset the cache on server restart\n version_hash = datetime.datetime.now().strftime(\"%Y%m%d%H%M%S\")",
" settings = dict(\n # basics\n log_function=log_request,\n base_url=base_url,\n default_url=default_url,\n template_path=template_path,\n static_path=ipython_app.static_file_path,\n static_handler_class = FileFindHandler,\n static_url_prefix = url_path_join(base_url,'/static/'),\n static_handler_args = {\n # don't cache custom.js\n 'no_cache_paths': [url_path_join(base_url, 'static', 'custom')],\n },\n version_hash=version_hash,\n \n # authentication\n cookie_secret=ipython_app.cookie_secret,\n login_url=url_path_join(base_url,'/login'),\n login_handler_class=ipython_app.login_handler_class,\n logout_handler_class=ipython_app.logout_handler_class,\n password=ipython_app.password,",
" # managers\n kernel_manager=kernel_manager,\n contents_manager=contents_manager,\n cluster_manager=cluster_manager,\n session_manager=session_manager,\n kernel_spec_manager=kernel_spec_manager,\n config_manager=config_manager,",
" # IPython stuff\n jinja_template_vars=ipython_app.jinja_template_vars,\n nbextensions_path=ipython_app.nbextensions_path,\n websocket_url=ipython_app.websocket_url,\n mathjax_url=ipython_app.mathjax_url,\n config=ipython_app.config,\n jinja2_env=env,\n terminals_available=False, # Set later if terminals are available\n )",
" # allow custom overrides for the tornado web app.\n settings.update(settings_overrides)\n return settings"
] |
[
1,
1,
0,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 693,
"char_start": 648,
"chars": "{\"autoescape\": True}\n jenv_opt.update("
},
{
"char_end": 741,
"char_start": 739,
"chars": ")\n"
}
],
"deleted": []
},
"commit_link": "github.com/ipython/ipython/commit/3ab41641cf6fce3860c73d5cf4645aa12e1e5892",
"file_name": "IPython/html/notebookapp.py",
"func_name": "init_settings",
"line_changes": {
"added": [
{
"char_end": 669,
"char_start": 629,
"line": " jenv_opt = {\"autoescape\": True}\n",
"line_no": 15
},
{
"char_end": 741,
"char_start": 669,
"line": " jenv_opt.update(jinja_env_options if jinja_env_options else {})\n",
"line_no": 16
},
{
"char_end": 742,
"char_start": 741,
"line": "\n",
"line_no": 17
}
],
"deleted": [
{
"char_end": 695,
"char_start": 629,
"line": " jenv_opt = jinja_env_options if jinja_env_options else {}\n",
"line_no": 15
}
]
},
"vul_type": "cwe-079"
}
| 146
|
cwe-079
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def init_settings(self, ipython_app, kernel_manager, contents_manager,\n cluster_manager, session_manager, kernel_spec_manager,\n config_manager,\n log, base_url, default_url, settings_overrides,\n jinja_env_options=None):",
" _template_path = settings_overrides.get(\n \"template_path\",\n ipython_app.template_file_path,\n )\n if isinstance(_template_path, py3compat.string_types):\n _template_path = (_template_path,)\n template_path = [os.path.expanduser(path) for path in _template_path]\n",
" jenv_opt = {\"autoescape\": True}\n jenv_opt.update(jinja_env_options if jinja_env_options else {})\n",
" env = Environment(loader=FileSystemLoader(template_path), **jenv_opt)\n \n sys_info = get_sys_info()\n if sys_info['commit_source'] == 'repository':\n # don't cache (rely on 304) when working from master\n version_hash = ''\n else:\n # reset the cache on server restart\n version_hash = datetime.datetime.now().strftime(\"%Y%m%d%H%M%S\")",
" settings = dict(\n # basics\n log_function=log_request,\n base_url=base_url,\n default_url=default_url,\n template_path=template_path,\n static_path=ipython_app.static_file_path,\n static_handler_class = FileFindHandler,\n static_url_prefix = url_path_join(base_url,'/static/'),\n static_handler_args = {\n # don't cache custom.js\n 'no_cache_paths': [url_path_join(base_url, 'static', 'custom')],\n },\n version_hash=version_hash,\n \n # authentication\n cookie_secret=ipython_app.cookie_secret,\n login_url=url_path_join(base_url,'/login'),\n login_handler_class=ipython_app.login_handler_class,\n logout_handler_class=ipython_app.logout_handler_class,\n password=ipython_app.password,",
" # managers\n kernel_manager=kernel_manager,\n contents_manager=contents_manager,\n cluster_manager=cluster_manager,\n session_manager=session_manager,\n kernel_spec_manager=kernel_spec_manager,\n config_manager=config_manager,",
" # IPython stuff\n jinja_template_vars=ipython_app.jinja_template_vars,\n nbextensions_path=ipython_app.nbextensions_path,\n websocket_url=ipython_app.websocket_url,\n mathjax_url=ipython_app.mathjax_url,\n config=ipython_app.config,\n jinja2_env=env,\n terminals_available=False, # Set later if terminals are available\n )",
" # allow custom overrides for the tornado web app.\n settings.update(settings_overrides)\n return settings"
] |
[
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 693,
"char_start": 648,
"chars": "{\"autoescape\": True}\n jenv_opt.update("
},
{
"char_end": 741,
"char_start": 739,
"chars": ")\n"
}
],
"deleted": []
},
"commit_link": "github.com/ipython/ipython/commit/3ab41641cf6fce3860c73d5cf4645aa12e1e5892",
"file_name": "IPython/html/notebookapp.py",
"func_name": "init_settings",
"line_changes": {
"added": [
{
"char_end": 669,
"char_start": 629,
"line": " jenv_opt = {\"autoescape\": True}\n",
"line_no": 15
},
{
"char_end": 741,
"char_start": 669,
"line": " jenv_opt.update(jinja_env_options if jinja_env_options else {})\n",
"line_no": 16
},
{
"char_end": 742,
"char_start": 741,
"line": "\n",
"line_no": 17
}
],
"deleted": [
{
"char_end": 695,
"char_start": 629,
"line": " jenv_opt = jinja_env_options if jinja_env_options else {}\n",
"line_no": 15
}
]
},
"vul_type": "cwe-079"
}
| 146
|
cwe-079
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {\n setupUi(this);\n if (size == 1)",
" label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(name));",
" else\n label->setText(tr(\"Are you sure you want to delete these %1 torrents from the transfer list?\", \"Are you sure you want to delete these 5 torrents from the transfer list?\").arg(QString::number(size)));\n // Icons\n lbl_warn->setPixmap(GuiIconProvider::instance()->getIcon(\"dialog-warning\").pixmap(lbl_warn->height()));\n lbl_warn->setFixedWidth(lbl_warn->height());\n rememberBtn->setIcon(GuiIconProvider::instance()->getIcon(\"object-locked\"));",
" move(Utils::Misc::screenCenter(this));\n checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());\n connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));\n buttonBox->button(QDialogButtonBox::Cancel)->setFocus();\n }"
] |
[
1,
0,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 362,
"char_start": 333,
"chars": "Utils::String::toHtmlEscaped("
},
{
"char_end": 367,
"char_start": 366,
"chars": ")"
}
],
"deleted": []
},
"commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16",
"file_name": "src/gui/deletionconfirmationdlg.h",
"func_name": "DeletionConfirmationDlg::DeletionConfirmationDlg",
"line_changes": {
"added": [
{
"char_end": 371,
"char_start": 163,
"line": " label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(Utils::String::toHtmlEscaped(name)));\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 341,
"char_start": 163,
"line": " label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(name));\n",
"line_no": 4
}
]
},
"vul_type": "cwe-079"
}
| 147
|
cwe-079
|
h
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {\n setupUi(this);\n if (size == 1)",
" label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(Utils::String::toHtmlEscaped(name)));",
" else\n label->setText(tr(\"Are you sure you want to delete these %1 torrents from the transfer list?\", \"Are you sure you want to delete these 5 torrents from the transfer list?\").arg(QString::number(size)));\n // Icons\n lbl_warn->setPixmap(GuiIconProvider::instance()->getIcon(\"dialog-warning\").pixmap(lbl_warn->height()));\n lbl_warn->setFixedWidth(lbl_warn->height());\n rememberBtn->setIcon(GuiIconProvider::instance()->getIcon(\"object-locked\"));",
" move(Utils::Misc::screenCenter(this));\n checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());\n connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));\n buttonBox->button(QDialogButtonBox::Cancel)->setFocus();\n }"
] |
[
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 362,
"char_start": 333,
"chars": "Utils::String::toHtmlEscaped("
},
{
"char_end": 367,
"char_start": 366,
"chars": ")"
}
],
"deleted": []
},
"commit_link": "github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16",
"file_name": "src/gui/deletionconfirmationdlg.h",
"func_name": "DeletionConfirmationDlg::DeletionConfirmationDlg",
"line_changes": {
"added": [
{
"char_end": 371,
"char_start": 163,
"line": " label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(Utils::String::toHtmlEscaped(name)));\n",
"line_no": 4
}
],
"deleted": [
{
"char_end": 341,
"char_start": 163,
"line": " label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(name));\n",
"line_no": 4
}
]
},
"vul_type": "cwe-079"
}
| 147
|
cwe-079
|
h
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"@auth.public\n def get(self, build_id):\n try:\n build_id = int(build_id)",
" except ValueError as ex:\n self.response.write(ex.message)",
" self.abort(400)",
" build = model.Build.get_by_id(build_id)\n can_view = build and user.can_view_build_async(build).get_result()",
" if not can_view:\n if auth.get_current_identity().is_anonymous:",
" return self.redirect(gae_users.create_login_url(self.request.url))",
" self.response.write('build %d not found' % build_id)\n self.abort(404)",
" return self.redirect(str(build.url))"
] |
[
1,
0,
1,
1,
1,
0,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 135,
"char_start": 131,
"chars": "'inv"
},
{
"char_end": 149,
"char_start": 136,
"chars": "lid build id'"
},
{
"char_end": 395,
"char_start": 393,
"chars": "lf"
}
],
"deleted": [
{
"char_end": 109,
"char_start": 103,
"chars": " as ex"
},
{
"char_end": 144,
"char_start": 137,
"chars": "ex.mess"
},
{
"char_end": 147,
"char_start": 145,
"chars": "ge"
},
{
"char_end": 394,
"char_start": 389,
"chars": "gae_u"
},
{
"char_end": 398,
"char_start": 396,
"chars": "rs"
}
]
},
"commit_link": "github.com/asdfghjjklllllaaa/infra/commit/2f39f3df54fb79b56744f00bcf97583b3807851f",
"file_name": "appengine/cr-buildbucket/handlers.py",
"func_name": "get",
"line_changes": {
"added": [
{
"char_end": 105,
"char_start": 82,
"line": " except ValueError:\n",
"line_no": 5
},
{
"char_end": 151,
"char_start": 105,
"line": " self.response.write('invalid build id')\n",
"line_no": 6
},
{
"char_end": 432,
"char_start": 362,
"line": " return self.redirect(self.create_login_url(self.request.url))\n",
"line_no": 14
}
],
"deleted": [
{
"char_end": 111,
"char_start": 82,
"line": " except ValueError as ex:\n",
"line_no": 5
},
{
"char_end": 149,
"char_start": 111,
"line": " self.response.write(ex.message)\n",
"line_no": 6
},
{
"char_end": 435,
"char_start": 360,
"line": " return self.redirect(gae_users.create_login_url(self.request.url))\n",
"line_no": 14
}
]
},
"vul_type": "cwe-079"
}
| 148
|
cwe-079
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"@auth.public\n def get(self, build_id):\n try:\n build_id = int(build_id)",
" except ValueError:\n self.response.write('invalid build id')",
" self.abort(400)",
" build = model.Build.get_by_id(build_id)\n can_view = build and user.can_view_build_async(build).get_result()",
" if not can_view:\n if auth.get_current_identity().is_anonymous:",
" return self.redirect(self.create_login_url(self.request.url))",
" self.response.write('build %d not found' % build_id)\n self.abort(404)",
" return self.redirect(str(build.url))"
] |
[
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 135,
"char_start": 131,
"chars": "'inv"
},
{
"char_end": 149,
"char_start": 136,
"chars": "lid build id'"
},
{
"char_end": 395,
"char_start": 393,
"chars": "lf"
}
],
"deleted": [
{
"char_end": 109,
"char_start": 103,
"chars": " as ex"
},
{
"char_end": 144,
"char_start": 137,
"chars": "ex.mess"
},
{
"char_end": 147,
"char_start": 145,
"chars": "ge"
},
{
"char_end": 394,
"char_start": 389,
"chars": "gae_u"
},
{
"char_end": 398,
"char_start": 396,
"chars": "rs"
}
]
},
"commit_link": "github.com/asdfghjjklllllaaa/infra/commit/2f39f3df54fb79b56744f00bcf97583b3807851f",
"file_name": "appengine/cr-buildbucket/handlers.py",
"func_name": "get",
"line_changes": {
"added": [
{
"char_end": 105,
"char_start": 82,
"line": " except ValueError:\n",
"line_no": 5
},
{
"char_end": 151,
"char_start": 105,
"line": " self.response.write('invalid build id')\n",
"line_no": 6
},
{
"char_end": 432,
"char_start": 362,
"line": " return self.redirect(self.create_login_url(self.request.url))\n",
"line_no": 14
}
],
"deleted": [
{
"char_end": 111,
"char_start": 82,
"line": " except ValueError as ex:\n",
"line_no": 5
},
{
"char_end": 149,
"char_start": 111,
"line": " self.response.write(ex.message)\n",
"line_no": 6
},
{
"char_end": 435,
"char_start": 360,
"line": " return self.redirect(gae_users.create_login_url(self.request.url))\n",
"line_no": 14
}
]
},
"vul_type": "cwe-079"
}
| 148
|
cwe-079
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def index(request, is_mobile=False):\n hue_collections = DashboardController(request.user).get_search_collections()\n collection_id = request.GET.get('collection')",
" if not hue_collections or not collection_id:\n return admin_collections(request, True, is_mobile)",
" try:\n collection_doc = Document2.objects.get(id=collection_id)\n if USE_NEW_EDITOR.get():\n collection_doc.can_read_or_exception(request.user)\n else:\n collection_doc.doc.get().can_read_or_exception(request.user)\n collection = Collection2(request.user, document=collection_doc)\n except Exception, e:\n raise PopupException(e, title=_(\"Dashboard does not exist or you don't have the permission to access it.\"))",
" query = {'qs': [{'q': ''}], 'fqs': [], 'start': 0}",
" if request.method == 'GET':\n if 'q' in request.GET:",
" query['qs'][0]['q'] = request.GET.get('q')",
" if 'qd' in request.GET:",
" query['qd'] = request.GET.get('qd')",
"\n template = 'search.mako'\n if is_mobile:\n template = 'search_m.mako'",
" return render(template, request, {\n 'collection': collection,\n 'query': json.dumps(query),\n 'initial': json.dumps({\n 'collections': [],\n 'layout': DEFAULT_LAYOUT,\n 'is_latest': LATEST.get(),\n 'engines': get_engines(request.user)\n }),",
" 'is_owner': collection_doc.doc.get().can_write(request.user),",
" 'can_edit_index': can_edit_index(request.user),\n 'is_embeddable': request.GET.get('is_embeddable', False),\n 'mobile': is_mobile,\n })"
] |
[
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
0,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 850,
"char_start": 842,
"chars": "antixss("
},
{
"char_end": 874,
"char_start": 869,
"chars": ", '')"
},
{
"char_end": 932,
"char_start": 924,
"chars": "antixss("
},
{
"char_end": 957,
"char_start": 952,
"chars": ", '')"
},
{
"char_end": 1394,
"char_start": 1326,
"chars": " collection_doc.can_write(request.user) if USE_NEW_EDITOR.get() else"
}
],
"deleted": []
},
"commit_link": "github.com/gethue/hue/commit/37b529b1f9aeb5d746599a9ed4e2288cf3ad3e1d",
"file_name": "desktop/libs/dashboard/src/dashboard/views.py",
"func_name": "index",
"line_changes": {
"added": [
{
"char_end": 876,
"char_start": 814,
"line": " query['qs'][0]['q'] = antixss(request.GET.get('q', ''))\n",
"line_no": 22
},
{
"char_end": 959,
"char_start": 904,
"line": " query['qd'] = antixss(request.GET.get('qd', ''))\n",
"line_no": 24
},
{
"char_end": 1445,
"char_start": 1311,
"line": " 'is_owner': collection_doc.can_write(request.user) if USE_NEW_EDITOR.get() else collection_doc.doc.get().can_write(request.user),\n",
"line_no": 39
}
],
"deleted": [
{
"char_end": 863,
"char_start": 814,
"line": " query['qs'][0]['q'] = request.GET.get('q')\n",
"line_no": 22
},
{
"char_end": 933,
"char_start": 891,
"line": " query['qd'] = request.GET.get('qd')\n",
"line_no": 24
},
{
"char_end": 1351,
"char_start": 1285,
"line": " 'is_owner': collection_doc.doc.get().can_write(request.user),\n",
"line_no": 39
}
]
},
"vul_type": "cwe-079"
}
| 149
|
cwe-079
|
py
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"def index(request, is_mobile=False):\n hue_collections = DashboardController(request.user).get_search_collections()\n collection_id = request.GET.get('collection')",
" if not hue_collections or not collection_id:\n return admin_collections(request, True, is_mobile)",
" try:\n collection_doc = Document2.objects.get(id=collection_id)\n if USE_NEW_EDITOR.get():\n collection_doc.can_read_or_exception(request.user)\n else:\n collection_doc.doc.get().can_read_or_exception(request.user)\n collection = Collection2(request.user, document=collection_doc)\n except Exception, e:\n raise PopupException(e, title=_(\"Dashboard does not exist or you don't have the permission to access it.\"))",
" query = {'qs': [{'q': ''}], 'fqs': [], 'start': 0}",
" if request.method == 'GET':\n if 'q' in request.GET:",
" query['qs'][0]['q'] = antixss(request.GET.get('q', ''))",
" if 'qd' in request.GET:",
" query['qd'] = antixss(request.GET.get('qd', ''))",
"\n template = 'search.mako'\n if is_mobile:\n template = 'search_m.mako'",
" return render(template, request, {\n 'collection': collection,\n 'query': json.dumps(query),\n 'initial': json.dumps({\n 'collections': [],\n 'layout': DEFAULT_LAYOUT,\n 'is_latest': LATEST.get(),\n 'engines': get_engines(request.user)\n }),",
" 'is_owner': collection_doc.can_write(request.user) if USE_NEW_EDITOR.get() else collection_doc.doc.get().can_write(request.user),",
" 'can_edit_index': can_edit_index(request.user),\n 'is_embeddable': request.GET.get('is_embeddable', False),\n 'mobile': is_mobile,\n })"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
SVEN
|
{
"char_changes": {
"added": [
{
"char_end": 850,
"char_start": 842,
"chars": "antixss("
},
{
"char_end": 874,
"char_start": 869,
"chars": ", '')"
},
{
"char_end": 932,
"char_start": 924,
"chars": "antixss("
},
{
"char_end": 957,
"char_start": 952,
"chars": ", '')"
},
{
"char_end": 1394,
"char_start": 1326,
"chars": " collection_doc.can_write(request.user) if USE_NEW_EDITOR.get() else"
}
],
"deleted": []
},
"commit_link": "github.com/gethue/hue/commit/37b529b1f9aeb5d746599a9ed4e2288cf3ad3e1d",
"file_name": "desktop/libs/dashboard/src/dashboard/views.py",
"func_name": "index",
"line_changes": {
"added": [
{
"char_end": 876,
"char_start": 814,
"line": " query['qs'][0]['q'] = antixss(request.GET.get('q', ''))\n",
"line_no": 22
},
{
"char_end": 959,
"char_start": 904,
"line": " query['qd'] = antixss(request.GET.get('qd', ''))\n",
"line_no": 24
},
{
"char_end": 1445,
"char_start": 1311,
"line": " 'is_owner': collection_doc.can_write(request.user) if USE_NEW_EDITOR.get() else collection_doc.doc.get().can_write(request.user),\n",
"line_no": 39
}
],
"deleted": [
{
"char_end": 863,
"char_start": 814,
"line": " query['qs'][0]['q'] = request.GET.get('q')\n",
"line_no": 22
},
{
"char_end": 933,
"char_start": 891,
"line": " query['qd'] = request.GET.get('qd')\n",
"line_no": 24
},
{
"char_end": 1351,
"char_start": 1285,
"line": " 'is_owner': collection_doc.doc.get().can_write(request.user),\n",
"line_no": 39
}
]
},
"vul_type": "cwe-079"
}
| 149
|
cwe-079
|
py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.