func_name stringlengths 2 53 | func_src_before stringlengths 63 114k | func_src_after stringlengths 86 114k | line_changes dict | char_changes dict | commit_link stringlengths 66 117 | file_name stringlengths 5 72 | vul_type stringclasses 9
values |
|---|---|---|---|---|---|---|---|
_find_host_exhaustive | def _find_host_exhaustive(self, connector, hosts):
for host in hosts:
ssh_cmd = 'svcinfo lshost -delim ! %s' % host
out, err = self._run_ssh(ssh_cmd)
self._assert_ssh_return(len(out.strip()),
'_find_host_exhaustive',
... | def _find_host_exhaustive(self, connector, hosts):
for host in hosts:
ssh_cmd = ['svcinfo', 'lshost', '-delim', '!', host]
out, err = self._run_ssh(ssh_cmd)
self._assert_ssh_return(len(out.strip()),
'_find_host_exhaustive',
... | {
"deleted": [
{
"line_no": 3,
"char_start": 82,
"char_end": 140,
"line": " ssh_cmd = 'svcinfo lshost -delim ! %s' % host\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 82,
"char_end": 147,
"line": " ssh_cmd = ['svcinfo', 'lshost'... | {
"deleted": [
{
"char_start": 128,
"char_end": 131,
"chars": " %s"
},
{
"char_start": 132,
"char_end": 134,
"chars": " %"
}
],
"added": [
{
"char_start": 104,
"char_end": 105,
"chars": "["
},
{
"char_start": 113,
"char_... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_create_vdisk | def _create_vdisk(self, name, size, units, opts):
"""Create a new vdisk."""
LOG.debug(_('enter: _create_vdisk: vdisk %s ') % name)
model_update = None
autoex = '-autoexpand' if opts['autoexpand'] else ''
easytier = '-easytier on' if opts['easytier'] else '-easytier off'
... | def _create_vdisk(self, name, size, units, opts):
"""Create a new vdisk."""
LOG.debug(_('enter: _create_vdisk: vdisk %s ') % name)
model_update = None
easytier = 'on' if opts['easytier'] else 'off'
# Set space-efficient options
if opts['rsize'] == -1:
s... | {
"deleted": [
{
"line_no": 7,
"char_start": 181,
"char_end": 242,
"line": " autoex = '-autoexpand' if opts['autoexpand'] else ''\n"
},
{
"line_no": 8,
"char_start": 242,
"char_end": 317,
"line": " easytier = '-easytier on' if opts['easytier'] ... | {
"deleted": [
{
"char_start": 189,
"char_end": 250,
"chars": "autoex = '-autoexpand' if opts['autoexpand'] else ''\n "
},
{
"char_start": 262,
"char_end": 272,
"chars": "-easytier "
},
{
"char_start": 302,
"char_end": 312,
"chars": "-ea... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
test_invalid_iscsi_ip | def test_invalid_iscsi_ip(self):
self.flags(lock_path=self.tempdir)
#record driver set up
self.clear_mox()
_run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh)
show_port_cmd = 's... | def test_invalid_iscsi_ip(self):
self.flags(lock_path=self.tempdir)
#record driver set up
self.clear_mox()
_run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh)
show_port_cmd = ['... | {
"deleted": [
{
"line_no": 9,
"char_start": 294,
"char_end": 329,
"line": " show_port_cmd = 'showport'\n"
},
{
"line_no": 12,
"char_start": 401,
"char_end": 445,
"line": " show_port_i_cmd = 'showport -iscsi'\n"
},
{
"line_no": 16... | {
"deleted": [],
"added": [
{
"char_start": 318,
"char_end": 319,
"chars": "["
},
{
"char_start": 329,
"char_end": 330,
"chars": "]"
},
{
"char_start": 429,
"char_end": 430,
"chars": "["
},
{
"char_start": 439,
"char_end":... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/tests/test_hp3par.py | cwe-078 |
get_output | def get_output(command: str) -> bytes:
"""
Run a command and return raw output
:param str command: the command to run
:returns: the stdout output of the command
"""
return subprocess.check_output(command.split()) | def get_output(command: List[str]) -> str:
"""
Run a command and return raw output
:param str command: the command to run
:returns: the stdout output of the command
"""
result = subprocess.run(command, stdout=subprocess.PIPE, check=True)
return result.stdout.decode() | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 39,
"line": "def get_output(command: str) -> bytes:\n"
},
{
"line_no": 8,
"char_start": 186,
"char_end": 237,
"line": " return subprocess.check_output(command.split())\n"
}
],
"added": [
... | {
"deleted": [
{
"char_start": 32,
"char_end": 36,
"chars": "byte"
},
{
"char_start": 213,
"char_end": 215,
"chars": "_o"
},
{
"char_start": 217,
"char_end": 218,
"chars": "p"
},
{
"char_start": 220,
"char_end": 221,
"... | github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76 | isort/hooks.py | cwe-078 |
openscript | openscript(
char_u *name,
int directly) /* when TRUE execute directly */
{
if (curscript + 1 == NSCRIPT)
{
emsg(_(e_nesting));
return;
}
#ifdef FEAT_EVAL
if (ignore_script)
/* Not reading from script, also don't open one. Warning message? */
return;
#endif
if (scriptin[curscript] != N... | openscript(
char_u *name,
int directly) /* when TRUE execute directly */
{
if (curscript + 1 == NSCRIPT)
{
emsg(_(e_nesting));
return;
}
// Disallow sourcing a file in the sandbox, the commands would be executed
// later, possibly outside of the sandbox.
if (check_secure())
return;
... | {
"deleted": [],
"added": [
{
"line_no": 10,
"char_start": 160,
"char_end": 161,
"line": "\n"
},
{
"line_no": 13,
"char_start": 287,
"char_end": 311,
"line": " if (check_secure())\n"
},
{
"line_no": 14,
"char_start": 311,
"char... | {
"deleted": [],
"added": [
{
"char_start": 160,
"char_end": 321,
"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"
}
]
} | github.com/vim/vim/commit/53575521406739cf20bbe4e384d88e7dca11f040 | src/getchar.c | cwe-078 |
add_user | def add_user(username, password):
encPass = crypt.crypt(password,"22")
os.system("useradd -G docker,wheel -p "+encPass+" "+username) | def add_user(username, password):
encPass = crypt.crypt(password,"22")
#subprocess escapes the username stopping code injection
subprocess.call(['useradd','-G','docker,wheel','-p',encPass,username]) | {
"deleted": [
{
"line_no": 3,
"char_start": 75,
"char_end": 140,
"line": " os.system(\"useradd -G docker,wheel -p \"+encPass+\" \"+username)\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 136,
"char_end": 210,
"line": " subprocess.call(['useradd... | {
"deleted": [
{
"char_start": 81,
"char_end": 82,
"chars": "."
},
{
"char_start": 83,
"char_end": 84,
"chars": "y"
},
{
"char_start": 89,
"char_end": 90,
"chars": "\""
},
{
"char_start": 97,
"char_end": 98,
"chars": "... | github.com/Internet-of-People/titania-os/commit/9b7805119938343fcac9dc929d8882f1d97cf14a | vuedj/configtitania/views.py | cwe-078 |
write_section | def write_section(self, section_name, section_data):
self.write_line("")
self.write_line("define %s {" % section_name)
sorted_keys = section_data.keys()
sorted_keys.sort()
for key in sorted_keys:
value = section_data[key]
self.icinga_lines.append(("%s%... | def write_section(self, section_name, section_data):
self.write_line("")
self.write_line("define %s {" % section_name)
sorted_keys = section_data.keys()
sorted_keys.sort()
for key in sorted_keys:
value = self.value_to_icinga(section_data[key])
icinga_l... | {
"deleted": [
{
"line_no": 7,
"char_start": 240,
"char_end": 278,
"line": " value = section_data[key]\n"
},
{
"line_no": 8,
"char_start": 278,
"char_end": 380,
"line": " self.icinga_lines.append((\"%s%-45s%s\" % (self.indent, key, self... | {
"deleted": [
{
"char_start": 290,
"char_end": 295,
"chars": "self."
},
{
"char_start": 306,
"char_end": 316,
"chars": "s.append(("
},
{
"char_start": 349,
"char_end": 350,
"chars": "s"
},
{
"char_start": 351,
"char_end": 3... | github.com/Scout24/monitoring-config-generator/commit/a4b01b72d2e3d6ec2600c384a77f675fa9bbf6b7 | src/main/python/monitoring_config_generator/MonitoringConfigGenerator.py | cwe-078 |
_update_volume_stats | def _update_volume_stats(self):
"""Retrieve stats info from volume group."""
LOG.debug(_("Updating volume stats"))
data = {}
data['vendor_name'] = 'IBM'
data['driver_version'] = '1.1'
data['storage_protocol'] = list(self._enabled_protocols)
data['total_capa... | def _update_volume_stats(self):
"""Retrieve stats info from volume group."""
LOG.debug(_("Updating volume stats"))
data = {}
data['vendor_name'] = 'IBM'
data['driver_version'] = '1.1'
data['storage_protocol'] = list(self._enabled_protocols)
data['total_capa... | {
"deleted": [
{
"line_no": 18,
"char_start": 584,
"char_end": 630,
"line": " ssh_cmd = 'svcinfo lssystem -delim !'\n"
},
{
"line_no": 30,
"char_start": 1179,
"char_end": 1244,
"line": " ssh_cmd = 'svcinfo lsmdiskgrp -bytes -delim ! %s' % pool\... | {
"deleted": [
{
"char_start": 1232,
"char_end": 1235,
"chars": " %s"
},
{
"char_start": 1236,
"char_end": 1238,
"chars": " %"
}
],
"added": [
{
"char_start": 602,
"char_end": 603,
"chars": "["
},
{
"char_start": 611,
"c... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
test_create_modify_host | def test_create_modify_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain",
... | def test_create_modify_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain",
... | {
"deleted": [
{
"line_no": 13,
"char_start": 504,
"char_end": 557,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n"
},
{
"line_no": 16,
"char_start": 635,
"char_end": 690,
"line": " create_host_cmd = ('createhost -add fakehost '\n"
... | {
"deleted": [
{
"char_start": 661,
"char_end": 662,
"chars": "("
},
{
"char_start": 728,
"char_end": 744,
"chars": "12345 1234567890"
},
{
"char_start": 750,
"char_end": 751,
"chars": ")"
}
],
"added": [
{
"char_start": 528,
... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/tests/test_hp3par.py | cwe-078 |
install | def install(filename, target):
'''Run a package's installer script against the given target directory.'''
print(' Unpacking %s...' % filename)
os.system('tar xf ' + filename)
basename = filename.split('.tar')[0]
print(' Installing %s...' % basename)
install_opts = '--prefix=${PWD}/%s --disable-ldconfig' % t... | def install(filename, target):
'''Run a package's installer script against the given target directory.'''
print(' Unpacking %s...' % filename)
subprocess.check_call(['tar', 'xf', filename])
basename = filename.split('.tar')[0]
print(' Installing %s...' % basename)
install_cmd = [os.path.join(basename, 'inst... | {
"deleted": [
{
"line_no": 4,
"char_start": 147,
"char_end": 181,
"line": " os.system('tar xf ' + filename)\n"
},
{
"line_no": 7,
"char_start": 260,
"char_end": 326,
"line": " install_opts = '--prefix=${PWD}/%s --disable-ldconfig' % target\n"
},
{... | {
"deleted": [
{
"char_start": 149,
"char_end": 150,
"chars": "o"
},
{
"char_start": 151,
"char_end": 152,
"chars": "."
},
{
"char_start": 153,
"char_end": 154,
"chars": "y"
},
{
"char_start": 155,
"char_end": 156,
"ch... | github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb | repack_rust.py | cwe-078 |
_get_least_used_nsp | def _get_least_used_nsp(self, nspss):
""""Return the nsp that has the fewest active vluns."""
# return only the nsp (node:server:port)
result = self.common._cli_run('showvlun -a -showcols Port', None)
# count the number of nsps (there is 1 for each active vlun)
nsp_counts = ... | def _get_least_used_nsp(self, nspss):
""""Return the nsp that has the fewest active vluns."""
# return only the nsp (node:server:port)
result = self.common._cli_run(['showvlun', '-a', '-showcols', 'Port'])
# count the number of nsps (there is 1 for each active vlun)
nsp_coun... | {
"deleted": [
{
"line_no": 4,
"char_start": 155,
"char_end": 229,
"line": " result = self.common._cli_run('showvlun -a -showcols Port', None)\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 155,
"char_end": 234,
"line": " result = self.co... | {
"deleted": [
{
"char_start": 221,
"char_end": 227,
"chars": ", None"
}
],
"added": [
{
"char_start": 193,
"char_end": 194,
"chars": "["
},
{
"char_start": 203,
"char_end": 205,
"chars": "',"
},
{
"char_start": 206,
"ch... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_iscsi.py | cwe-078 |
_start_fc_map | def _start_fc_map(self, fc_map_id, source, target):
try:
out, err = self._run_ssh('svctask startfcmap %s' % fc_map_id)
except exception.ProcessExecutionError as e:
with excutils.save_and_reraise_exception():
LOG.error(_('_start_fc_map: Failed to start FlashCop... | def _start_fc_map(self, fc_map_id, source, target):
try:
out, err = self._run_ssh(['svctask', 'startfcmap', fc_map_id])
except exception.ProcessExecutionError as e:
with excutils.save_and_reraise_exception():
LOG.error(_('_start_fc_map: Failed to start FlashCo... | {
"deleted": [
{
"line_no": 3,
"char_start": 69,
"char_end": 143,
"line": " out, err = self._run_ssh('svctask startfcmap %s' % fc_map_id)\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 69,
"char_end": 144,
"line": " out, err = sel... | {
"deleted": [
{
"char_start": 125,
"char_end": 128,
"chars": " %s"
},
{
"char_start": 129,
"char_end": 131,
"chars": " %"
}
],
"added": [
{
"char_start": 106,
"char_end": 107,
"chars": "["
},
{
"char_start": 115,
"char_... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
resolve_hostname | @then(parsers.parse("the hostname '{hostname}' should be resolved"))
def resolve_hostname(busybox_pod, host, hostname):
with host.sudo():
# test dns resolve
cmd_nslookup = ("kubectl --kubeconfig=/etc/kubernetes/admin.conf"
" exec -ti {0} nslookup {1}".format(
... | @then(parsers.parse("the hostname '{hostname}' should be resolved"))
def resolve_hostname(busybox_pod, host, hostname):
with host.sudo():
# test dns resolve
result = host.run(
"kubectl --kubeconfig=/etc/kubernetes/admin.conf "
"exec -ti %s nslookup %s",
busybox_po... | {
"deleted": [
{
"line_no": 3,
"char_start": 120,
"char_end": 146,
"line": " with host.sudo():\n"
},
{
"line_no": 5,
"char_start": 177,
"char_end": 255,
"line": " cmd_nslookup = (\"kubectl --kubeconfig=/etc/kubernetes/admin.conf\"\n"
},... | {
"deleted": [
{
"char_start": 124,
"char_end": 128,
"chars": " "
},
{
"char_start": 146,
"char_end": 150,
"chars": " "
},
{
"char_start": 189,
"char_end": 201,
"chars": "cmd_nslookup"
},
{
"char_start": 202,
"char_end... | github.com/scality/metalk8s/commit/82d92836d4ff78c623a0e06302c94cfa5ff79908 | tests/post/steps/test_dns.py | cwe-078 |
_modify_3par_fibrechan_host | 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'
% (hostname, " ".join(wwn)), None) | def _modify_3par_fibrechan_host(self, hostname, wwns):
# when using -add, you can not send the persona or domain options
command = ['createhost', '-add', hostname]
for wwn in wwns:
command.append(wwn)
out = self.common._cli_run(command) | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 58,
"line": " def _modify_3par_fibrechan_host(self, hostname, wwn):\n"
},
{
"line_no": 3,
"char_start": 132,
"char_end": 191,
"line": " out = self.common._cli_run('createhost -add %s %s'\n... | {
"deleted": [
{
"char_start": 58,
"char_end": 58,
"chars": ""
},
{
"char_start": 140,
"char_end": 151,
"chars": "out = self."
},
{
"char_start": 155,
"char_end": 156,
"chars": "o"
},
{
"char_start": 157,
"char_end": 167,
... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_fc.py | cwe-078 |
test_settings_path_skip_issue_909 | def test_settings_path_skip_issue_909(tmpdir):
base_dir = tmpdir.mkdir('project')
config_dir = base_dir.mkdir('conf')
config_dir.join('.isort.cfg').write('[isort]\n'
'skip =\n'
' file_to_be_skipped.py\n'
... | def test_settings_path_skip_issue_909(tmpdir):
base_dir = tmpdir.mkdir('project')
config_dir = base_dir.mkdir('conf')
config_dir.join('.isort.cfg').write('[isort]\n'
'skip =\n'
' file_to_be_skipped.py\n'
... | {
"deleted": [
{
"line_no": 24,
"char_start": 1201,
"char_end": 1249,
"line": " check_output(['isort', '--check-only'])\n"
},
{
"line_no": 25,
"char_start": 1249,
"char_end": 1338,
"line": " results = check_output(['isort', '--check-only', '--setti... | {
"deleted": [
{
"char_start": 1209,
"char_end": 1216,
"chars": "check_o"
},
{
"char_start": 1217,
"char_end": 1218,
"chars": "t"
},
{
"char_start": 1220,
"char_end": 1221,
"chars": "t"
},
{
"char_start": 1259,
"char_end": 1... | github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76 | test_isort.py | cwe-078 |
_create_3par_fibrechan_host | 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
the same wwn but with a different hostname, return the hostname
used by 3PAR.
"""
out = self.common._cli_... | 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
the same wwn but with a different hostname, return the hostname
used by 3PAR.
"""
command = ['createhost... | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 78,
"line": " def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):\n"
},
{
"line_no": 8,
"char_start": 289,
"char_end": 366,
"line": " out = self.common._cli_run('crea... | {
"deleted": [
{
"char_start": 297,
"char_end": 308,
"chars": "out = self."
},
{
"char_start": 312,
"char_end": 313,
"chars": "o"
},
{
"char_start": 314,
"char_end": 324,
"chars": "._cli_run("
},
{
"char_start": 345,
"char_e... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_fc.py | cwe-078 |
take_bug_report | def take_bug_report(self, test_name, begin_time):
"""Takes a bug report on the device and stores it in a file.
Args:
test_name: Name of the test case that triggered this bug report.
begin_time: Logline format timestamp taken when the test started.
"""
new_br ... | def take_bug_report(self, test_name, begin_time):
"""Takes a bug report on the device and stores it in a file.
Args:
test_name: Name of the test case that triggered this bug report.
begin_time: Logline format timestamp taken when the test started.
"""
new_br ... | {
"deleted": [
{
"line_no": 33,
"char_start": 1526,
"char_end": 1592,
"line": " self.adb.pull('%s %s' % (br_out_path, full_out_path))\n"
},
{
"line_no": 35,
"char_start": 1606,
"char_end": 1662,
"line": " self.adb.bugreport(' > %s' % fu... | {
"deleted": [
{
"char_start": 1552,
"char_end": 1563,
"chars": "'%s %s' % ("
},
{
"char_start": 1589,
"char_end": 1590,
"chars": ")"
}
],
"added": [
{
"char_start": 1552,
"char_end": 1553,
"chars": "["
},
{
"char_start": 1579... | github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee | mobly/controllers/android_device.py | cwe-078 |
test_create_invalid_host | def test_create_invalid_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain",
... | def test_create_invalid_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain",
... | {
"deleted": [
{
"line_no": 13,
"char_start": 505,
"char_end": 558,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n"
},
{
"line_no": 16,
"char_start": 639,
"char_end": 706,
"line": " create_host_cmd = ('createhost -iscsi -persona 1 -do... | {
"deleted": [
{
"char_start": 703,
"char_end": 704,
"chars": " "
},
{
"char_start": 733,
"char_end": 734,
"chars": "'"
},
{
"char_start": 735,
"char_end": 736,
"chars": "\\"
},
{
"char_start": 746,
"char_end": 747,
"c... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/tests/test_hp3par.py | cwe-078 |
__getattr__.adb_call | def adb_call(*args):
clean_name = name.replace('_', '-')
arg_str = ' '.join(str(elem) for elem in args)
return self._exec_adb_cmd(clean_name, arg_str) | def adb_call(args=None, shell=False):
"""Wrapper for an ADB command.
Args:
args: string or list of strings, arguments to the adb command.
See subprocess.Proc() documentation.
shell: bool, True to run this command through the system she... | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 29,
"line": " def adb_call(*args):\n"
},
{
"line_no": 3,
"char_start": 77,
"char_end": 136,
"line": " arg_str = ' '.join(str(elem) for elem in args)\n"
},
{
"line_no"... | {
"deleted": [
{
"char_start": 21,
"char_end": 22,
"chars": "*"
},
{
"char_start": 42,
"char_end": 44,
"chars": "le"
},
{
"char_start": 46,
"char_end": 47,
"chars": "_"
},
{
"char_start": 52,
"char_end": 53,
"chars": "... | github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee | mobly/controllers/android_device_lib/adb.py | cwe-078 |
test_skip_paths_issue_938 | def test_skip_paths_issue_938(tmpdir):
base_dir = tmpdir.mkdir('project')
config_dir = base_dir.mkdir('conf')
config_dir.join('.isort.cfg').write('[isort]\n'
'line_length = 88\n'
'multi_line_output = 4\n'
... | def test_skip_paths_issue_938(tmpdir):
base_dir = tmpdir.mkdir('project')
config_dir = base_dir.mkdir('conf')
config_dir.join('.isort.cfg').write('[isort]\n'
'line_length = 88\n'
'multi_line_output = 4\n'
... | {
"deleted": [
{
"line_no": 25,
"char_start": 1187,
"char_end": 1273,
"line": " results = check_output(['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n"
},
{
"line_no": 28,
"char_start": 1312,
"char_end": 1357,
"line": " assert b'skipped' n... | {
"deleted": [
{
"char_start": 1197,
"char_end": 1198,
"chars": "s"
},
{
"char_start": 1202,
"char_end": 1203,
"chars": "h"
},
{
"char_start": 1204,
"char_end": 1211,
"chars": "ck_outp"
},
{
"char_start": 1212,
"char_end": 1... | github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76 | test_isort.py | cwe-078 |
_ensure_vdisk_no_fc_mappings | def _ensure_vdisk_no_fc_mappings(self, name, allow_snaps=True):
# Ensure vdisk has no FlashCopy mappings
mapping_ids = self._get_vdisk_fc_mappings(name)
while len(mapping_ids):
wait_for_copy = False
for map_id in mapping_ids:
attrs = self._get_flashcop... | def _ensure_vdisk_no_fc_mappings(self, name, allow_snaps=True):
# Ensure vdisk has no FlashCopy mappings
mapping_ids = self._get_vdisk_fc_mappings(name)
while len(mapping_ids):
wait_for_copy = False
for map_id in mapping_ids:
attrs = self._get_flashcop... | {
"deleted": [
{
"line_no": 20,
"char_start": 820,
"char_end": 887,
"line": " ssh_cmd = ('svctask chfcmap -copyrate 50 '\n"
},
{
"line_no": 21,
"char_start": 887,
"char_end": 952,
"line": " '-autodelet... | {
"deleted": [
{
"char_start": 854,
"char_end": 855,
"chars": "("
},
{
"char_start": 884,
"char_end": 885,
"chars": " "
},
{
"char_start": 937,
"char_end": 940,
"chars": " %s"
},
{
"char_start": 941,
"char_end": 943,
"... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
tcp_forward | def tcp_forward(self, host_port, device_port):
"""Starts tcp forwarding.
Args:
host_port: Port number to use on the computer.
device_port: Port number to use on the android device.
"""
self.forward('tcp:%d tcp:%d' % (host_port, device_port)) | def tcp_forward(self, host_port, device_port):
"""Starts tcp forwarding.
Args:
host_port: Port number to use on the computer.
device_port: Port number to use on the android device.
"""
self.forward(['tcp:%d' % host_port, 'tcp:%d' % device_port]) | {
"deleted": [
{
"line_no": 8,
"char_start": 238,
"char_end": 302,
"line": " self.forward('tcp:%d tcp:%d' % (host_port, device_port))\n"
}
],
"added": [
{
"line_no": 8,
"char_start": 238,
"char_end": 306,
"line": " self.forward(['tcp:%d' % ... | {
"deleted": [
{
"char_start": 266,
"char_end": 273,
"chars": " tcp:%d"
},
{
"char_start": 277,
"char_end": 278,
"chars": "("
},
{
"char_start": 300,
"char_end": 301,
"chars": ")"
}
],
"added": [
{
"char_start": 259,
"ch... | github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee | mobly/controllers/android_device_lib/adb.py | cwe-078 |
repack | def repack(host, targets, channel='stable'):
url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'
req = requests.get(url)
req.raise_for_status()
manifest = toml.loads(req.content)
if manifest['manifest-version'] != '2':
print('ERROR: unrecognized manifest version %s.' % manifest['ma... | def repack(host, targets, channel='stable'):
print("Repacking rust for %s..." % host)
url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'
req = requests.get(url)
req.raise_for_status()
manifest = toml.loads(req.content)
if manifest['manifest-version'] != '2':
print('ERROR: unreco... | {
"deleted": [
{
"line_no": 28,
"char_start": 1161,
"char_end": 1200,
"line": " os.system('rm -rf %s' % install_dir)\n"
},
{
"line_no": 34,
"char_start": 1424,
"char_end": 1493,
"line": " os.system('tar cjf %s.tar.bz2 %s/*' % (tar_basename, install_dir))\n... | {
"deleted": [
{
"char_start": 1166,
"char_end": 1170,
"chars": "syst"
},
{
"char_start": 1171,
"char_end": 1172,
"chars": "m"
},
{
"char_start": 1180,
"char_end": 1183,
"chars": " %s"
},
{
"char_start": 1184,
"char_end": 11... | github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb | repack_rust.py | cwe-078 |
extend_volume | def extend_volume(self, volume, new_size):
volume_name = self._get_3par_vol_name(volume['id'])
old_size = volume.size
growth_size = int(new_size) - old_size
LOG.debug("Extending Volume %s from %s to %s, by %s GB." %
(volume_name, old_size, new_size, growth_size))
... | def extend_volume(self, volume, new_size):
volume_name = self._get_3par_vol_name(volume['id'])
old_size = volume.size
growth_size = int(new_size) - old_size
LOG.debug("Extending Volume %s from %s to %s, by %s GB." %
(volume_name, old_size, new_size, growth_size))
... | {
"deleted": [
{
"line_no": 8,
"char_start": 331,
"char_end": 406,
"line": " self._cli_run(\"growvv -f %s %sg\" % (volume_name, growth_size),\n"
},
{
"line_no": 9,
"char_start": 406,
"char_end": 438,
"line": " None)\n"
... | {
"deleted": [
{
"char_start": 357,
"char_end": 358,
"chars": "\""
},
{
"char_start": 367,
"char_end": 375,
"chars": " %s %sg\""
},
{
"char_start": 376,
"char_end": 379,
"chars": "% ("
},
{
"char_start": 403,
"char_end": 436... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
_remove_volume_set | def _remove_volume_set(self, vvs_name):
# Must first clear the QoS rules before removing the volume set
self._cli_run('setqos -clear vvset:%s' % (vvs_name), None)
self._cli_run('removevvset -f %s' % (vvs_name), None) | def _remove_volume_set(self, vvs_name):
# Must first clear the QoS rules before removing the volume set
self._cli_run(['setqos', '-clear', 'vvset:%s' % (vvs_name)])
self._cli_run(['removevvset', '-f', vvs_name]) | {
"deleted": [
{
"line_no": 3,
"char_start": 116,
"char_end": 183,
"line": " self._cli_run('setqos -clear vvset:%s' % (vvs_name), None)\n"
},
{
"line_no": 4,
"char_start": 183,
"char_end": 244,
"line": " self._cli_run('removevvset -f %s' % (vvs... | {
"deleted": [
{
"char_start": 175,
"char_end": 181,
"chars": ", None"
},
{
"char_start": 220,
"char_end": 223,
"chars": " %s"
},
{
"char_start": 224,
"char_end": 226,
"chars": " %"
},
{
"char_start": 227,
"char_end": 228,
... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
_get_3par_hostname_from_wwn_iqn | 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
# string. So, if necessary, create a list to loop.
if not isinstance(wwns_iqn, list):
wwn_iqn_list = [wwns_iqn]
else:
... | 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
# string. So, if necessary, create a list to loop.
if not isinstance(wwns_iqn, list):
wwn_iqn_list = [wwns_iqn]
else:
... | {
"deleted": [
{
"line_no": 2,
"char_start": 57,
"char_end": 106,
"line": " out = self._cli_run('showhost -d', None)\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 57,
"char_end": 105,
"line": " out = self._cli_run(['showhost', '-d'])\n"
... | {
"deleted": [
{
"char_start": 98,
"char_end": 104,
"chars": ", None"
}
],
"added": [
{
"char_start": 85,
"char_end": 86,
"chars": "["
},
{
"char_start": 95,
"char_end": 97,
"chars": "',"
},
{
"char_start": 98,
"char_end... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
get_ports | def get_ports(self):
# First get the active FC ports
out = self._cli_run('showport', None)
# strip out header
# N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type,
# Protocol,Label,Partner,FailoverState
out = out[1:len(out) - 2]
ports = {'FC': [], 'iS... | def get_ports(self):
# First get the active FC ports
out = self._cli_run(['showport'])
# strip out header
# N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type,
# Protocol,Label,Partner,FailoverState
out = out[1:len(out) - 2]
ports = {'FC': [], 'iSCSI'... | {
"deleted": [
{
"line_no": 3,
"char_start": 65,
"char_end": 111,
"line": " out = self._cli_run('showport', None)\n"
},
{
"line_no": 20,
"char_start": 603,
"char_end": 656,
"line": " out = self._cli_run('showport -iscsi', None)\n"
},
{
... | {
"deleted": [
{
"char_start": 103,
"char_end": 109,
"chars": ", None"
},
{
"char_start": 648,
"char_end": 654,
"chars": ", None"
},
{
"char_start": 1083,
"char_end": 1089,
"chars": ", None"
}
],
"added": [
{
"char_start": 93,... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
test_get_least_used_nsp | def test_get_least_used_nsp(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
_run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh)
show_vlun_cmd = 'showvlun -a -... | def test_get_least_used_nsp(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
_run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh)
show_vlun_cmd = ['showvlun', '... | {
"deleted": [
{
"line_no": 9,
"char_start": 282,
"char_end": 335,
"line": " show_vlun_cmd = 'showvlun -a -showcols Port'\n"
}
],
"added": [
{
"line_no": 9,
"char_start": 282,
"char_end": 346,
"line": " show_vlun_cmd = ['showvlun', '-a', '-... | {
"deleted": [],
"added": [
{
"char_start": 306,
"char_end": 307,
"chars": "["
},
{
"char_start": 316,
"char_end": 318,
"chars": "',"
},
{
"char_start": 319,
"char_end": 320,
"chars": "'"
},
{
"char_start": 322,
"char_end"... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/tests/test_hp3par.py | cwe-078 |
_cmd_to_dict | def _cmd_to_dict(self, cmd):
arg_list = cmd.split()
no_param_args = [
'autodelete',
'autoexpand',
'bytes',
'compressed',
'force',
'nohdr',
]
one_param_args = [
'chapsecret',
'cleanrate',
... | def _cmd_to_dict(self, arg_list):
no_param_args = [
'autodelete',
'autoexpand',
'bytes',
'compressed',
'force',
'nohdr',
]
one_param_args = [
'chapsecret',
'cleanrate',
'copyrate',
... | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 33,
"line": " def _cmd_to_dict(self, cmd):\n"
}
],
"added": [
{
"line_no": 1,
"char_start": 0,
"char_end": 38,
"line": " def _cmd_to_dict(self, arg_list):\n"
}
]
} | {
"deleted": [
{
"char_start": 27,
"char_end": 41,
"chars": "cmd):\n "
},
{
"char_start": 49,
"char_end": 62,
"chars": " = cmd.split("
}
],
"added": [
{
"char_start": 36,
"char_end": 37,
"chars": ":"
}
]
} | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/tests/test_storwize_svc.py | cwe-078 |
_cli_run | def _cli_run(self, verb, cli_args):
"""Runs a CLI command over SSH, without doing any result parsing."""
cli_arg_strings = []
if cli_args:
for k, v in cli_args.items():
if k == '':
cli_arg_strings.append(" %s" % k)
else:
... | 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
tmp = stdout.split("\r\n")
out = tmp[5:len(tmp... | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 40,
"line": " def _cli_run(self, verb, cli_args):\n"
},
{
"line_no": 3,
"char_start": 117,
"char_end": 146,
"line": " cli_arg_strings = []\n"
},
{
"line_no": 4,
"char_s... | {
"deleted": [
{
"char_start": 23,
"char_end": 29,
"chars": "verb, "
},
{
"char_start": 30,
"char_end": 37,
"chars": "li_args"
},
{
"char_start": 116,
"char_end": 421,
"chars": "\n cli_arg_strings = []\n if cli_args:\n ... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
_call_external_zip | def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):
# XXX see if we want to keep an external call here
if verbose:
zipoptions = "-r"
else:
zipoptions = "-rq"
from distutils.errors import DistutilsExecError
from distutils.spawn import spawn
try:
s... | def _call_external_zip(base_dir, zip_filename, verbose, dry_run, logger):
# XXX see if we want to keep an external call here
if verbose:
zipoptions = "-r"
else:
zipoptions = "-rq"
cmd = ["zip", zipoptions, zip_filename, base_dir]
if logger is not None:
logger.info(' '.join(cm... | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 78,
"line": "def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):\n"
},
{
"line_no": 7,
"char_start": 212,
"char_end": 264,
"line": " from distutils.errors import Distuti... | {
"deleted": [
{
"char_start": 54,
"char_end": 60,
"chars": "=False"
},
{
"char_start": 69,
"char_end": 72,
"chars": "=Fa"
},
{
"char_start": 73,
"char_end": 74,
"chars": "s"
},
{
"char_start": 216,
"char_end": 219,
"c... | github.com/python/cpython/commit/add531a1e55b0a739b0f42582f1c9747e5649ace | Lib/shutil.py | cwe-078 |
_create_host | def _create_host(self, connector):
"""Create a new host on the storage system.
We create a host name and associate it with the given connection
information.
"""
LOG.debug(_('enter: _create_host: host %s') % connector['host'])
rand_id = str(random.randint(0, 999999... | def _create_host(self, connector):
"""Create a new host on the storage system.
We create a host name and associate it with the given connection
information.
"""
LOG.debug(_('enter: _create_host: host %s') % connector['host'])
rand_id = str(random.randint(0, 999999... | {
"deleted": [
{
"line_no": 26,
"char_start": 916,
"char_end": 993,
"line": " ssh_cmd = ('svctask mkhost -force %(port1)s -name \"%(host_name)s\"' %\n"
},
{
"line_no": 27,
"char_start": 993,
"char_end": 1054,
"line": " {'port1': port... | {
"deleted": [
{
"char_start": 934,
"char_end": 935,
"chars": "("
},
{
"char_start": 958,
"char_end": 962,
"chars": "%(po"
},
{
"char_start": 963,
"char_end": 969,
"chars": "t1)s -"
},
{
"char_start": 974,
"char_end": 981,
... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_get_iscsi_ip_addrs | def _get_iscsi_ip_addrs(self):
generator = self._port_conf_generator('svcinfo lsportip')
header = next(generator, None)
if not header:
return
for port_data in generator:
try:
port_node_id = port_data['node_id']
port_ipv4 = port... | def _get_iscsi_ip_addrs(self):
generator = self._port_conf_generator(['svcinfo', 'lsportip'])
header = next(generator, None)
if not header:
return
for port_data in generator:
try:
port_node_id = port_data['node_id']
port_ipv4 =... | {
"deleted": [
{
"line_no": 2,
"char_start": 35,
"char_end": 101,
"line": " generator = self._port_conf_generator('svcinfo lsportip')\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 35,
"char_end": 106,
"line": " generator = self._port_con... | {
"deleted": [],
"added": [
{
"char_start": 81,
"char_end": 82,
"chars": "["
},
{
"char_start": 90,
"char_end": 92,
"chars": "',"
},
{
"char_start": 93,
"char_end": 94,
"chars": "'"
},
{
"char_start": 103,
"char_end": 104,... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
talk | def talk(myText):
if( myText.find( "twitter" ) >= 0 ):
myText += "0"
myText = myText[7:-1]
try:
myText = twitter.getTweet( myText )
except:
print( "!!!ERROR: INVALID TWITTER CREDENTIALS. Please read README.md for instructions.")
return
os.system( "es... | def talk(myText):
if( myText.find( "twitter" ) >= 0 ):
myText += "0"
myText = myText[7:-1]
try:
myText = twitter.getTweet( myText )
except:
print( "!!!ERROR: INVALID TWITTER CREDENTIALS. Please read README.md for instructions.")
return
os.system( "es... | {
"deleted": [
{
"line_no": 13,
"char_start": 441,
"char_end": 508,
"line": " os.system( \"espeak -w speech.wav \\\"\" + myText + \"\\\" -s 130\" )\r\n"
}
],
"added": [
{
"line_no": 13,
"char_start": 441,
"char_end": 515,
"line": " subprocess.call(... | {
"deleted": [
{
"char_start": 447,
"char_end": 448,
"chars": "."
},
{
"char_start": 449,
"char_end": 454,
"chars": "ystem"
},
{
"char_start": 455,
"char_end": 456,
"chars": " "
},
{
"char_start": 477,
"char_end": 479,
... | github.com/ntc-chip-revived/ChippyRuxpin/commit/0cd7d78e4d806852fd75fee03c24cce322f76014 | chippyRuxpin.py | cwe-078 |
_exec_cmd | def _exec_cmd(self, cmd):
"""Executes adb commands in a new shell.
This is specific to executing adb binary because stderr is not a good
indicator of cmd execution status.
Args:
cmds: A string that is the adb command to execute.
Returns:
The output ... | def _exec_cmd(self, args, shell):
"""Executes adb commands.
Args:
args: string or list of strings, program arguments.
See subprocess.Popen() documentation.
shell: bool, True to run this command through the system shell,
False to invoke it dire... | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 30,
"line": " def _exec_cmd(self, cmd):\n"
},
{
"line_no": 8,
"char_start": 216,
"char_end": 279,
"line": " cmds: A string that is the adb command to execute.\n"
},
{
"li... | {
"deleted": [
{
"char_start": 24,
"char_end": 27,
"chars": "cmd"
},
{
"char_start": 63,
"char_end": 65,
"chars": "in"
},
{
"char_start": 66,
"char_end": 67,
"chars": "a"
},
{
"char_start": 68,
"char_end": 71,
"chars":... | github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee | mobly/controllers/android_device_lib/adb.py | cwe-078 |
_get_conn_fc_wwpns | def _get_conn_fc_wwpns(self, host_name):
wwpns = []
cmd = 'svcinfo lsfabric -host %s' % host_name
generator = self._port_conf_generator(cmd)
header = next(generator, None)
if not header:
return wwpns
for port_data in generator:
try:
... | def _get_conn_fc_wwpns(self, host_name):
wwpns = []
cmd = ['svcinfo', 'lsfabric', '-host', host_name]
generator = self._port_conf_generator(cmd)
header = next(generator, None)
if not header:
return wwpns
for port_data in generator:
try:
... | {
"deleted": [
{
"line_no": 3,
"char_start": 64,
"char_end": 118,
"line": " cmd = 'svcinfo lsfabric -host %s' % host_name\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 64,
"char_end": 122,
"line": " cmd = ['svcinfo', 'lsfabric', '-host',... | {
"deleted": [
{
"char_start": 101,
"char_end": 104,
"chars": " %s"
},
{
"char_start": 105,
"char_end": 107,
"chars": " %"
}
],
"added": [
{
"char_start": 78,
"char_end": 79,
"chars": "["
},
{
"char_start": 87,
"char_end... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_create_3par_iscsi_host | def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):
"""Create a 3PAR host.
Create a 3PAR host, if there is already a host on the 3par using
the same iqn but with a different hostname, return the hostname
used by 3PAR.
"""
cmd = 'createhost -is... | def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):
"""Create a 3PAR host.
Create a 3PAR host, if there is already a host on the 3par using
the same iqn but with a different hostname, return the hostname
used by 3PAR.
"""
cmd = ['createhost', ... | {
"deleted": [
{
"line_no": 8,
"char_start": 291,
"char_end": 358,
"line": " cmd = 'createhost -iscsi -persona %s -domain %s %s %s' % \\\n"
},
{
"line_no": 9,
"char_start": 358,
"char_end": 414,
"line": " (persona_id, domain, hostname, is... | {
"deleted": [
{
"char_start": 333,
"char_end": 334,
"chars": "%"
},
{
"char_start": 343,
"char_end": 352,
"chars": " %s %s %s"
},
{
"char_start": 353,
"char_end": 357,
"chars": " % \\"
},
{
"char_start": 372,
"char_end": 38... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_iscsi.py | cwe-078 |
_delete_3par_host | def _delete_3par_host(self, hostname):
self._cli_run('removehost %s' % hostname, None) | def _delete_3par_host(self, hostname):
self._cli_run(['removehost', hostname]) | {
"deleted": [
{
"line_no": 2,
"char_start": 43,
"char_end": 98,
"line": " self._cli_run('removehost %s' % hostname, None)\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 43,
"char_end": 90,
"line": " self._cli_run(['removehost', hostname]... | {
"deleted": [
{
"char_start": 76,
"char_end": 79,
"chars": " %s"
},
{
"char_start": 80,
"char_end": 82,
"chars": " %"
},
{
"char_start": 91,
"char_end": 97,
"chars": ", None"
}
],
"added": [
{
"char_start": 65,
"char_en... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
process_statistics | def process_statistics(self, metadata, _):
args = [metadata.hostname, '-p', metadata.profile, '-g',
':'.join([g for g in metadata.groups])]
for notifier in os.listdir(self.data):
if ((notifier[-1] == '~') or
(notifier[:2] == '.#') or
(notif... | def process_statistics(self, metadata, _):
args = [metadata.hostname, '-p', metadata.profile, '-g',
':'.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)
... | {
"deleted": [
{
"line_no": 10,
"char_start": 425,
"char_end": 472,
"line": " npath = self.data + '/' + notifier\n"
},
{
"line_no": 11,
"char_start": 472,
"char_end": 545,
"line": " self.logger.debug(\"Running %s %s\" % (npath, \" \".jo... | {
"deleted": [
{
"char_start": 454,
"char_end": 462,
"chars": " + '/' +"
},
{
"char_start": 489,
"char_end": 557,
"chars": "logger.debug(\"Running %s %s\" % (npath, \" \".join(args)))\n "
},
{
"char_start": 572,
"char_end": 573,
"cha... | github.com/Bcfg2/bcfg2/commit/a524967e8d5c4c22e49cd619aed20c87a316c0be | src/lib/Server/Plugins/Trigger.py | cwe-078 |
_delete_host | def _delete_host(self, host_name):
"""Delete a host on the storage system."""
LOG.debug(_('enter: _delete_host: host %s ') % host_name)
ssh_cmd = 'svctask rmhost %s ' % host_name
out, err = self._run_ssh(ssh_cmd)
# No output should be returned from rmhost
self._asse... | def _delete_host(self, host_name):
"""Delete a host on the storage system."""
LOG.debug(_('enter: _delete_host: host %s ') % host_name)
ssh_cmd = ['svctask', 'rmhost', host_name]
out, err = self._run_ssh(ssh_cmd)
# No output should be returned from rmhost
self._asse... | {
"deleted": [
{
"line_no": 6,
"char_start": 158,
"char_end": 209,
"line": " ssh_cmd = 'svctask rmhost %s ' % host_name\n"
}
],
"added": [
{
"line_no": 6,
"char_start": 158,
"char_end": 209,
"line": " ssh_cmd = ['svctask', 'rmhost', host_na... | {
"deleted": [
{
"char_start": 191,
"char_end": 195,
"chars": " %s "
},
{
"char_start": 196,
"char_end": 198,
"chars": " %"
}
],
"added": [
{
"char_start": 176,
"char_end": 177,
"chars": "["
},
{
"char_start": 185,
"char... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
fetch | def fetch(url):
'''Download and verify a package url.'''
base = os.path.basename(url)
print('Fetching %s...' % base)
fetch_file(url + '.asc')
fetch_file(url)
fetch_file(url + '.sha256')
fetch_file(url + '.asc.sha256')
print('Verifying %s...' % base)
# TODO: check for verification failure.
os.system(... | def fetch(url):
'''Download and verify a package url.'''
base = os.path.basename(url)
print('Fetching %s...' % base)
fetch_file(url + '.asc')
fetch_file(url)
fetch_file(url + '.sha256')
fetch_file(url + '.asc.sha256')
print('Verifying %s...' % base)
# TODO: check for verification failure.
subprocess... | {
"deleted": [
{
"line_no": 11,
"char_start": 308,
"char_end": 350,
"line": " os.system('shasum -c %s.sha256' % base)\n"
},
{
"line_no": 12,
"char_start": 350,
"char_end": 396,
"line": " os.system('shasum -c %s.asc.sha256' % base)\n"
},
{
"li... | {
"deleted": [
{
"char_start": 312,
"char_end": 313,
"chars": "."
},
{
"char_start": 314,
"char_end": 317,
"chars": "yst"
},
{
"char_start": 318,
"char_end": 319,
"chars": "m"
},
{
"char_start": 331,
"char_end": 332,
"... | github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb | repack_rust.py | cwe-078 |
_formatCredentials | def _formatCredentials(self, data, name):
"""
Credentials are of the form
RCLONE_CONFIG_CURRENT_TYPE=s3
^ ^ ^ ^
[mandatory ][name ][key][value]
"""
prefix = "RCLONE_CONFIG_{}".format(name.upper())
credentials = ''
cred... | def _formatCredentials(self, data, name):
"""
Credentials are of the form
RCLONE_CONFIG_CURRENT_TYPE=s3
^ ^ ^ ^
[mandatory ][name ][key][value]
"""
prefix = "RCLONE_CONFIG_{}".format(name.upper())
credentials = {}
cred... | {
"deleted": [
{
"line_no": 11,
"char_start": 283,
"char_end": 308,
"line": " credentials = ''\n"
},
{
"line_no": 12,
"char_start": 308,
"char_end": 373,
"line": " credentials += \"{}_TYPE='{}' \".format(prefix, data.type)\n"
},
{
... | {
"deleted": [
{
"char_start": 305,
"char_end": 307,
"chars": "''"
},
{
"char_start": 327,
"char_end": 332,
"chars": " += \""
},
{
"char_start": 339,
"char_end": 340,
"chars": "="
},
{
"char_start": 341,
"char_end": 346,
... | github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db | src/backend/api/utils/rclone_connection.py | cwe-078 |
initHeader | def initHeader(self):
"""Initialize the IP header according to the IP format definition.
"""
# Ethernet header
# Retrieve remote MAC address
dstMacAddr = arpreq.arpreq(self.remoteIP)
if dstMacAddr is not None:
dstMacAddr = dstMacAddr.replace(':', '')
... | def initHeader(self):
"""Initialize the IP header according to the IP format definition.
"""
# Ethernet header
# Retrieve remote MAC address
dstMacAddr = arpreq.arpreq(self.remoteIP)
if dstMacAddr is not None:
dstMacAddr = dstMacAddr.replace(':', '')
... | {
"deleted": [
{
"line_no": 15,
"char_start": 423,
"char_end": 505,
"line": " p = subprocess.Popen(\"ping -c1 {}\".format(self.remoteIP), shell=True)\n"
}
],
"added": [
{
"line_no": 15,
"char_start": 423,
"char_end": 493,
"line": " ... | {
"deleted": [
{
"char_start": 465,
"char_end": 468,
"chars": " {}"
},
{
"char_start": 469,
"char_end": 477,
"chars": ".format("
},
{
"char_start": 490,
"char_end": 503,
"chars": "), shell=True"
}
],
"added": [
{
"char_start":... | github.com/netzob/netzob/commit/557abf64867d715497979b029efedbd2777b912e | src/netzob/Simulator/Channels/RawEthernetClient.py | cwe-078 |
poll | def poll(self, poll_input):
username = poll_input.credentials.username
password = poll_input.credentials.password
domain = poll_input.credentials.domain
if domain is None:
opt_str = '--ignore-certificate --authonly -u {} -p {} {}:{}'
options = opt_str... | def poll(self, poll_input):
username = poll_input.credentials.username
password = poll_input.credentials.password
domain = poll_input.credentials.domain
if domain is None:
opt_str = '--ignore-certificate --authonly -u \'{}\' -p \'{}\' {}:{}'
options =... | {
"deleted": [
{
"line_no": 7,
"char_start": 217,
"char_end": 291,
"line": " opt_str = '--ignore-certificate --authonly -u {} -p {} {}:{}'\n"
},
{
"line_no": 12,
"char_start": 439,
"char_end": 519,
"line": " opt_str = '--ignore-certific... | {
"deleted": [],
"added": [
{
"char_start": 275,
"char_end": 277,
"chars": "\\'"
},
{
"char_start": 279,
"char_end": 281,
"chars": "\\'"
},
{
"char_start": 285,
"char_end": 287,
"chars": "\\'"
},
{
"char_start": 289,
"char... | github.com/DSU-DefSecClub/ScoringEngine/commit/010eefe1ad416c0bdaa16fd59eca0dc8e3086a13 | polling/poll_rdp.py | cwe-078 |
terminate_connection | def terminate_connection(self, volume, connector, **kwargs):
"""Cleanup after an iSCSI connection has been terminated.
When we clean up a terminated connection between a given connector
and volume, we:
1. Translate the given connector to a host name
2. Remove the volume-to-h... | def terminate_connection(self, volume, connector, **kwargs):
"""Cleanup after an iSCSI connection has been terminated.
When we clean up a terminated connection between a given connector
and volume, we:
1. Translate the given connector to a host name
2. Remove the volume-to-h... | {
"deleted": [
{
"line_no": 27,
"char_start": 1277,
"char_end": 1340,
"line": " ssh_cmd = 'svctask rmvdiskhostmap -host %s %s' % \\\n"
},
{
"line_no": 28,
"char_start": 1340,
"char_end": 1378,
"line": " (host_name, vol_name)\n"
... | {
"deleted": [
{
"char_start": 1329,
"char_end": 1330,
"chars": "%"
},
{
"char_start": 1332,
"char_end": 1340,
"chars": "%s' % \\\n"
},
{
"char_start": 1356,
"char_end": 1367,
"chars": "(host_name,"
},
{
"char_start": 1376,
... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_port_conf_generator | def _port_conf_generator(self, cmd):
ssh_cmd = '%s -delim !' % cmd
out, err = self._run_ssh(ssh_cmd)
if not len(out.strip()):
return
port_lines = out.strip().split('\n')
if not len(port_lines):
return
header = port_lines.pop(0)
yield ... | def _port_conf_generator(self, cmd):
ssh_cmd = cmd + ['-delim', '!']
out, err = self._run_ssh(ssh_cmd)
if not len(out.strip()):
return
port_lines = out.strip().split('\n')
if not len(port_lines):
return
header = port_lines.pop(0)
yiel... | {
"deleted": [
{
"line_no": 2,
"char_start": 41,
"char_end": 79,
"line": " ssh_cmd = '%s -delim !' % cmd\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 41,
"char_end": 81,
"line": " ssh_cmd = cmd + ['-delim', '!']\n"
}
]
} | {
"deleted": [
{
"char_start": 59,
"char_end": 62,
"chars": "'%s"
},
{
"char_start": 72,
"char_end": 78,
"chars": " % cmd"
}
],
"added": [
{
"char_start": 59,
"char_end": 64,
"chars": "cmd +"
},
{
"char_start": 65,
"char... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
init_settings | def init_settings(self, ipython_app, kernel_manager, contents_manager,
cluster_manager, session_manager, kernel_spec_manager,
config_manager,
log, base_url, default_url, settings_overrides,
jinja_env_options=None):
_tem... | def init_settings(self, ipython_app, kernel_manager, contents_manager,
cluster_manager, session_manager, kernel_spec_manager,
config_manager,
log, base_url, default_url, settings_overrides,
jinja_env_options=None):
_tem... | {
"deleted": [
{
"line_no": 15,
"char_start": 629,
"char_end": 695,
"line": " jenv_opt = jinja_env_options if jinja_env_options else {}\n"
}
],
"added": [
{
"line_no": 15,
"char_start": 629,
"char_end": 669,
"line": " jenv_opt = {\"autoesca... | {
"deleted": [],
"added": [
{
"char_start": 648,
"char_end": 693,
"chars": "{\"autoescape\": True}\n jenv_opt.update("
},
{
"char_start": 739,
"char_end": 741,
"chars": ")\n"
}
]
} | github.com/ipython/ipython/commit/3ab41641cf6fce3860c73d5cf4645aa12e1e5892 | IPython/html/notebookapp.py | cwe-079 |
DeletionConfirmationDlg::DeletionConfirmationDlg | DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {
setupUi(this);
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... | DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {
setupUi(this);
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... | {
"deleted": [
{
"line_no": 4,
"char_start": 163,
"char_end": 341,
"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"
}
],
"added": [
{... | {
"deleted": [],
"added": [
{
"char_start": 333,
"char_end": 362,
"chars": "Utils::String::toHtmlEscaped("
},
{
"char_start": 366,
"char_end": 367,
"chars": ")"
}
]
} | github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16 | src/gui/deletionconfirmationdlg.h | cwe-079 |
get | @auth.public
def get(self, build_id):
try:
build_id = int(build_id)
except ValueError as ex:
self.response.write(ex.message)
self.abort(400)
build = model.Build.get_by_id(build_id)
can_view = build and user.can_view_build_async(build).get_result()
if not can_view:
if au... | @auth.public
def get(self, build_id):
try:
build_id = int(build_id)
except ValueError:
self.response.write('invalid build id')
self.abort(400)
build = model.Build.get_by_id(build_id)
can_view = build and user.can_view_build_async(build).get_result()
if not can_view:
if ... | {
"deleted": [
{
"line_no": 5,
"char_start": 82,
"char_end": 111,
"line": " except ValueError as ex:\n"
},
{
"line_no": 6,
"char_start": 111,
"char_end": 149,
"line": " self.response.write(ex.message)\n"
},
{
"line_no": 14,
"char_... | {
"deleted": [
{
"char_start": 103,
"char_end": 109,
"chars": " as ex"
},
{
"char_start": 137,
"char_end": 144,
"chars": "ex.mess"
},
{
"char_start": 145,
"char_end": 147,
"chars": "ge"
},
{
"char_start": 389,
"char_end": 39... | github.com/asdfghjjklllllaaa/infra/commit/2f39f3df54fb79b56744f00bcf97583b3807851f | appengine/cr-buildbucket/handlers.py | cwe-079 |
index | def index(request, is_mobile=False):
hue_collections = DashboardController(request.user).get_search_collections()
collection_id = request.GET.get('collection')
if not hue_collections or not collection_id:
return admin_collections(request, True, is_mobile)
try:
collection_doc = Document2.objects.get(id... | def index(request, is_mobile=False):
hue_collections = DashboardController(request.user).get_search_collections()
collection_id = request.GET.get('collection')
if not hue_collections or not collection_id:
return admin_collections(request, True, is_mobile)
try:
collection_doc = Document2.objects.get(id... | {
"deleted": [
{
"line_no": 22,
"char_start": 814,
"char_end": 863,
"line": " query['qs'][0]['q'] = request.GET.get('q')\n"
},
{
"line_no": 24,
"char_start": 891,
"char_end": 933,
"line": " query['qd'] = request.GET.get('qd')\n"
},
{
... | {
"deleted": [],
"added": [
{
"char_start": 842,
"char_end": 850,
"chars": "antixss("
},
{
"char_start": 869,
"char_end": 874,
"chars": ", '')"
},
{
"char_start": 924,
"char_end": 932,
"chars": "antixss("
},
{
"char_start": 952,... | github.com/gethue/hue/commit/37b529b1f9aeb5d746599a9ed4e2288cf3ad3e1d | desktop/libs/dashboard/src/dashboard/views.py | cwe-079 |
respond_error | def respond_error(self, context, exception):
context.respond_server_error()
stack = traceback.format_exc()
return """
<html>
<body>
<style>
body {
font-family: sans-serif;
color: #888;
... | def respond_error(self, context, exception):
context.respond_server_error()
stack = traceback.format_exc()
return """
<html>
<body>
<style>
body {
font-family: sans-serif;
color: #888;
... | {
"deleted": [
{
"line_no": 33,
"char_start": 871,
"char_end": 890,
"line": " \"\"\" % stack\n"
}
],
"added": [
{
"line_no": 33,
"char_start": 871,
"char_end": 902,
"line": " \"\"\" % cgi.escape(stack)"
}
]
} | {
"deleted": [],
"added": [
{
"char_start": 885,
"char_end": 896,
"chars": "cgi.escape("
},
{
"char_start": 901,
"char_end": 902,
"chars": ")"
}
]
} | github.com/Eugeny/ajenti/commit/d3fc5eb142ff16d55d158afb050af18d5ff09120 | ajenti/routing.py | cwe-079 |
edit_bundle | @check_document_access_permission()
def edit_bundle(request):
bundle_id = request.GET.get('bundle')
doc = None
if bundle_id:
doc = Document2.objects.get(id=bundle_id)
bundle = Bundle(document=doc)
else:
bundle = Bundle()
coordinators = [dict([('uuid', d.content_object.uuid), ('name', d.content... | @check_document_access_permission()
def edit_bundle(request):
bundle_id = request.GET.get('bundle')
doc = None
if bundle_id:
doc = Document2.objects.get(id=bundle_id)
bundle = Bundle(document=doc)
else:
bundle = Bundle()
coordinators = [dict([('uuid', d.content_object.uuid), ('name', d.content... | {
"deleted": [
{
"line_no": 16,
"char_start": 498,
"char_end": 532,
"line": " 'bundle_json': bundle.json,\n"
},
{
"line_no": 17,
"char_start": 532,
"char_end": 585,
"line": " 'coordinators_json': json.dumps(coordinators),\n"
}
],
"added": [... | {
"deleted": [],
"added": [
{
"char_start": 530,
"char_end": 541,
"chars": "_for_html()"
},
{
"char_start": 593,
"char_end": 617,
"chars": ", cls=JSONEncoderForHTML"
}
]
} | github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735 | apps/oozie/src/oozie/views/editor2.py | cwe-079 |
history_data | def history_data(start_time, offset=None):
"""Return history data.
Arguments:
start_time: select history starting from this timestamp.
offset: number of items to skip
"""
# history atimes are stored as ints, ensure start_time is not a float
start_time = int(start_time)
hist = ob... | def history_data(start_time, offset=None):
"""Return history data.
Arguments:
start_time: select history starting from this timestamp.
offset: number of items to skip
"""
# history atimes are stored as ints, ensure start_time is not a float
start_time = int(start_time)
hist = ob... | {
"deleted": [
{
"line_no": 18,
"char_start": 603,
"char_end": 674,
"line": " return [{\"url\": e.url, \"title\": e.title or e.url, \"time\": e.atime}\n"
},
{
"line_no": 19,
"char_start": 674,
"char_end": 703,
"line": " for e in entries]\n"
... | {
"deleted": [
{
"char_start": 673,
"char_end": 685,
"chars": "\n "
}
],
"added": [
{
"char_start": 623,
"char_end": 635,
"chars": "html.escape("
},
{
"char_start": 640,
"char_end": 641,
"chars": ")"
},
{
"char_start... | github.com/qutebrowser/qutebrowser/commit/4c9360237f186681b1e3f2a0f30c45161cf405c7 | qutebrowser/browser/qutescheme.py | cwe-079 |
json_dumps | @register.filter
def json_dumps(value, indent=None):
if isinstance(value, QuerySet):
result = serialize('json', value, indent=indent)
else:
result = json.dumps(value, indent=indent, cls=DjbletsJSONEncoder)
return mark_safe(result) | @register.filter
def json_dumps(value, indent=None):
if isinstance(value, QuerySet):
result = serialize('json', value, indent=indent)
else:
result = json.dumps(value, indent=indent, cls=DjbletsJSONEncoder)
return mark_safe(force_text(result).translate(_safe_js_escapes)) | {
"deleted": [
{
"line_no": 8,
"char_start": 231,
"char_end": 259,
"line": " return mark_safe(result)\n"
}
],
"added": [
{
"line_no": 8,
"char_start": 231,
"char_end": 299,
"line": " return mark_safe(force_text(result).translate(_safe_js_escapes))\... | {
"deleted": [],
"added": [
{
"char_start": 252,
"char_end": 263,
"chars": "force_text("
},
{
"char_start": 270,
"char_end": 299,
"chars": ".translate(_safe_js_escapes))"
}
]
} | github.com/djblets/djblets/commit/77a68c03cd619a0996f3f37337b8c39ca6643d6e | djblets/util/templatetags/djblets_js.py | cwe-079 |
htmlvalue | def htmlvalue(self, val):
return self.block.render_basic(val) | def htmlvalue(self, val):
"""
Return an HTML representation of this block that is safe to be included
in comparison views
"""
return escape(text_from_html(self.block.render_basic(val))) | {
"deleted": [
{
"line_no": 2,
"char_start": 30,
"char_end": 73,
"line": " return self.block.render_basic(val)\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 30,
"char_end": 42,
"line": " \"\"\"\n"
},
{
"line_no": 3,
"... | {
"deleted": [],
"added": [
{
"char_start": 38,
"char_end": 68,
"chars": "\"\"\"\n Return an HTML rep"
},
{
"char_start": 70,
"char_end": 73,
"chars": "sen"
},
{
"char_start": 74,
"char_end": 117,
"chars": "ation of this block that is ... | github.com/wagtail/wagtail/commit/61045ceefea114c40ac4b680af58990dbe732389 | wagtail/admin/compare.py | cwe-079 |
gravatar | @register.tag
@basictag(takes_context=True)
def gravatar(context, user, size=None):
"""
Outputs the HTML for displaying a user's gravatar.
This can take an optional size of the image (defaults to 80 if not
specified).
This is also influenced by the following settings:
GRAVATAR_SIZE - D... | @register.tag
@basictag(takes_context=True)
def gravatar(context, user, size=None):
"""
Outputs the HTML for displaying a user's gravatar.
This can take an optional size of the image (defaults to 80 if not
specified).
This is also influenced by the following settings:
GRAVATAR_SIZE - D... | {
"deleted": [
{
"line_no": 22,
"char_start": 698,
"char_end": 763,
"line": " return ('<img src=\"%s\" width=\"%s\" height=\"%s\" alt=\"%s\" '\n"
},
{
"line_no": 23,
"char_start": 763,
"char_end": 807,
"line": " ' class=\"gravatar\"... | {
"deleted": [
{
"char_start": 725,
"char_end": 727,
"chars": "%s"
},
{
"char_start": 736,
"char_end": 738,
"chars": "%s"
},
{
"char_start": 748,
"char_end": 750,
"chars": "%s"
},
{
"char_start": 757,
"char_end": 759,
... | github.com/djblets/djblets/commit/77ac64642ad530bf69e390c51fc6fdcb8914c8e7 | djblets/gravatars/templatetags/gravatars.py | cwe-079 |
PeerListWidget::addPeer | QStandardItem* PeerListWidget::addPeer(const QString& ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)
{
int row = m_listModel->rowCount();
// Adding Peer to peer list
m_listModel->insertRow(row);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip);
... | QStandardItem* PeerListWidget::addPeer(const QString& ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)
{
int row = m_listModel->rowCount();
// Adding Peer to peer list
m_listModel->insertRow(row);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip);
... | {
"deleted": [
{
"line_no": 24,
"char_start": 1441,
"char_end": 1533,
"line": " m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), peer.client());\n"
}
],
"added": [
{
"line_no": 24,
"char_start": 1441,
"char_end": 1563,
"line": "... | {
"deleted": [],
"added": [
{
"char_start": 1517,
"char_end": 1546,
"chars": "Utils::String::toHtmlEscaped("
},
{
"char_start": 1558,
"char_end": 1559,
"chars": ")"
}
]
} | github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16 | src/gui/properties/peerlistwidget.cpp | cwe-079 |
is_safe_url | def is_safe_url(url, host=None):
"""
Return ``True`` if the url is a safe redirection (i.e. it doesn't point to
a different host and uses a safe scheme).
Always returns ``False`` on an empty url.
"""
if url is not None:
url = url.strip()
if not url:
return False
# Chrome... | def is_safe_url(url, host=None):
"""
Return ``True`` if the url is a safe redirection (i.e. it doesn't point to
a different host and uses a safe scheme).
Always returns ``False`` on an empty url.
"""
if url is not None:
url = url.strip()
if not url:
return False
# Chrome... | {
"deleted": [
{
"line_no": 13,
"char_start": 346,
"char_end": 379,
"line": " url = url.replace('\\\\', '/')\n"
}
],
"added": [
{
"line_no": 14,
"char_start": 444,
"char_end": 525,
"line": " return _is_safe_url(url, host) and _is_safe_url(url.repla... | {
"deleted": [
{
"char_start": 345,
"char_end": 346,
"chars": "\n"
},
{
"char_start": 347,
"char_end": 396,
"chars": " url = url.replace('\\\\', '/')\n # Chrome cons"
},
{
"char_start": 397,
"char_end": 403,
"chars": "ders a"
},
{
... | github.com/django/django/commit/c5544d289233f501917e25970c03ed444abbd4f0 | django/utils/http.py | cwe-079 |
get_context_data | def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['comments'] = self.object.comment_set.all().order_by('-time')
context['form'] = self.get_form()
context['md'] = markdown(self.object.content,
extensions=[
... | def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['comments'] = self.object.comment_set.all().order_by('-time')
context['form'] = self.get_form()
context['md'] = safe_md(self.object.content)
return context | {
"deleted": [
{
"line_no": 5,
"char_start": 215,
"char_end": 269,
"line": " context['md'] = markdown(self.object.content,\n"
},
{
"line_no": 6,
"char_start": 269,
"char_end": 315,
"line": " extensions=[\n"
},
{... | {
"deleted": [
{
"char_start": 239,
"char_end": 240,
"chars": "m"
},
{
"char_start": 241,
"char_end": 243,
"chars": "rk"
},
{
"char_start": 244,
"char_end": 247,
"chars": "own"
},
{
"char_start": 267,
"char_end": 550,
... | github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c | app/Index/views.py | cwe-079 |
edit_workflow | @check_document_access_permission()
def edit_workflow(request):
workflow_id = request.GET.get('workflow')
if workflow_id:
wid = {}
if workflow_id.isdigit():
wid['id'] = workflow_id
else:
wid['uuid'] = workflow_id
doc = Document2.objects.get(type='oozie-workflow2', **wid)
workflow ... | @check_document_access_permission()
def edit_workflow(request):
workflow_id = request.GET.get('workflow')
if workflow_id:
wid = {}
if workflow_id.isdigit():
wid['id'] = workflow_id
else:
wid['uuid'] = workflow_id
doc = Document2.objects.get(type='oozie-workflow2', **wid)
workflow ... | {
"deleted": [
{
"line_no": 30,
"char_start": 743,
"char_end": 801,
"line": " 'layout_json': json.dumps(workflow_data['layout']),\n"
},
{
"line_no": 31,
"char_start": 801,
"char_end": 863,
"line": " 'workflow_json': json.dumps(workflow_data['workfl... | {
"deleted": [],
"added": [
{
"char_start": 798,
"char_end": 822,
"chars": ", cls=JSONEncoderForHTML"
},
{
"char_start": 884,
"char_end": 908,
"chars": ", cls=JSONEncoderForHTML"
},
{
"char_start": 978,
"char_end": 1002,
"chars": ", cls=JSONE... | github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735 | apps/oozie/src/oozie/views/editor2.py | cwe-079 |
simple_search | @classmethod
def simple_search(cls, query, using=None, index=None):
es_search = cls.search(using=using, index=index)
es_query = cls.get_es_query(query=query)
highlighted_fields = [f.split('^', 1)[0] for f in cls.search_fields]
es_search = es_search.query(es_query).highlight(*hig... | @classmethod
def simple_search(cls, query, using=None, index=None):
"""
Do a search without facets.
This is used in:
* The Docsearch API
* The Project Admin Search page
"""
es_search = cls.search(using=using, index=index)
es_search = es_search.h... | {
"deleted": [
{
"line_no": 6,
"char_start": 259,
"char_end": 260,
"line": "\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 76,
"char_end": 88,
"line": " \"\"\"\n"
},
{
"line_no": 4,
"char_start": 88,
"char_end": 124,
... | {
"deleted": [
{
"char_start": 259,
"char_end": 260,
"chars": "\n"
}
],
"added": [
{
"char_start": 84,
"char_end": 240,
"chars": "\"\"\"\n Do a search without facets.\n\n This is used in:\n\n * The Docsearch API\n * The Project Admin Sear... | github.com/readthedocs/readthedocs.org/commit/1ebe494ffde18109307f205d2bd94102452f697a | readthedocs/search/documents.py | cwe-079 |
HPHP::WddxPacket::recursiveAddVar | bool WddxPacket::recursiveAddVar(const String& varName,
const Variant& varVariant,
bool hasVarTag) {
bool isArray = varVariant.isArray();
bool isObject = varVariant.isObject();
if (isArray || isObject) {
if (hasVarTag) {
m_packetString ... | bool WddxPacket::recursiveAddVar(const String& varName,
const Variant& varVariant,
bool hasVarTag) {
bool isArray = varVariant.isArray();
bool isObject = varVariant.isObject();
if (isArray || isObject) {
if (hasVarTag) {
m_packetString ... | {
"deleted": [
{
"line_no": 68,
"char_start": 2068,
"char_end": 2125,
"line": " std::string varValue = varVariant.toString().data();\n"
}
],
"added": [
{
"line_no": 68,
"char_start": 2068,
"char_end": 2094,
"line": " std::string varValue;\n"
},... | {
"deleted": [
{
"char_start": 2092,
"char_end": 2123,
"chars": " = varVariant.toString().data()"
},
{
"char_start": 2168,
"char_end": 2168,
"chars": ""
}
],
"added": [
{
"char_start": 2094,
"char_end": 2094,
"chars": ""
},
{
... | github.com/facebook/hhvm/commit/324701c9fd31beb4f070f1b7ef78b115fbdfec34 | hphp/runtime/ext/wddx/ext_wddx.cpp | cwe-079 |
mode_receive | def mode_receive(self, request):
"""
This is called by render_POST when the client is telling us
that it is ready to receive data as soon as it is available.
This is the basis of a long-polling (comet) mechanism: the
server will wait to reply until data is available.
... | def mode_receive(self, request):
"""
This is called by render_POST when the client is telling us
that it is ready to receive data as soon as it is available.
This is the basis of a long-polling (comet) mechanism: the
server will wait to reply until data is available.
... | {
"deleted": [
{
"line_no": 12,
"char_start": 389,
"char_end": 438,
"line": " csessid = request.args.get('csessid')[0]\n"
}
],
"added": [
{
"line_no": 12,
"char_start": 389,
"char_end": 446,
"line": " csessid = cgi.escape(request.args['cses... | {
"deleted": [
{
"char_start": 419,
"char_end": 424,
"chars": ".get("
},
{
"char_start": 433,
"char_end": 434,
"chars": ")"
}
],
"added": [
{
"char_start": 407,
"char_end": 418,
"chars": "cgi.escape("
},
{
"char_start": 430,
... | github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93 | evennia/server/portal/webclient_ajax.py | cwe-079 |
edit_coordinator | @check_document_access_permission()
def edit_coordinator(request):
coordinator_id = request.GET.get('coordinator')
doc = None
if coordinator_id:
doc = Document2.objects.get(id=coordinator_id)
coordinator = Coordinator(document=doc)
else:
coordinator = Coordinator()
api = get_oozie(request.user... | @check_document_access_permission()
def edit_coordinator(request):
coordinator_id = request.GET.get('coordinator')
doc = None
if coordinator_id:
doc = Document2.objects.get(id=coordinator_id)
coordinator = Coordinator(document=doc)
else:
coordinator = Coordinator()
api = get_oozie(request.user... | {
"deleted": [
{
"line_no": 27,
"char_start": 915,
"char_end": 959,
"line": " 'coordinator_json': coordinator.json,\n"
},
{
"line_no": 28,
"char_start": 959,
"char_end": 1029,
"line": " 'credentials_json': json.dumps(credentials.credentials.keys())... | {
"deleted": [],
"added": [
{
"char_start": 957,
"char_end": 968,
"chars": "_for_html()"
},
{
"char_start": 1037,
"char_end": 1061,
"chars": ", cls=JSONEncoderForHTML"
},
{
"char_start": 1108,
"char_end": 1132,
"chars": ", cls=JSONEncoderForH... | github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735 | apps/oozie/src/oozie/views/editor2.py | cwe-079 |
_keyify | def _keyify(key):
return _key_pattern.sub(' ', key.lower()) | def _keyify(key):
key = escape(key.lower(), quote=True)
return _key_pattern.sub(' ', key) | {
"deleted": [
{
"line_no": 2,
"char_start": 18,
"char_end": 63,
"line": " return _key_pattern.sub(' ', key.lower())\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 18,
"char_end": 60,
"line": " key = escape(key.lower(), quote=True)\n"
},
... | {
"deleted": [
{
"char_start": 54,
"char_end": 62,
"chars": ".lower()"
}
],
"added": [
{
"char_start": 22,
"char_end": 64,
"chars": "key = escape(key.lower(), quote=True)\n "
}
]
} | github.com/lepture/mistune/commit/5f06d724bc05580e7f203db2d4a4905fc1127f98 | mistune.py | cwe-079 |
batch_edit_translations | @login_required(redirect_field_name='', login_url='/403')
@require_POST
@require_AJAX
@transaction.atomic
def batch_edit_translations(request):
"""Perform an action on a list of translations.
Available actions are defined in `ACTIONS_FN_MAP`. Arguments to this view
are defined in `models.BatchActionsForm`.... | @login_required(redirect_field_name='', login_url='/403')
@require_POST
@require_AJAX
@transaction.atomic
def batch_edit_translations(request):
"""Perform an action on a list of translations.
Available actions are defined in `ACTIONS_FN_MAP`. Arguments to this view
are defined in `models.BatchActionsForm`.... | {
"deleted": [
{
"line_no": 14,
"char_start": 406,
"char_end": 467,
"line": " return HttpResponseBadRequest(form.errors.as_json())\n"
}
],
"added": [
{
"line_no": 14,
"char_start": 406,
"char_end": 483,
"line": " return HttpResponseBadReque... | {
"deleted": [],
"added": [
{
"char_start": 464,
"char_end": 480,
"chars": "escape_html=True"
}
]
} | github.com/onefork/pontoon-sr/commit/fc07ed9c68e08d41f74c078b4e7727f1a0888be8 | pontoon/batch/views.py | cwe-079 |
make_eb_config | def make_eb_config(application_name, default_region):
# Capture our current directory
UTILS_DIR = os.path.dirname(os.path.abspath(__file__))
# Create the jinja2 environment.
# Notice the use of trim_blocks, which greatly helps control whitespace.
j2_env = Environment(loader=FileSystemLoader(UTILS_DI... | def make_eb_config(application_name, default_region):
# Capture our current directory
UTILS_DIR = os.path.dirname(os.path.abspath(__file__))
# Create the jinja2 environment.
# Notice the use of trim_blocks, which greatly helps control whitespace.
j2_env = Environment(loader=FileSystemLoader(UTILS_DI... | {
"deleted": [
{
"line_no": 6,
"char_start": 263,
"char_end": 324,
"line": " j2_env = Environment(loader=FileSystemLoader(UTILS_DIR))\n"
}
],
"added": [
{
"line_no": 6,
"char_start": 263,
"char_end": 341,
"line": " j2_env = Environment(loader=FileS... | {
"deleted": [],
"added": [
{
"char_start": 322,
"char_end": 339,
"chars": ", autoescape=True"
}
]
} | github.com/OkunaOrg/okuna-www-api/commit/8c40c66ea7c483a0cbda4c21940180af909aab99 | utils/make_eb_config.py | cwe-079 |
mode_keepalive | def mode_keepalive(self, request):
"""
This is called by render_POST when the
client is replying to the keepalive.
"""
csessid = request.args.get('csessid')[0]
self.last_alive[csessid] = (time.time(), False)
return '""' | def mode_keepalive(self, request):
"""
This is called by render_POST when the
client is replying to the keepalive.
"""
csessid = cgi.escape(request.args['csessid'][0])
self.last_alive[csessid] = (time.time(), False)
return '""' | {
"deleted": [
{
"line_no": 6,
"char_start": 155,
"char_end": 204,
"line": " csessid = request.args.get('csessid')[0]\n"
}
],
"added": [
{
"line_no": 6,
"char_start": 155,
"char_end": 212,
"line": " csessid = cgi.escape(request.args['csessi... | {
"deleted": [
{
"char_start": 185,
"char_end": 190,
"chars": ".get("
},
{
"char_start": 199,
"char_end": 200,
"chars": ")"
}
],
"added": [
{
"char_start": 173,
"char_end": 184,
"chars": "cgi.escape("
},
{
"char_start": 196,
... | github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93 | evennia/server/portal/webclient_ajax.py | cwe-079 |
Logger::addPeer | void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)
{
QWriteLocker locker(&lock);
Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), ip, blocked, reason };
m_peers.push_back(temp);
if (m_peers.size() >= MAX_LOG_MESSAGES)
m_peers.pop_front();
em... | void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)
{
QWriteLocker locker(&lock);
Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), Utils::String::toHtmlEscaped(ip), blocked, Utils::String::toHtmlEscaped(reason) };
m_peers.push_back(temp);
if (m_peers.size... | {
"deleted": [
{
"line_no": 5,
"char_start": 112,
"char_end": 210,
"line": " Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), ip, blocked, reason };\n"
}
],
"added": [
{
"line_no": 5,
"char_start": 112,
"char_end": 270,
"line": "... | {
"deleted": [],
"added": [
{
"char_start": 187,
"char_end": 216,
"chars": "Utils::String::toHtmlEscaped("
},
{
"char_start": 218,
"char_end": 219,
"chars": ")"
},
{
"char_start": 230,
"char_end": 259,
"chars": "Utils::String::toHtmlEscaped("... | github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16 | src/base/logger.cpp | cwe-079 |
subscribe_for_tags | @csrf.csrf_protect
def subscribe_for_tags(request):
"""process subscription of users by tags"""
#todo - use special separator to split tags
tag_names = request.REQUEST.get('tags','').strip().split()
pure_tag_names, wildcards = forms.clean_marked_tagnames(tag_names)
if request.user.is_authenticated()... | @csrf.csrf_protect
def subscribe_for_tags(request):
"""process subscription of users by tags"""
#todo - use special separator to split tags
tag_names = request.REQUEST.get('tags','').strip().split()
pure_tag_names, wildcards = forms.clean_marked_tagnames(tag_names)
if request.user.is_authenticated()... | {
"deleted": [
{
"line_no": 22,
"char_start": 905,
"char_end": 984,
"line": " ) % {'url': request.path + '?tags=' + request.REQUEST['tags']}\n"
}
],
"added": [
{
"line_no": 22,
"char_start": 905,
"char_end": 992,
"line": " )... | {
"deleted": [],
"added": [
{
"char_start": 933,
"char_end": 940,
"chars": "escape("
},
{
"char_start": 952,
"char_end": 953,
"chars": ")"
}
]
} | github.com/ASKBOT/askbot-devel/commit/a676a86b6b7a5737d4da4f59f71e037406f88d29 | askbot/views/commands.py | cwe-079 |
nav_path | def nav_path(request):
"""Return current path as list of items with "name" and "href" members
The href members are view_directory links for directories and view_log
links for files, but are set to None when the link would point to
the current view"""
if not request.repos:
return []
is_dir = request.p... | def nav_path(request):
"""Return current path as list of items with "name" and "href" members
The href members are view_directory links for directories and view_log
links for files, but are set to None when the link would point to
the current view"""
if not request.repos:
return []
is_dir = request.p... | {
"deleted": [
{
"line_no": 28,
"char_start": 897,
"char_end": 936,
"line": " item = _item(name=part, href=None)\n"
}
],
"added": [
{
"line_no": 28,
"char_start": 897,
"char_end": 959,
"line": " item = _item(name=request.server.escape(part), href=N... | {
"deleted": [],
"added": [
{
"char_start": 919,
"char_end": 941,
"chars": "request.server.escape("
},
{
"char_start": 945,
"char_end": 946,
"chars": ")"
}
]
} | github.com/viewvc/viewvc/commit/9dcfc7daa4c940992920d3b2fbd317da20e44aad | lib/viewvc.py | cwe-079 |
__init__ | def __init__(self, *args, **kwargs):
"""
Takes two additional keyword arguments:
:param cartpos: The cart position the form should be for
:param event: The event this belongs to
"""
cartpos = self.cartpos = kwargs.pop('cartpos', None)
orderpos = self.orderpos... | def __init__(self, *args, **kwargs):
"""
Takes two additional keyword arguments:
:param cartpos: The cart position the form should be for
:param event: The event this belongs to
"""
cartpos = self.cartpos = kwargs.pop('cartpos', None)
orderpos = self.orderpos... | {
"deleted": [
{
"line_no": 55,
"char_start": 2264,
"char_end": 2323,
"line": " label=q.question, required=q.required,\n"
},
{
"line_no": 61,
"char_start": 2531,
"char_end": 2590,
"line": " label=q.question, required=q.r... | {
"deleted": [
{
"char_start": 1759,
"char_end": 1759,
"chars": ""
},
{
"char_start": 2290,
"char_end": 2294,
"chars": "q.qu"
},
{
"char_start": 2295,
"char_end": 2300,
"chars": "stion"
},
{
"char_start": 2557,
"char_end": 2... | github.com/pretix/pretix/commit/affc6254a8316643d4afe9e8b7f8cd288c86ca1f | src/pretix/base/forms/questions.py | cwe-079 |
link_dialog | def link_dialog(request):
# list of wiki pages
name = request.values.get("pagename", "")
if name:
from MoinMoin import search
# XXX error handling!
searchresult = search.searchPages(request, 't:"%s"' % name)
pages = [p.page_name for p in searchresult.hits]
pages.sort... | def link_dialog(request):
# list of wiki pages
name = request.values.get("pagename", "")
name_escaped = wikiutil.escape(name)
if name:
from MoinMoin import search
# XXX error handling!
searchresult = search.searchPages(request, 't:"%s"' % name)
pages = [p.page_name for p... | {
"deleted": [
{
"line_no": 100,
"char_start": 3711,
"char_end": 3789,
"line": " <input id=\"txtPagename\" name=\"pagename\" size=\"30\" value=\"%(name)s\">\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 97,
"char_end": 138,
"line": " name_... | {
"deleted": [],
"added": [
{
"char_start": 101,
"char_end": 142,
"chars": "name_escaped = wikiutil.escape(name)\n "
},
{
"char_start": 3825,
"char_end": 3833,
"chars": "_escaped"
}
]
} | github.com/moinwiki/moin-1.9/commit/70955a8eae091cc88fd9a6e510177e70289ec024 | MoinMoin/action/fckdialog.py | cwe-079 |
action_save_user | def action_save_user(request: HttpRequest, default_forward_url: str = "/admin/users"):
"""
This functions saves the changes to the user or adds a new one. It completely creates the HttpResponse
:param request: the HttpRequest
:param default_forward_url: The URL to forward to if nothing was specified
... | def action_save_user(request: HttpRequest, default_forward_url: str = "/admin/users"):
"""
This functions saves the changes to the user or adds a new one. It completely creates the HttpResponse
:param request: the HttpRequest
:param default_forward_url: The URL to forward to if nothing was specified
... | {
"deleted": [
{
"line_no": 27,
"char_start": 1188,
"char_end": 1231,
"line": " user.displayName = displayname\n"
},
{
"line_no": 29,
"char_start": 1260,
"char_end": 1291,
"line": " user.notes = notes\n"
},
{
"line_no": 40... | {
"deleted": [],
"added": [
{
"char_start": 1219,
"char_end": 1226,
"chars": "escape("
},
{
"char_start": 1237,
"char_end": 1238,
"chars": ")"
},
{
"char_start": 1293,
"char_end": 1300,
"chars": "escape("
},
{
"char_start": 1305... | github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600 | c3shop/frontpage/management/edit_user.py | cwe-079 |
save | def save(self):
# copy the user's input from plain text to description to be processed
self.description = self.description_plain_text
if CE.settings.auto_cross_reference:
self.auto_cross_ref()
else:
self.find_tag()
self.slug = slugify(self.title)
... | def save(self):
# copy the user's input from plain text to description to be processed
# uses bleach to remove potentially harmful HTML code
self.description = bleach.clean(str(self.description_plain_text),
tags=CE.settings.bleach_allowed,
... | {
"deleted": [
{
"line_no": 3,
"char_start": 99,
"char_end": 154,
"line": " self.description = self.description_plain_text\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 161,
"char_end": 235,
"line": " self.description = bleach.clean(str(... | {
"deleted": [],
"added": [
{
"char_start": 107,
"char_end": 169,
"chars": "# uses bleach to remove potentially harmful HTML code\n "
},
{
"char_start": 188,
"char_end": 205,
"chars": "bleach.clean(str("
},
{
"char_start": 232,
"char_end": 3... | github.com/stevetasticsteve/CLA_Hub/commit/a06d85cd0b0964f8469e5c4bc9a6c132aa0b4c37 | CE/models.py | cwe-079 |
PropertiesWidget::loadTorrentInfos | void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent)
{
clear();
m_torrent = torrent;
downloaded_pieces->setTorrent(m_torrent);
pieces_availability->setTorrent(m_torrent);
if (!m_torrent) return;
// Save path
updateSavePath(m_torrent);
// Hash
hash_lbl->s... | void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent)
{
clear();
m_torrent = torrent;
downloaded_pieces->setTorrent(m_torrent);
pieces_availability->setTorrent(m_torrent);
if (!m_torrent) return;
// Save path
updateSavePath(m_torrent);
// Hash
hash_lbl->s... | {
"deleted": [
{
"line_no": 21,
"char_start": 655,
"char_end": 737,
"line": " comment_text->setText(Utils::Misc::parseHtmlLinks(m_torrent->comment()));\n"
},
{
"line_no": 26,
"char_start": 784,
"char_end": 845,
"line": " label_created_by_val->s... | {
"deleted": [],
"added": [
{
"char_start": 713,
"char_end": 742,
"chars": "Utils::String::toHtmlEscaped("
},
{
"char_start": 761,
"char_end": 762,
"chars": ")"
},
{
"char_start": 852,
"char_end": 881,
"chars": "Utils::String::toHtmlEscaped("... | github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16 | src/gui/properties/propertieswidget.cpp | cwe-079 |
mode_close | def mode_close(self, request):
"""
This is called by render_POST when the client is signalling
that it is about to be closed.
Args:
request (Request): Incoming request.
"""
csessid = request.args.get('csessid')[0]
try:
sess = self.ses... | def mode_close(self, request):
"""
This is called by render_POST when the client is signalling
that it is about to be closed.
Args:
request (Request): Incoming request.
"""
csessid = cgi.escape(request.args['csessid'][0])
try:
sess = ... | {
"deleted": [
{
"line_no": 10,
"char_start": 231,
"char_end": 280,
"line": " csessid = request.args.get('csessid')[0]\n"
}
],
"added": [
{
"line_no": 10,
"char_start": 231,
"char_end": 288,
"line": " csessid = cgi.escape(request.args['cses... | {
"deleted": [
{
"char_start": 261,
"char_end": 266,
"chars": ".get("
},
{
"char_start": 275,
"char_end": 276,
"chars": ")"
}
],
"added": [
{
"char_start": 249,
"char_end": 260,
"chars": "cgi.escape("
},
{
"char_start": 272,
... | github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93 | evennia/server/portal/webclient_ajax.py | cwe-079 |
get_queryset | def get_queryset(self, **kwargs):
queryset = Article.objects.order_by('-time')
for i in queryset:
i.md = markdown(i.content, extensions=[
'markdown.extensions.extra',
'markdown.extensions.codehilite',
'markdown.extensions.toc',
... | def get_queryset(self, **kwargs):
queryset = Article.objects.order_by('-time')
for i in queryset:
i.md = safe_md(i.content)
return queryset | {
"deleted": [
{
"line_no": 4,
"char_start": 118,
"char_end": 170,
"line": " i.md = markdown(i.content, extensions=[\n"
},
{
"line_no": 5,
"char_start": 170,
"char_end": 215,
"line": " 'markdown.extensions.extra',\n"
},
{
... | {
"deleted": [
{
"char_start": 137,
"char_end": 162,
"chars": "markdown(i.content, exten"
},
{
"char_start": 163,
"char_end": 188,
"chars": "ions=[\n 'm"
},
{
"char_start": 189,
"char_end": 196,
"chars": "rkdown."
},
{
... | github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c | app/Index/views.py | cwe-079 |
screenshotcommentcounts | @register.tag
@basictag(takes_context=True)
def screenshotcommentcounts(context, screenshot):
"""
Returns a JSON array of current comments for a screenshot.
Each entry in the array has a dictionary containing the following keys:
=========== ==================================================
Ke... | @register.tag
@basictag(takes_context=True)
def screenshotcommentcounts(context, screenshot):
"""
Returns a JSON array of current comments for a screenshot.
Each entry in the array has a dictionary containing the following keys:
=========== ==================================================
Ke... | {
"deleted": [
{
"line_no": 32,
"char_start": 1249,
"char_end": 1287,
"line": " 'text': comment.text,\n"
}
],
"added": [
{
"line_no": 32,
"char_start": 1249,
"char_end": 1295,
"line": " 'text': escape(comment.text),\n"
}... | {
"deleted": [],
"added": [
{
"char_start": 1273,
"char_end": 1280,
"chars": "escape("
},
{
"char_start": 1292,
"char_end": 1293,
"chars": ")"
}
]
} | github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d | reviewboard/reviews/templatetags/reviewtags.py | cwe-079 |
mode_input | def mode_input(self, request):
"""
This is called by render_POST when the client
is sending data to the server.
Args:
request (Request): Incoming request.
"""
csessid = request.args.get('csessid')[0]
self.last_alive[csessid] = (time.time(), Fals... | def mode_input(self, request):
"""
This is called by render_POST when the client
is sending data to the server.
Args:
request (Request): Incoming request.
"""
csessid = cgi.escape(request.args['csessid'][0])
self.last_alive[csessid] = (time.time(... | {
"deleted": [
{
"line_no": 10,
"char_start": 217,
"char_end": 266,
"line": " csessid = request.args.get('csessid')[0]\n"
},
{
"line_no": 11,
"char_start": 266,
"char_end": 267,
"line": "\n"
},
{
"line_no": 16,
"char_start": 433,
... | {
"deleted": [
{
"char_start": 247,
"char_end": 252,
"chars": ".get("
},
{
"char_start": 261,
"char_end": 262,
"chars": ")"
},
{
"char_start": 265,
"char_end": 266,
"chars": "\n"
}
],
"added": [
{
"char_start": 235,
"cha... | github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93 | evennia/server/portal/webclient_ajax.py | cwe-079 |
get_list_context | def get_list_context(context=None):
list_context = frappe._dict(
template = "templates/includes/blog/blog.html",
get_list = get_blog_list,
hide_filters = True,
children = get_children(),
# show_search = True,
title = _('Blog')
)
category = frappe.local.form_dict.blog_category or frappe.local.form_dict.c... | def get_list_context(context=None):
list_context = frappe._dict(
template = "templates/includes/blog/blog.html",
get_list = get_blog_list,
hide_filters = True,
children = get_children(),
# show_search = True,
title = _('Blog')
)
category = sanitize_html(frappe.local.form_dict.blog_category or frappe.loc... | {
"deleted": [
{
"line_no": 11,
"char_start": 244,
"char_end": 328,
"line": "\tcategory = frappe.local.form_dict.blog_category or frappe.local.form_dict.category\n"
},
{
"line_no": 23,
"char_start": 768,
"char_end": 853,
"line": "\t\tlist_context.sub_title =... | {
"deleted": [],
"added": [
{
"char_start": 256,
"char_end": 270,
"chars": "sanitize_html("
},
{
"char_start": 341,
"char_end": 342,
"chars": ")"
},
{
"char_start": 840,
"char_end": 854,
"chars": "sanitize_html("
},
{
"char_star... | github.com/omirajkar/bench_frappe/commit/2fa19c25066ed17478d683666895e3266936aee6 | frappe/website/doctype/blog_post/blog_post.py | cwe-079 |
mode_init | def mode_init(self, request):
"""
This is called by render_POST when the client requests an init
mode operation (at startup)
Args:
request (Request): Incoming request.
"""
csessid = request.args.get('csessid')[0]
remote_addr = request.getClientI... | def mode_init(self, request):
"""
This is called by render_POST when the client requests an init
mode operation (at startup)
Args:
request (Request): Incoming request.
"""
csessid = cgi.escape(request.args['csessid'][0])
remote_addr = request.ge... | {
"deleted": [
{
"line_no": 10,
"char_start": 230,
"char_end": 279,
"line": " csessid = request.args.get('csessid')[0]\n"
}
],
"added": [
{
"line_no": 10,
"char_start": 230,
"char_end": 287,
"line": " csessid = cgi.escape(request.args['cses... | {
"deleted": [
{
"char_start": 260,
"char_end": 265,
"chars": ".get("
},
{
"char_start": 274,
"char_end": 275,
"chars": ")"
}
],
"added": [
{
"char_start": 248,
"char_end": 259,
"chars": "cgi.escape("
},
{
"char_start": 271,
... | github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93 | evennia/server/portal/webclient_ajax.py | cwe-079 |
handle_file | def handle_file(u: Profile, headline: str, category: str, text: str, file):
m: Media = Media()
upload_base_path: str = 'uploads/' + str(date.today().year)
high_res_file_name = upload_base_path + '/HIGHRES_' + ntpath.basename(file.name.replace(" ", "_"))
low_res_file_name = upload_base_path + '/LOWRES_' ... | def handle_file(u: Profile, headline: str, category: str, text: str, file):
m: Media = Media()
upload_base_path: str = 'uploads/' + str(date.today().year)
high_res_file_name = upload_base_path + '/HIGHRES_' + ntpath.basename(file.name.replace(" ", "_"))
low_res_file_name = upload_base_path + '/LOWRES_' ... | {
"deleted": [
{
"line_no": 21,
"char_start": 1021,
"char_end": 1039,
"line": " m.text = text\n"
},
{
"line_no": 22,
"char_start": 1039,
"char_end": 1081,
"line": " m.cachedText = compile_markdown(text)\n"
},
{
"line_no": 23,
"char_... | {
"deleted": [],
"added": [
{
"char_start": 1034,
"char_end": 1041,
"chars": "escape("
},
{
"char_start": 1045,
"char_end": 1046,
"chars": ")"
},
{
"char_start": 1083,
"char_end": 1090,
"chars": "escape("
},
{
"char_start": 1094... | github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600 | c3shop/frontpage/management/mediatools/media_actions.py | cwe-079 |
commentcounts | @register.tag
@basictag(takes_context=True)
def commentcounts(context, filediff, interfilediff=None):
"""
Returns a JSON array of current comments for a filediff, sorted by
line number.
Each entry in the array has a dictionary containing the following keys:
=========== ==========================... | @register.tag
@basictag(takes_context=True)
def commentcounts(context, filediff, interfilediff=None):
"""
Returns a JSON array of current comments for a filediff, sorted by
line number.
Each entry in the array has a dictionary containing the following keys:
=========== ==========================... | {
"deleted": [
{
"line_no": 41,
"char_start": 1548,
"char_end": 1586,
"line": " 'text': comment.text,\n"
}
],
"added": [
{
"line_no": 41,
"char_start": 1548,
"char_end": 1594,
"line": " 'text': escape(comment.text),\n"
}... | {
"deleted": [],
"added": [
{
"char_start": 1572,
"char_end": 1579,
"chars": "escape("
},
{
"char_start": 1591,
"char_end": 1592,
"chars": ")"
}
]
} | github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d | reviewboard/reviews/templatetags/reviewtags.py | cwe-079 |
oidc_handle_session_management_iframe_rp | static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c,
oidc_session_t *session, const char *client_id,
const char *check_session_iframe) {
oidc_debug(r, "enter");
const char *java_script =
" <script type=\"text/javascript\">\n"
" var targetOrigin = '%s';\n"
" var... | static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c,
oidc_session_t *session, const char *client_id,
const char *check_session_iframe) {
oidc_debug(r, "enter");
const char *java_script =
" <script type=\"text/javascript\">\n"
" var targetOrigin = '%s';\n"
" var... | {
"deleted": [
{
"line_no": 21,
"char_start": 743,
"char_end": 803,
"line": "\t\t\t\" timerID = setInterval('checkSession()', %s);\\n\"\n"
},
{
"line_no": 64,
"char_start": 2273,
"char_end": 2303,
"line": "\tif (s_poll_interval == NULL)\n"
},
... | {
"deleted": [
{
"char_start": 796,
"char_end": 797,
"chars": "s"
},
{
"char_start": 2275,
"char_end": 2276,
"chars": "f"
},
{
"char_start": 2293,
"char_end": 2296,
"chars": " =="
},
{
"char_start": 2304,
"char_end": 2306,
... | github.com/zmartzone/mod_auth_openidc/commit/132a4111bf3791e76437619a66336dce2ce4c79b | src/mod_auth_openidc.c | cwe-079 |
Logger::addMessage | void Logger::addMessage(const QString &message, const Log::MsgType &type)
{
QWriteLocker locker(&lock);
Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, message };
m_messages.push_back(temp);
if (m_messages.size() >= MAX_LOG_MESSAGES)
m_messages.pop_front();
emit... | void Logger::addMessage(const QString &message, const Log::MsgType &type)
{
QWriteLocker locker(&lock);
Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, Utils::String::toHtmlEscaped(message) };
m_messages.push_back(temp);
if (m_messages.size() >= MAX_LOG_MESSAGES)
m_m... | {
"deleted": [
{
"line_no": 5,
"char_start": 109,
"char_end": 199,
"line": " Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, message };\n"
}
],
"added": [
{
"line_no": 5,
"char_start": 109,
"char_end": 229,
"line": " Log:... | {
"deleted": [],
"added": [
{
"char_start": 188,
"char_end": 217,
"chars": "Utils::String::toHtmlEscaped("
},
{
"char_start": 224,
"char_end": 225,
"chars": ")"
}
]
} | github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16 | src/base/logger.cpp | cwe-079 |
get | @handler.unsupported_on_local_server
@handler.get(handler.HTML)
def get(self):
"""Handle a get request."""
self.render(
'login.html', {
'apiKey': local_config.ProjectConfig().get('firebase.api_key'),
'authDomain': auth.auth_domain(),
'dest': self.request.get('de... | @handler.unsupported_on_local_server
@handler.get(handler.HTML)
def get(self):
"""Handle a get request."""
dest = self.request.get('dest')
base_handler.check_redirect_url(dest)
self.render(
'login.html', {
'apiKey': local_config.ProjectConfig().get('firebase.api_key'),
... | {
"deleted": [
{
"line_no": 9,
"char_start": 280,
"char_end": 326,
"line": " 'dest': self.request.get('dest'),\n"
}
],
"added": [
{
"line_no": 5,
"char_start": 117,
"char_end": 153,
"line": " dest = self.request.get('dest')\n"
},
{
... | {
"deleted": [
{
"char_start": 300,
"char_end": 318,
"chars": "self.request.get('"
},
{
"char_start": 322,
"char_end": 324,
"chars": "')"
}
],
"added": [
{
"char_start": 121,
"char_end": 200,
"chars": "dest = self.request.get('dest')\n b... | github.com/google/clusterfuzz/commit/3d66c1146550eecd4e34d47332a8616b435a21fe | src/appengine/handlers/login.py | cwe-079 |
manipulate_reservation_action | def manipulate_reservation_action(request: HttpRequest, default_foreward_url: str):
"""
This function is used to alter the reservation beeing build inside
a cookie. This function automatically crafts the required response.
"""
js_string: str = ""
r: GroupReservation = None
u: Profile = get_c... | def manipulate_reservation_action(request: HttpRequest, default_foreward_url: str):
"""
This function is used to alter the reservation beeing build inside
a cookie. This function automatically crafts the required response.
"""
js_string: str = ""
r: GroupReservation = None
u: Profile = get_c... | {
"deleted": [
{
"line_no": 22,
"char_start": 869,
"char_end": 914,
"line": " sr.notes = request.POST[\"notes\"]\n"
},
{
"line_no": 42,
"char_start": 1748,
"char_end": 1788,
"line": " r.notes = request.POST[\"notes\"]\n"
},
{
... | {
"deleted": [],
"added": [
{
"char_start": 892,
"char_end": 899,
"chars": "escape("
},
{
"char_start": 920,
"char_end": 921,
"chars": ")"
},
{
"char_start": 1774,
"char_end": 1781,
"chars": "escape("
},
{
"char_start": 1802,
... | github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600 | c3shop/frontpage/management/reservation_actions.py | cwe-079 |
html_content | @property
async def html_content(self):
content = await self.content
if not content:
return ''
return markdown(content) | @property
async def html_content(self):
content = markupsafe.escape(await self.content)
if not content:
return ''
return markdown(content) | {
"deleted": [
{
"line_no": 3,
"char_start": 48,
"char_end": 85,
"line": " content = await self.content\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 48,
"char_end": 104,
"line": " content = markupsafe.escape(await self.content)\n"
}... | {
"deleted": [],
"added": [
{
"char_start": 66,
"char_end": 84,
"chars": "markupsafe.escape("
},
{
"char_start": 102,
"char_end": 103,
"chars": ")"
}
]
} | github.com/dongweiming/lyanna/commit/fcefac79e4b7601e81a3b3fe0ad26ab18ee95d7d | models/comment.py | cwe-079 |
get_context_data | def get_context_data(self, *args, **kwargs):
data = super().get_context_data(*args, **kwargs)
if self.request.GET.get('back', None) is not None:
data['back_link'] = self.request.GET['back']
return data | def get_context_data(self, *args, **kwargs):
data = super().get_context_data(*args, **kwargs)
back = self.request.GET.get('back', None)
parsed_back_url = urllib.parse.urlparse(back)
# We only allow blank scheme, e.g. relative urls to avoid reflected XSS
if back is not None ... | {
"deleted": [
{
"line_no": 4,
"char_start": 107,
"char_end": 166,
"line": " if self.request.GET.get('back', None) is not None:\n"
},
{
"line_no": 5,
"char_start": 166,
"char_end": 223,
"line": " data['back_link'] = self.request.GET['back']... | {
"deleted": [
{
"char_start": 115,
"char_end": 117,
"chars": "if"
},
{
"char_start": 198,
"char_end": 216,
"chars": "self.request.GET['"
},
{
"char_start": 220,
"char_end": 222,
"chars": "']"
}
],
"added": [
{
"char_start": 1... | github.com/pirati-web/socialnisystem.cz/commit/1bd25d971ac3f9ac7ae3915cc2dd86b0ceb44b53 | socialsystem/core/views.py | cwe-079 |
add_article_action | def add_article_action(request: HttpRequest, default_foreward_url: str):
forward_url: str = default_foreward_url
if request.GET.get("redirect"):
forward_url = request.GET["redirect"]
else:
forward_url = "/admin"
if "rid" not in request.GET:
return HttpResponseRedirect("/admin?err... | def add_article_action(request: HttpRequest, default_foreward_url: str):
forward_url: str = default_foreward_url
if request.GET.get("redirect"):
forward_url = request.GET["redirect"]
else:
forward_url = "/admin"
if "rid" not in request.GET:
return HttpResponseRedirect("/admin?err... | {
"deleted": [
{
"line_no": 20,
"char_start": 954,
"char_end": 997,
"line": " notes: str = request.POST[\"notes\"]\n"
},
{
"line_no": 45,
"char_start": 2195,
"char_end": 2269,
"line": " ar.notes = str(request.POST[str(\"notes_\" + str(a... | {
"deleted": [],
"added": [
{
"char_start": 975,
"char_end": 982,
"chars": "escape("
},
{
"char_start": 1003,
"char_end": 1004,
"chars": ")"
},
{
"char_start": 2230,
"char_end": 2237,
"chars": "escape("
},
{
"char_start": 2282,
... | github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600 | c3shop/frontpage/management/reservation_actions.py | cwe-079 |
build_board | def build_board(conn, game,size):
# we'll build the empty board, and then fill in with the move list that
# we get from the DB.
board = []
for i in range(size):
board.append([""]*size)
# search for all moves that have happenend during this game.
cursor = conn.cursor()
cursor.execut... | def build_board(conn, game,size):
# we'll build the empty board, and then fill in with the move list that
# we get from the DB.
board = []
for i in range(size):
board.append([""]*size)
# search for all moves that have happenend during this game.
cursor = conn.cursor()
cursor.execut... | {
"deleted": [
{
"line_no": 11,
"char_start": 303,
"char_end": 380,
"line": " cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\" % game)\n"
}
],
"added": [
{
"line_no": 11,
"char_start": 303,
"char_end": 382,
"line": " cursor.execut... | {
"deleted": [
{
"char_start": 371,
"char_end": 373,
"chars": " %"
}
],
"added": [
{
"char_start": 371,
"char_end": 372,
"chars": ","
},
{
"char_start": 373,
"char_end": 374,
"chars": "("
},
{
"char_start": 378,
"char_en... | github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da | cgi/common.py | cwe-089 |
check_and_update_ranks | def check_and_update_ranks(self, scene):
# There are 2 cases here:
# 1) Ranks have never been calculated for this scene before
# - This means we need to calculate what the ranks were every month of this scenes history
# - We should only do this if ranks don't already ex... | def check_and_update_ranks(self, scene):
# There are 2 cases here:
# 1) Ranks have never been calculated for this scene before
# - This means we need to calculate what the ranks were every month of this scenes history
# - We should only do this if ranks don't already ex... | {
"deleted": [
{
"line_no": 12,
"char_start": 763,
"char_end": 838,
"line": " sql = 'select count(*) from ranks where scene=\"{}\";'.format(scene)\n"
},
{
"line_no": 13,
"char_start": 838,
"char_end": 870,
"line": " res = self.db.exec(sql)\n"
... | {
"deleted": [
{
"char_start": 823,
"char_end": 826,
"chars": ".fo"
},
{
"char_start": 827,
"char_end": 831,
"chars": "mat("
},
{
"char_start": 836,
"char_end": 837,
"chars": ")"
},
{
"char_start": 1864,
"char_end": 1867,
... | github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63 | process_data.py | cwe-089 |
tag_num_to_tag | def tag_num_to_tag(self, tag_num):
''' Returns tag given tag_num. '''
q = "SELECT tag FROM tags WHERE rowid = '" + str(tag_num) + "'"
self.query(q)
return self.c.fetchone()[0] | def tag_num_to_tag(self, tag_num):
''' Returns tag given tag_num. '''
q = "SELECT tag FROM tags WHERE rowid = ?"
self.query(q, tag_num)
return self.c.fetchone()[0] | {
"deleted": [
{
"line_no": 4,
"char_start": 83,
"char_end": 155,
"line": " q = \"SELECT tag FROM tags WHERE rowid = '\" + str(tag_num) + \"'\"\n"
},
{
"line_no": 5,
"char_start": 155,
"char_end": 177,
"line": " self.query(q)\n"
}
],
"a... | {
"deleted": [
{
"char_start": 131,
"char_end": 153,
"chars": "'\" + str(tag_num) + \"'"
}
],
"added": [
{
"char_start": 131,
"char_end": 132,
"chars": "?"
},
{
"char_start": 154,
"char_end": 163,
"chars": ", tag_num"
}
]
} | github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b | modules/query_lastfm.py | cwe-089 |
get_item | @api.route('/items/<int:item_id>', methods=['GET'])
def get_item(item_id):
sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)
cursor = mysql.connection.cursor()
cursor.execute(sql)
data = cursor.fetchone()
if data:
item = {}
for tu... | @api.route('/items/<int:item_id>', methods=['GET'])
def get_item(item_id):
sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = %s AND auctionable = true;'''
cursor = mysql.connection.cursor()
cursor.execute(sql, [item_id])
data = cursor.fetchone()
if data:
item = {}
for tup in ... | {
"deleted": [
{
"line_no": 3,
"char_start": 75,
"char_end": 182,
"line": " sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)\n"
},
{
"line_no": 5,
"char_start": 221,
"char_end": 245,
"line": " curso... | {
"deleted": [
{
"char_start": 136,
"char_end": 138,
"chars": "{}"
},
{
"char_start": 165,
"char_end": 181,
"chars": ".format(item_id)"
}
],
"added": [
{
"char_start": 136,
"char_end": 138,
"chars": "%s"
},
{
"char_start": 227... | github.com/cosileone/TimeIsMoneyFriend-API/commit/3d3b5defd26ef7d205915bf643b6b1df90a15e44 | timf/api/views.py | cwe-089 |
getPostsByPostid | def getPostsByPostid(self,postid):
sqlText="select users.name,post.comment from users,post where \
users.userid=post.userid and post.postid=%d"%(postid)
result=sql.queryDB(self.conn,sqlText)
return result; | def getPostsByPostid(self,postid):
sqlText="select users.name,post.comment from users,post where \
users.userid=post.userid and post.postid=%s"
params=[postid]
result=sql.queryDB(self.conn,sqlText,params)
return result; | {
"deleted": [
{
"line_no": 3,
"char_start": 111,
"char_end": 181,
"line": " users.userid=post.userid and post.postid=%d\"%(postid)\n"
},
{
"line_no": 4,
"char_start": 181,
"char_end": 227,
"line": " result=sql.queryDB(self.conn,sqlText... | {
"deleted": [
{
"char_start": 169,
"char_end": 170,
"chars": "d"
},
{
"char_start": 171,
"char_end": 173,
"chars": "%("
},
{
"char_start": 179,
"char_end": 180,
"chars": ")"
}
],
"added": [
{
"char_start": 169,
"char_en... | github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9 | modules/post.py | cwe-089 |
getFileCacheID | def getFileCacheID(self, pth):
"""
Returns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.
:param pth:
:return:
"""
command = "SELECT file_id FROM {0} WHERE path='{1}'".format(TABLE_NAME, pth)
data = self._run_command(command)
try:
data = data[0][0]
except... | def getFileCacheID(self, pth):
"""
Returns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.
:param pth:
:return:
"""
command = "SELECT file_id FROM {0} WHERE path=?;".format(TABLE_NAME)
params = (pth,)
data = self._run_command(command, params)
try:
data = d... | {
"deleted": [
{
"line_no": 7,
"char_start": 168,
"char_end": 247,
"line": "\t\tcommand = \"SELECT file_id FROM {0} WHERE path='{1}'\".format(TABLE_NAME, pth)\n"
},
{
"line_no": 8,
"char_start": 247,
"char_end": 283,
"line": "\t\tdata = self._run_command(com... | {
"deleted": [
{
"char_start": 216,
"char_end": 221,
"chars": "'{1}'"
},
{
"char_start": 240,
"char_end": 241,
"chars": ","
}
],
"added": [
{
"char_start": 216,
"char_end": 218,
"chars": "?;"
},
{
"char_start": 237,
"cha... | github.com/Highstaker/Picture-sender-telegram-bot/commit/db4bc6adb41e086418761426ff4958a81c30adca | file_db.py | cwe-089 |
add_post | def add_post(content):
"""Add a post to the 'database' with the current timestamp."""
db = psycopg2.connect(database=DBNAME)
c = db.cursor()
c.execute("insert into posts values('%s')" % content)
db.commit()
db.close() | def add_post(content):
"""Add a post to the 'database' with the current timestamp."""
db = psycopg2.connect(database=DBNAME)
c = db.cursor()
c.execute("insert into posts values(%s)",(content,))
db.commit()
db.close() | {
"deleted": [
{
"line_no": 5,
"char_start": 147,
"char_end": 203,
"line": " c.execute(\"insert into posts values('%s')\" % content)\n"
}
],
"added": [
{
"line_no": 5,
"char_start": 147,
"char_end": 202,
"line": " c.execute(\"insert into posts values(%... | {
"deleted": [
{
"char_start": 185,
"char_end": 186,
"chars": "'"
},
{
"char_start": 188,
"char_end": 189,
"chars": "'"
},
{
"char_start": 191,
"char_end": 194,
"chars": " % "
}
],
"added": [
{
"char_start": 189,
"char_e... | github.com/tfalbo/SuzyMakeup/commit/1a5d6ccf02bec303d454f87a6bb39baed30c205f | vagrant/forum/forumdb.py | cwe-089 |
getSubmissionDateFromDatabase | def getSubmissionDateFromDatabase(submission):
database = sqlite3.connect('database.db')
cursor = database.cursor()
return cursor.execute("SELECT Date FROM ChallengeRankings WHERE SubmissionID = '" + str(submission.id) + "'").fetchone()[0]
database.close() | def getSubmissionDateFromDatabase(submission):
database = sqlite3.connect('database.db')
cursor = database.cursor()
return cursor.execute("SELECT Date FROM ChallengeRankings WHERE SubmissionID = ?", [str(submission.id)]).fetchone()[0]
database.close() | {
"deleted": [
{
"line_no": 4,
"char_start": 124,
"char_end": 252,
"line": " return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = '\" + str(submission.id) + \"'\").fetchone()[0]\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 124,
... | {
"deleted": [
{
"char_start": 207,
"char_end": 208,
"chars": "'"
},
{
"char_start": 209,
"char_end": 211,
"chars": " +"
},
{
"char_start": 230,
"char_end": 236,
"chars": " + \"'\""
}
],
"added": [
{
"char_start": 207,
"... | github.com/LiquidFun/Reddit-GeoGuessr-Tracking-Bot/commit/0cad2d52e24b05da32789fbc8face7a9999a71f9 | CheckAndPostForSeriesSubmissions.py | cwe-089 |
ranks | @endpoints.route("/ranks")
def ranks():
if db == None:
init()
scene = request.args.get('scene', default='austin')
date = request.args.get('date')
# If no date was provided, pick the date of the latest tournament
if date == None:
sql = "SELECT distinct date FROM ranks WHERE scene='... | @endpoints.route("/ranks")
def ranks():
if db == None:
init()
scene = request.args.get('scene', default='austin')
date = request.args.get('date')
# If no date was provided, pick the date of the latest tournament
if date == None:
sql = "SELECT distinct date FROM ranks WHERE scene='... | {
"deleted": [
{
"line_no": 11,
"char_start": 260,
"char_end": 367,
"line": " sql = \"SELECT distinct date FROM ranks WHERE scene='{}' ORDER BY date DESC LIMIT 1;\".format(scene)\n"
},
{
"line_no": 12,
"char_start": 367,
"char_end": 394,
"line": " ... | {
"deleted": [
{
"char_start": 352,
"char_end": 355,
"chars": ".fo"
},
{
"char_start": 356,
"char_end": 360,
"chars": "mat("
},
{
"char_start": 365,
"char_end": 366,
"chars": ")"
},
{
"char_start": 544,
"char_end": 547,
... | github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63 | endpoints.py | cwe-089 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.