The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Error code: DatasetGenerationCastError
Exception: DatasetGenerationCastError
Message: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 2 new columns ({'function_code', 'class'}) and 2 missing columns ({'vulnerable_function_source', 'label'}).
This happened while the csv dataset builder was generating data using
hf://datasets/S-AIR-L/PyCode-Vul/PyCode_Vul test-set.csv (at revision 7194453958d94a8102aec86e925952eb2c6e73d3), [/tmp/hf-datasets-cache/medium/datasets/40362150508700-config-parquet-and-info-S-AIR-L-PyCode-Vul-2954e457/hub/datasets--S-AIR-L--PyCode-Vul/snapshots/7194453958d94a8102aec86e925952eb2c6e73d3/PyCode_Vul test-set.csv (origin=hf://datasets/S-AIR-L/PyCode-Vul@7194453958d94a8102aec86e925952eb2c6e73d3/PyCode_Vul test-set.csv)]
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1800, in _prepare_split_single
writer.write_table(table)
File "/usr/local/lib/python3.12/site-packages/datasets/arrow_writer.py", line 765, in write_table
self._write_table(pa_table, writer_batch_size=writer_batch_size)
File "/usr/local/lib/python3.12/site-packages/datasets/arrow_writer.py", line 773, in _write_table
pa_table = table_cast(pa_table, self._schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2281, in table_cast
return cast_table_to_schema(table, schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2227, in cast_table_to_schema
raise CastError(
datasets.table.CastError: Couldn't cast
__source_file: string
cve_ids: string
cwe_ids: string
file_path: string
class: int64
patched_function_source: string
predicted_cwe_ids: string
repo: string
sha: string
function_code: string
-- schema metadata --
pandas: '{"index_columns": [{"kind": "range", "name": null, "start": 0, "' + 1461
to
{'__source_file': Value('string'), 'cve_ids': Value('string'), 'cwe_ids': Value('string'), 'file_path': Value('string'), 'label': Value('int64'), 'patched_function_source': Value('string'), 'predicted_cwe_ids': Value('string'), 'repo': Value('string'), 'sha': Value('string'), 'vulnerable_function_source': Value('string')}
because column names don't match
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1347, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 980, in convert_to_parquet
builder.download_and_prepare(
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 882, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 943, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1646, in _prepare_split
for job_id, done, content in self._prepare_split_single(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1802, in _prepare_split_single
raise DatasetGenerationCastError.from_cast_error(
datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 2 new columns ({'function_code', 'class'}) and 2 missing columns ({'vulnerable_function_source', 'label'}).
This happened while the csv dataset builder was generating data using
hf://datasets/S-AIR-L/PyCode-Vul/PyCode_Vul test-set.csv (at revision 7194453958d94a8102aec86e925952eb2c6e73d3), [/tmp/hf-datasets-cache/medium/datasets/40362150508700-config-parquet-and-info-S-AIR-L-PyCode-Vul-2954e457/hub/datasets--S-AIR-L--PyCode-Vul/snapshots/7194453958d94a8102aec86e925952eb2c6e73d3/PyCode_Vul test-set.csv (origin=hf://datasets/S-AIR-L/PyCode-Vul@7194453958d94a8102aec86e925952eb2c6e73d3/PyCode_Vul test-set.csv)]
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
__source_file string | cve_ids string | cwe_ids string | file_path string | label int64 | patched_function_source string | predicted_cwe_ids string | repo string | sha string | vulnerable_function_source string |
|---|---|---|---|---|---|---|---|---|---|
null | UNKNOWN | UNKNOWN | tests/store/artifact/test_azure_blob_artifact_repo.py | 1 | def test_list_artifacts_empty(mock_client):
repo = AzureBlobArtifactRepository(TEST_URI, mock_client)
mock_client.get_container_client().walk_blobs.return_value = MockBlobList([])
assert repo.list_artifacts() == [] | CWE-703 | mlflow/mlflow | 04708a9e52774e23e17bf73d6221be0758177a68 | def test_list_artifacts_empty(mock_client):
repo = AzureBlobArtifactRepository(TEST_URI, mock_client)
mock_client.get_container_client().walk_blobs.return_value = MockBlobList([])
assert repo.list_artifacts() == [] |
null | UNKNOWN | UNKNOWN | tests/test_config.py | 1 | def test_config_from_envvar_missing(monkeypatch):
monkeypatch.setattr("os.environ", {"FOO_SETTINGS": "missing.cfg"})
with pytest.raises(IOError) as e:
app = flask.Flask(__name__)
app.config.from_envvar("FOO_SETTINGS")
msg = str(e.value)
assert msg.startswith(
"[Errno 2] Unable to... | CWE-703 | pallets/flask | d4b688bd035b9704b3168b28fed39c8fcfe3b997 | def test_config_from_envvar_missing(monkeypatch):
monkeypatch.setattr("os.environ", {"FOO_SETTINGS": "missing.cfg"})
with pytest.raises(IOError) as e:
app = flask.Flask(__name__)
app.config.from_envvar("FOO_SETTINGS")
msg = str(e.value)
assert msg.startswith(
"[Errno 2] Unable to... |
null | UNKNOWN | UNKNOWN | django/core/management/templates.py | 1 | def handle(self, app_or_project, name, target=None, **options):
self.app_or_project = app_or_project
self.paths_to_remove = []
self.verbosity = int(options.get('verbosity'))
self.validate_name(name, app_or_project)
# if some directory is given, make sure it's nicely expanded
... | CWE-79 | django/django | 9893fa12b735f3f47b35d4063d86dddf3145cb25 | def handle(self, app_or_project, name, target=None, **options):
self.app_or_project = app_or_project
self.paths_to_remove = []
self.verbosity = int(options.get('verbosity'))
# If it's not a valid directory name.
if not re.search(r'^[_a-zA-Z]\w*$', name):
# Provide a ... |
functions_for_w3af_with_cwe.csv | UNKNOWN | UNKNOWN | lib/techniques/inband/union/test.py | 0 | def __unionTestByCharBruteforce(comment):
"""
This method tests if the target url is affected by an inband
SQL injection vulnerability. The test is done up to 50 columns
on the target database table
"""
query = agent.prefixQuery("UNION ALL SELECT %s" % conf.uChar)
for count in range(conf.u... | null | andresriancho/w3af | c23126547e7f087a35d04fb5adb5d38ce39a4b9c | def __unionTestByCharBruteforce(comment):
"""
This method tests if the target url is affected by an inband
SQL injection vulnerability. The test is done up to 50 columns
on the target database table
"""
query = agent.prefixQuery("UNION ALL SELECT %s" % conf.uChar)
for count in range(1, con... |
functions_for_mlflow_with_cwe.csv | UNKNOWN | UNKNOWN | mlflow/keras.py | 0 | def save_model(keras_model, path, conda_env=None, mlflow_model=Model()):
"""
Save a Keras model to a path on the local file system.
:param keras_model: Keras model to be saved.
:param path: Local path where the model is to be saved.
:param conda_env: Either a dictionary representation of a Conda en... | null | mlflow/mlflow | fd14ec54114f967f28b8e5c3919985e3164f3a4c | def save_model(keras_model, path, conda_env=None, mlflow_model=Model()):
"""
Save a Keras model to a path on the local file system.
:param keras_model: Keras model to be saved.
:param path: Local path where the model is to be saved.
:param conda_env: Either a dictionary representation of a Conda en... |
functions_for_salt_with_cwe.csv | UNKNOWN | UNKNOWN | salt/modules/freebsd_sysctl.py | 0 | def show(config_file=False):
'''
Return a list of sysctl parameters for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
'''
roots = (
'compat',
'debug',
'dev',
'hptmv',
'hw',
'kern',
'machdep',
'net',
... | null | saltstack/salt | a47fa8880fc5f7896979301213d13a80b8bfc2ee | def show(config_file=False):
'''
Return a list of sysctl parameters for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
'''
roots = (
'compat',
'debug',
'dev',
'hptmv',
'hw',
'kern',
'machdep',
'net',
... |
null | UNKNOWN | UNKNOWN | tests/jobs/test_local_task_job.py | 1 | def test_localtaskjob_heartbeat(self, dag_maker):
session = settings.Session()
with dag_maker('test_localtaskjob_heartbeat'):
op1 = DummyOperator(task_id='op1')
dr = dag_maker.create_dagrun()
ti = dr.get_task_instance(task_id=op1.task_id, session=session)
ti.state = ... | CWE-703 | apache/airflow | d2eab1de0c3ee93e5e1c7830ffcfdb534657fc21 | def test_localtaskjob_heartbeat(self, dag_maker):
session = settings.Session()
with dag_maker('test_localtaskjob_heartbeat'):
op1 = DummyOperator(task_id='op1')
dr = dag_maker.create_dagrun()
ti = dr.get_task_instance(task_id=op1.task_id, session=session)
ti.state = ... |
null | UNKNOWN | UNKNOWN | salt/utils/templates.py | 1 | def render_tmpl(tmplsrc,
from_str=False,
to_str=False,
context=None,
tmplpath=None,
**kws):
if context is None:
context = {}
# Alias cmd.run to cmd.shell to make python_shell=True the defaul... | CWE-703 | saltstack/salt | 3ad69c8fabe76e45426950c99b6e43b28340f2f9 | def render_tmpl(tmplsrc,
from_str=False,
to_str=False,
context=None,
tmplpath=None,
**kws):
if context is None:
context = {}
# Alias cmd.run to cmd.shell to make python_shell=True the defaul... |
null | UNKNOWN | UNKNOWN | tests/operators/test_trigger_dagrun.py | 1 | def assert_extra_link(self, triggered_dag_run, triggering_task, session):
"""
Asserts whether the correct extra links url will be created.
Specifically it tests whether the correct dag id and date are passed to
the method which constructs the final url.
Note: We can't run that m... | CWE-703 | apache/airflow | 8b3c24f273d5ee818ded1cb8bc29bb9b7e44b625 | def assert_extra_link(self, triggered_dag_run, triggering_task, session):
"""
Asserts whether the correct extra links url will be created.
Specifically it tests whether the correct dag id and date are passed to
the method which constructs the final url.
Note: We can't run that m... |
null | UNKNOWN | UNKNOWN | providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_msgraph.py | 1 | def test_execute_with_new_result_processor_signature(self):
users = load_json_from_resources(dirname(__file__), "..", "resources", "users.json")
next_users = load_json_from_resources(dirname(__file__), "..", "resources", "next_users.json")
response = mock_json_response(200, users, next_users)
... | CWE-703 | apache/airflow | b835219e1ee723bc24b914e949e409e3cd785715 | def test_execute_with_new_result_processor_signature(self):
users = load_json_from_resources(dirname(__file__), "..", "resources", "users.json")
next_users = load_json_from_resources(dirname(__file__), "..", "resources", "next_users.json")
response = mock_json_response(200, users, next_users)
... |
null | UNKNOWN | UNKNOWN | django/contrib/admin/options.py | 1 | def change_view(self, request, object_id, extra_context=None):
"The 'change' admin view for this model."
model = self.model
opts = model._meta
try:
obj = self.queryset(request).get(pk=object_id)
except model.DoesNotExist:
# Don't raise Http404 just yet, b... | CWE-79 | django/django | 906f55bf0975e6aa4eb63f4ca71e54baff200bf8 | def change_view(self, request, object_id, extra_context=None):
"The 'change' admin view for this model."
model = self.model
opts = model._meta
try:
obj = model._default_manager.get(pk=object_id)
except model.DoesNotExist:
# Don't raise Http404 just yet, b... |
null | UNKNOWN | UNKNOWN | lib/core/update.py | 1 | def update():
if not conf.updateAll:
return
success = False
if TYPE == "pip":
infoMsg = "updating sqlmap to the latest stable version from the "
infoMsg += "PyPI repository"
logger.info(infoMsg)
debugMsg = "sqlmap will try to update itself using 'pip' command"
... | CWE-78, CWE-703 | sqlmapproject/sqlmap | df4293473d2fb6e887e31522cab5aff95e201581 | def update():
if not conf.updateAll:
return
success = False
if TYPE == "pip":
infoMsg = "updating sqlmap to the latest stable version from the "
infoMsg += "PyPI repository"
logger.info(infoMsg)
debugMsg = "sqlmap will try to update itself using 'pip' command"
... |
functions_for_django_with_cwe.csv | UNKNOWN | UNKNOWN | django/db/models/sql/compiler.py | 0 | def as_sql(self, with_limits=True, with_col_aliases=False):
"""
Create the SQL for this query. Return the SQL string and list of
parameters.
If 'with_limits' is False, any limit/offset information is not included
in the query.
"""
refcounts_before = self.query.al... | CWE-Unknown | django/django | db7d7901eeacf37f0a6f124e3733c4f121a23e76 | def as_sql(self, with_limits=True, with_col_aliases=False):
"""
Create the SQL for this query. Return the SQL string and list of
parameters.
If 'with_limits' is False, any limit/offset information is not included
in the query.
"""
refcounts_before = self.query.al... |
null | UNKNOWN | UNKNOWN | django/contrib/admin/views/decorators.py | 1 | def staff_member_required(view_func):
"""
Decorator for views that checks that the user is logged in and is a staff
member, displaying the login page if necessary.
"""
def _checklogin(request, *args, **kwargs):
if request.user.is_staff:
# The user is valid. Continue to the admin ... | CWE-703 | django/django | 933b9e8de7cfae0a271283c11cccbb9897e30a46 | def staff_member_required(view_func):
"""
Decorator for views that checks that the user is logged in and is a staff
member, displaying the login page if necessary.
"""
def _checklogin(request, *args, **kwargs):
if request.user.is_authenticated() and request.user.is_staff:
# The u... |
functions_for_w3af_with_cwe.csv | UNKNOWN | UNKNOWN | plugins/audit/fileUpload.py | 0 | def _get_files( self ):
'''
If the extension is in the templates dir, open it and return the handler.
If the extension aint in the templates dir, create a file with random content, open it and return the handler.
@return: A list of open files.
'''
result = []
# A... | null | andresriancho/w3af | 068e2ed8efdad2aed80560c1c979b1bd2d0b3648 | def _get_files( self ):
'''
If the extension is in the templates dir, open it and return the handler.
If the extension aint in the templates dir, create a file with random content, open it and return the handler.
@return: A list of open files.
'''
result = []
# A... |
null | UNKNOWN | UNKNOWN | extra/vulnserver/vulnserver.py | 1 | def do_REQUEST(self):
path, query = self.path.split('?', 1) if '?' in self.path else (self.path, "")
params = {}
if query:
params.update(parse_qs(query))
if "<script>" in unquote_plus(query):
self.send_response(INTERNAL_SERVER_ERROR)
self... | CWE-89 | sqlmapproject/sqlmap | 1c179674d84d53539645c839f6a592b65444c4ff | def do_REQUEST(self):
path, query = self.path.split('?', 1) if '?' in self.path else (self.path, "")
params = {}
if query:
params.update(parse_qs(query))
if "<script>" in unquote_plus(query):
self.send_response(INTERNAL_SERVER_ERROR)
self... |
functions_for_tornado_with_cwe.csv | UNKNOWN | UNKNOWN | tornado/auth.py | 0 | def get_authenticated_user(self, redirect_uri, client_id, client_secret,
code, callback, extra_fields=None):
"""Handles the login for the Facebook user, returning a user object.
Example usage:
.. testcode::
class FacebookGraphLoginHandler(tornado.web... | CWE-Unknown | tornadoweb/tornado | 0a706fa666da91162466ae0d0d79d6dbfe923216 | def get_authenticated_user(self, redirect_uri, client_id, client_secret,
code, callback, extra_fields=None):
"""Handles the login for the Facebook user, returning a user object.
Example usage:
.. testcode::
class FacebookGraphLoginHandler(tornado.web... |
null | UNKNOWN | UNKNOWN | django/core/management/templates.py | 1 | def handle(self, app_or_project, name, target=None, **options):
self.app_or_project = app_or_project
self.a_or_an = "an" if app_or_project == "app" else "a"
self.paths_to_remove = []
self.verbosity = options["verbosity"]
self.validate_name(name)
# if some directory is g... | CWE-79 | django/django | 58cc91275a68bb42780cf0e663dad9ecf49039de | def handle(self, app_or_project, name, target=None, **options):
self.app_or_project = app_or_project
self.a_or_an = "an" if app_or_project == "app" else "a"
self.paths_to_remove = []
self.verbosity = options["verbosity"]
self.validate_name(name)
# if some directory is g... |
functions_for_volatility_with_cwe.csv | UNKNOWN | UNKNOWN | volatility/plugins/addrspaces/intel.py | 0 | def read_long_phys(self, addr):
'''
Returns an unsigned 32-bit integer from the address addr in
physical memory. If unable to read from that location, returns None.
'''
try:
string = self.base.read(addr, 4)
except IOError:
string = None
if ... | null | volatilityfoundation/volatility | 4bf541f12b99128cb77c377e30d98a17be8a4165 | def read_long_phys(self, addr):
'''
Returns an unsigned 32-bit integer from the address addr in
physical memory. If unable to read from that location, returns None.
'''
try:
string = self.base.read(addr, 4)
except IOError:
string = None
if ... |
functions_for_django_with_cwe.csv | UNKNOWN | UNKNOWN | django/db/models/fields/files.py | 0 | def _check_image_library_installed(self):
try:
from PIL import Image # NOQA
except ImportError:
return [
checks.Error(
'Cannot use ImageField because Pillow is not installed.',
hint=('Get Pillow at https://pypi.org/project/... | CWE-Unknown | django/django | b98fa241ddbb22507cb63886f697d25f43197cba | def _check_image_library_installed(self):
try:
from PIL import Image # NOQA
except ImportError:
return [
checks.Error(
'Cannot use ImageField because Pillow is not installed.',
hint=('Get Pillow at https://pypi.python.org/p... |
functions_for_mlflow_with_cwe.csv | UNKNOWN | UNKNOWN | mlflow/langchain/api_request_parallel_processor.py | 0 | def process_api_requests(
lc_model,
requests: Optional[List[Union[Any, Dict[str, Any]]]] = None,
max_workers: int = 10,
callback_handlers: Optional[List[BaseCallbackHandler]] = None,
convert_chat_responses: bool = False,
params: Optional[Dict[str, Any]] = None,
):
"""
Processes API reque... | null | mlflow/mlflow | 03df4a99f60bc3a76295c9acbd85e871f2de22b9 | def process_api_requests(
lc_model,
requests: Optional[List[Union[Any, Dict[str, Any]]]] = None,
max_workers: int = 10,
callback_handlers: Optional[List[BaseCallbackHandler]] = None,
convert_chat_responses: bool = False,
params: Optional[Dict[str, Any]] = None,
):
"""
Processes API reque... |
functions_for_salt_with_cwe.csv | UNKNOWN | UNKNOWN | salt/modules/opkg.py | 0 | def del_repo(repo, **kwargs): # pylint: disable=unused-argument
'''
Delete a repo from ``/etc/opkg/*.conf``
If the file does not contain any other repo configuration, the file itself
will be deleted.
CLI Examples:
.. code-block:: bash
salt '*' pkg.del_repo repo
'''
refresh =... | null | saltstack/salt | 3a3114d819093a0074c5e73ae5dffc3300201f08 | def del_repo(repo, **kwargs): # pylint: disable=unused-argument
'''
Delete a repo from ``/etc/opkg/*.conf``
If the file does not contain any other repo configuration, the file itself
will be deleted.
CLI Examples:
.. code-block:: bash
salt '*' pkg.del_repo repo
'''
refresh =... |
functions_for_sqlmap_with_cwe.csv | UNKNOWN | UNKNOWN | plugins/generic/syntax.py | 0 | def _escape(expression, quote=True, escaper=None):
retVal = expression
if quote:
for item in re.findall(r"'[^']*'+", expression, re.S):
retVal = retVal.replace(item, escaper(item[1:-1]))
else:
retVal = escaper(expression)
return retVal | null | sqlmapproject/sqlmap | 65c55a6a4920d67b10d705909864124776d3a2dc | def _escape(expression, quote=True, escaper=None):
retVal = expression
if quote:
for item in re.findall(r"'[^']+'", expression, re.S):
retVal = retVal.replace(item, escaper(item[1:-1]))
else:
retVal = escaper(expression)
return retVal |
functions_for_tornado_with_cwe.csv | UNKNOWN | UNKNOWN | maint/scripts/custom_fixers/fix_future_imports.py | 0 | def finish_tree(self, tree, filename):
if self.found_future_import:
return
if not isinstance(tree, pytree.Node):
# Empty files (usually __init__.py) show up as a single Leaf
# instead of a Node, so leave them alone
return
first_stmt = tree.children... | CWE-Unknown | tornadoweb/tornado | 376cfc2102621b42fcf1f419b5260b33aa204c09 | def finish_tree(self, tree, filename):
if self.found_future_import:
return
if not isinstance(tree, pytree.Node):
# Empty files (usually __init__.py) show up as a single Leaf
# instead of a Node, so leave them alone
return
first_stmt = tree.children... |
null | UNKNOWN | UNKNOWN | tests/providers/google/cloud/operators/test_bigquery.py | 1 | def test_execute_reattach(self, mock_hook):
job_id = "123456"
hash_ = "hash"
real_job_id = f"{job_id}_{hash_}"
configuration = {
"query": {
"query": "SELECT * FROM any",
"useLegacySql": False,
}
}
mock_hook.return_... | CWE-703 | apache/airflow | c29eeb18ec0f4ba260775f71968e5d75291b208f | def test_execute_reattach(self, mock_hook):
job_id = "123456"
hash_ = "hash"
real_job_id = f"{job_id}_{hash_}"
configuration = {
"query": {
"query": "SELECT * FROM any",
"useLegacySql": False,
}
}
mock_hook.return_... |
functions_for_bandit_with_cwe.csv | UNKNOWN | UNKNOWN | tests/functional/test_functional.py | 0 | def test_host_key_verification(self):
"""Test for ignoring host key verification."""
expect = {
"SEVERITY": {"UNDEFINED": 0, "LOW": 0, "MEDIUM": 0, "HIGH": 4},
"CONFIDENCE": {"UNDEFINED": 0, "LOW": 0, "MEDIUM": 4, "HIGH": 0},
}
self.check_example("no_host_key_veri... | UNKNOWN | PyCQA/bandit | 6969489ff711a1762bd44d00eaaba75f0c7102f6 | def test_host_key_verification(self):
"""Test for ignoring host key verification."""
expect = {
"SEVERITY": {"UNDEFINED": 0, "LOW": 0, "MEDIUM": 0, "HIGH": 2},
"CONFIDENCE": {"UNDEFINED": 0, "LOW": 0, "MEDIUM": 2, "HIGH": 0},
}
self.check_example("no_host_key_veri... |
null | UNKNOWN | UNKNOWN | tests/executors/test_base_executor.py | 1 | def test_trigger_running_tasks(can_try_mock, dag_maker, can_try_num, change_state_num, second_exec):
can_try_mock.side_effect = [True for _ in range(can_try_num)] + [False]
executor, dagrun = setup_trigger_tasks(dag_maker)
open_slots = 100
executor.trigger_tasks(open_slots)
expected_calls = len(dagr... | CWE-703 | apache/airflow | 9721e0b82d6102847b840955e8351cce06d4184a | def test_trigger_running_tasks(can_try_mock, dag_maker, can_try_num, change_state_num, second_exec):
can_try_mock.side_effect = [True for _ in range(can_try_num)] + [False]
executor, dagrun = setup_trigger_tasks(dag_maker)
open_slots = 100
executor.trigger_tasks(open_slots)
expected_calls = len(dagr... |
functions_for_airflow_with_cwe.csv | UNKNOWN | UNKNOWN | airflow/providers/apache/spark/hooks/spark_sql.py | 0 | def __init__(
self,
sql: str,
conf: Optional[str] = None,
conn_id: str = default_conn_name,
total_executor_cores: Optional[int] = None,
executor_cores: Optional[int] = None,
executor_memory: Optional[str] = None,
keytab: Optional[str] = None,
princ... | CWE-Unknown | apache/airflow | 485ff6cc64d8f6a15d8d6a0be50661fe6d04b2d9 | def __init__(
self,
sql: str,
conf: Optional[str] = None,
conn_id: str = default_conn_name,
total_executor_cores: Optional[int] = None,
executor_cores: Optional[int] = None,
executor_memory: Optional[str] = None,
keytab: Optional[str] = None,
princ... |
functions_for_bandit_with_cwe.csv | UNKNOWN | UNKNOWN | tests/unit/formatters/test_csv.py | 0 | def setUp(self):
super(CsvFormatterTests, self).setUp()
conf = config.BanditConfig()
self.manager = manager.BanditManager(conf, 'file')
(tmp_fd, self.tmp_fname) = tempfile.mkstemp()
self.context = {'filename': self.tmp_fname,
'lineno': 4,
... | UNKNOWN | PyCQA/bandit | 682c38b26854ecab96001adce25ebfe8d794ec16 | def setUp(self):
super(CsvFormatterTests, self).setUp()
conf = config.BanditConfig()
self.manager = manager.BanditManager(conf, 'file')
(tmp_fd, self.tmp_fname) = tempfile.mkstemp()
self.context = {'filename': self.tmp_fname,
'lineno': 4,
... |
null | UNKNOWN | UNKNOWN | tests/pytests/integration/states/test_file.py | 1 | def test_contents_pillar_with_pillar_list(salt_master, salt_call_cli, tmp_path):
"""
This tests for any regressions for this issue:
https://github.com/saltstack/salt/issues/30934
"""
target_path = tmp_path / "add-contents-pillar-target.txt"
sls_name = "file-contents-pillar"
sls_contents = ""... | CWE-703 | saltstack/salt | 9d335ba4ec20f89109b71753c0567e716795e755 | def test_contents_pillar_with_pillar_list(salt_master, salt_call_cli, tmp_path):
"""
This tests for any regressions for this issue:
https://github.com/saltstack/salt/issues/30934
"""
target_path = tmp_path / "add-contents-pillar-target.txt"
sls_name = "file-contents-pillar"
sls_contents = ""... |
null | UNKNOWN | UNKNOWN | tests/providers/atlassian/jira/operators/test_jira.py | 1 | def test_operator_init_with_optional_args(self):
jira_operator = JiraOperator(task_id="jira_list_issue_types", jira_method="issue_types")
assert jira_operator.jira_method_args == {}
assert jira_operator.result_processor is None
assert jira_operator.get_jira_resource_method is None | CWE-703 | apache/airflow | ab8c9ec2545caefb232d8e979b18b4c8c8ad3563 | def test_operator_init_with_optional_args(self):
jira_operator = JiraOperator(task_id="jira_list_issue_types", jira_method="issue_types")
assert jira_operator.jira_method_args == {}
assert jira_operator.result_processor is None
assert jira_operator.get_jira_resource_method is None |
null | UNKNOWN | UNKNOWN | tests/test_basic.py | 1 | def test_response_type_errors():
app = flask.Flask(__name__)
app.testing = True
@app.route("/none")
def from_none():
pass
@app.route("/small_tuple")
def from_small_tuple():
return ("Hello",)
@app.route("/large_tuple")
def from_large_tuple():
return "Hello", 234... | CWE-703 | pallets/flask | 8bb71852849907d1b67ba7514cf1812348e11b44 | def test_response_type_errors():
app = flask.Flask(__name__)
app.testing = True
@app.route("/none")
def from_none():
pass
@app.route("/small_tuple")
def from_small_tuple():
return ("Hello",)
@app.route("/large_tuple")
def from_large_tuple():
return "Hello", 234... |
null | UNKNOWN | UNKNOWN | lib/core/dump.py | 1 | def dbTableValues(self, tableValues):
replication = None
rtable = None
dumpFP = None
appendToFile = False
warnFile = False
if tableValues is None:
return
db = tableValues["__infos__"]["db"]
if not db:
db = "All"
table = ta... | CWE-327 | sqlmapproject/sqlmap | 6aa4d9bdf1e71932ad0756ad1136aa93c73cd681 | def dbTableValues(self, tableValues):
replication = None
rtable = None
dumpFP = None
appendToFile = False
warnFile = False
if tableValues is None:
return
db = tableValues["__infos__"]["db"]
if not db:
db = "All"
table = ta... |
null | UNKNOWN | UNKNOWN | airflow-core/tests/unit/utils/test_log_handlers.py | 1 | def test_file_task_handler_when_ti_value_is_invalid(self, dag_maker):
def task_callable(ti):
ti.log.info("test")
with dag_maker("dag_for_testing_file_task_handler", schedule=None):
task = PythonOperator(
task_id="task_for_testing_file_log_handler",
... | CWE-703 | apache/airflow | 76e9e78dadd2f393bf32d292e434ec93f981be3d | def test_file_task_handler_when_ti_value_is_invalid(self, dag_maker):
def task_callable(ti):
ti.log.info("test")
with dag_maker("dag_for_testing_file_task_handler", schedule=None):
task = PythonOperator(
task_id="task_for_testing_file_log_handler",
... |
null | UNKNOWN | UNKNOWN | tests/tracking/test_tracking.py | 1 | def test_create_experiment():
with pytest.raises(TypeError):
tracking.create_experiment()
with pytest.raises(Exception):
tracking.create_experiment(None)
with pytest.raises(Exception):
tracking.create_experiment("")
with temp_directory() as tmp_dir, mock.patch("mlflow.tracking... | CWE-330, CWE-703 | mlflow/mlflow | a4787a3d0df9d1694993ac01d744650668d01140 | def test_create_experiment():
with pytest.raises(TypeError):
tracking.create_experiment()
with pytest.raises(Exception):
tracking.create_experiment(None)
with pytest.raises(Exception):
tracking.create_experiment("")
with temp_directory() as tmp_dir, mock.patch("mlflow.tracking... |
null | UNKNOWN | UNKNOWN | lib/utils/hash.py | 1 | def wordpress_passwd(password, salt, count, prefix, **kwargs):
"""
Reference(s):
https://web.archive.org/web/20120219120128/packetstormsecurity.org/files/74448/phpassbrute.py.txt
http://scriptserver.mainframe8.com/wordpress_password_hasher.php
>>> wordpress_passwd(password='testpass', salt=... | CWE-259 | sqlmapproject/sqlmap | 459130196a484222b731d2fb893cd442a3fa46f9 | def wordpress_passwd(password, salt, count, prefix, **kwargs):
"""
Reference(s):
http://packetstormsecurity.org/files/74448/phpassbrute.py.txt
http://scriptserver.mainframe8.com/wordpress_password_hasher.php
>>> wordpress_passwd(password='testpass', salt='aD9ZLmkp', count=2048, prefix='$P$9... |
null | UNKNOWN | UNKNOWN | salt/client/api.py | 1 | def create_token(self, creds):
'''
Create token with creds.
Token authorizes salt access if successful authentication
with the credentials in creds.
creds format is as follows:
{
'username': 'namestring',
'password': 'passwordstring',
... | CWE-259 | saltstack/salt | 3ad69c8fabe76e45426950c99b6e43b28340f2f9 | def create_token(self, creds):
'''
Create token with creds.
Token authorizes salt access if successful authentication
with the credentials in creds.
creds format is as follows:
{
'username': 'namestring',
'password': 'passwordstring',
... |
functions_for_airflow_with_cwe.csv | UNKNOWN | UNKNOWN | airflow/models/dag.py | 0 | def deactivate_deleted_dags(
cls,
alive_dag_filelocs: Container[str],
processor_subdir: str,
session: Session = NEW_SESSION,
) -> None:
"""
Set ``is_active=False`` on the DAGs for which the DAG files have been removed.
:param alive_dag_filelocs: file paths of... | CWE-Unknown | apache/airflow | f44a3246d127a1ad37b1c80035afe00db7785c8c | def deactivate_deleted_dags(
cls,
alive_dag_filelocs: Container[str],
session: Session = NEW_SESSION,
) -> None:
"""
Set ``is_active=False`` on the DAGs for which the DAG files have been removed.
:param alive_dag_filelocs: file paths of alive DAGs
:param sess... |
PyCode-Vul: A Benchmark Dataset for Code-Level Vulnerability Detection and Analysis
PyCode-Vul is a real-world Python vulnerability dataset accepted at IEEE BigData 2025. The dataset was created by mining security-related commits from widely used Python GitHub repositories, extracting changed files, identifying changed lines, recovering before/after code, validating Python functions through AST parsing, applying CWE mapping, and removing duplicate samples.
The dataset is designed for code-level vulnerability detection, vulnerability classification, and empirical evaluation of code pre-trained models.
Dataset Construction Pipeline
The following figure summarizes the PyCode-Vul dataset construction process, including repository mining, commit filtering, diff/hunk extraction, before/after code extraction, Python code filtering, AST validation, CWE mapping, Bandit-based heuristic analysis, duplication checking, and final dataset creation.
View Dataset Construction Pipeline Figure
Dataset Sources
PyCode-Vul was collected from 15 real-world Python repositories covering web frameworks, security tools, DevOps automation, machine learning lifecycle management, data workflow systems, networking libraries, and digital forensics tools.
| Repository | Samples | Purpose | Real-World Use |
|---|---|---|---|
| Sqlmap | 1000 | SQL injection testing tool | Widely used in penetration testing and security research |
| Django | 835 | Web framework | Used for scalable production web applications |
| Salt | 1006 | Automation and configuration management | Commonly used in DevOps and infrastructure automation |
| Airflow | 731 | Workflow orchestration | Used for data pipeline scheduling and management |
| Ansible | 727 | IT automation framework | Enables large-scale configuration and deployment management |
| Mlflow | 812 | ML lifecycle management | Used for experiment tracking and model deployment |
| W3af | 776 | Web application security scanner | Detects security vulnerabilities in web applications |
| Tornado | 423 | Web server and networking framework | Used in asynchronous and real-time web services |
| Jupyter | 369 | Interactive computing environment | Core platform for data science and AI research |
| Bandit | 310 | Security static analyzer | Identifies insecure coding practices in Python |
| Volatility | 241 | Memory forensics framework | Used in digital forensics and incident response |
| Flask | 141 | Lightweight web framework | Used for API and microservice development |
| Paramiko | 336 | SSH communication library | Used for secure remote automation and data transfer |
| Requests | 139 | HTTP networking library | Standard Python library for web communication |
| Yaml | 53 | YAML parsing and serialization | Used for configuration management and data exchange |
| Total | 7899 |
Dataset Files
The dataset is provided with train and test splits.
| File | Description |
|---|---|
train.csv |
Training split of the PyCode-Vul dataset |
test.csv |
Test split of the PyCode-Vul dataset |
Each sample may contain Python code, repository information, commit information, before/after function information, changed lines, hashes, and vulnerability-related labels or metadata.
Experimental Results
The paper evaluates several CodePTMs on PyCode-Vul and benchmark vulnerability datasets, including CVEFixes, VUDENC, Code_Vulnerability_Python, Buggy_Python, Py Data, PCV+Merge, and PyCode-Vul Test.
The models include CodeBERT, CodeGPT, CodeBERTa, DeBERTa-v3, CodeParrot, GraphCodeBERT, DistilBERT, UniXcoder, CodeGen-Mono, and CodeT5+.
The following table reports the full performance assessment from the paper.
Table IV. Performance Assessment of Fine-Tuned CodePTMs on the PyCode_Vul Dataset
Notes
- Δ represents the aggregated test datasets: CVEFixes, VUDENC, Code_Vulnerability_Python, Buggy_Python, Py Data, and PyCode_Vul Test.
- ★ denotes results evaluated on the PyCode_Vul testing set.
- * indicates the best performance.
- Values without the asterisk represent the second-best result.
CVEFixes
| Model | Acc. | Pre. | Rec. | Spe. | F1. | MCC | Kappa. | MSE | MAE | AUC. |
|---|---|---|---|---|---|---|---|---|---|---|
| CodeBERT | 0.5391 | 0.6626 | 0.1594 | 0.9188 | 0.2570 | 0.1202 | 0.0782 | 0.4608 | 0.4608 | 0.6393 |
| CodeGPT | 0.5391 | 0.8648 | 0.0927 | 0.9855 | 0.1675 | 0.1737 | 0.0782 | 0.4608 | 0.4608 | 0.6663 |
| CodeBERTa | 0.5304 | 0.7333 | 0.0950 | 0.9652 | 0.1692 | 0.1232 | 0.0608 | 0.4695 | 0.4695 | 0.6335 |
| DeBERTa-v3 | 0.5492 | 0.7931 | 0.1333 | 0.9652 | 0.2282 | 0.1775 | 0.0985 | 0.4507 | 0.4507 | 0.6780 |
| CodeParrot | 0.5565 | 0.7600 | 0.1652 | 0.9478 | 0.2714 | 0.1815 | 0.1130 | 0.4434 | 0.4434 | 0.6581 |
| GraphCodeBERT | 0.5333 | 0.6533 | 0.1420 | 0.9246 | 0.2333 | 0.1070 | 0.0666 | 0.4666 | 0.4666 | 0.6559 |
| DistilBERT | 0.5478 | 0.6736 | 0.1855 | 0.9101 | 0.2909 | 0.1388 | 0.0956 | 0.4521 | 0.4521 | 0.6113 |
| UniXcoder | 0.5362 | 0.6506 | 0.1565 | 0.9159 | 0.2523 | 0.1113 | 0.0724 | 0.4637 | 0.4637 | 0.6222 |
| CodeGen-Mono | 0.5347 | 0.7000 | 0.1217 | 0.9478 | 0.2074 | 0.1234 | 0.0695 | 0.4652 | 0.4652 | 0.6350 |
| CodeT5+ | 0.5318 | 0.6617 | 0.1304 | 0.9333 | 0.2179 | 0.1069 | 0.0637 | 0.4681 | 0.4681 | 0.6329 |
VUDENC
| Model | Acc. | Pre. | Rec. | Spe. | F1. | MCC | Kappa. | MSE | MAE | AUC. |
|---|---|---|---|---|---|---|---|---|---|---|
| CodeBERT | 0.5811 | 0.7433 | 0.2477 | 0.9144 | 0.3711 | 0.2176 | 0.1622 | 0.4188 | 0.4188 | 0.7085 |
| CodeGPT | 0.5793 | 0.8617 | 0.1889 | 0.9609 | 0.3099 | 0.2538 | 0.1586 | 0.4206 | 0.4206 | 0.6714 |
| CodeBERTa | 0.6247 | 0.8333 | 0.3119 | 0.9376 | 0.4530 | 0.3199 | 0.2495 | 0.3752 | 0.3752 | 0.7700 |
| DeBERTa-v3 | 0.5962 | 0.8139 | 0.2495 | 0.9429 | 0.3819 | 0.2671 | 0.1925 | 0.4037 | 0.4037 | 0.7530 |
| CodeParrot | 0.6310 | 0.8295 | 0.3207 | 0.9322 | 0.4719 | 0.3283 | 0.2620 | 0.3689 | 0.3689 | 0.7299 |
| GraphCodeBERT | 0.6096 | 0.8090 | 0.2869 | 0.9322 | 0.4236 | 0.2869 | 0.2192 | 0.3903 | 0.3903 | 0.7184 |
| DistilBERT | 0.5333 | 0.5714 | 0.2666 | 0.8000 | 0.3636 | 0.0788 | 0.0666 | 0.4666 | 0.4666 | 0.5866 |
| UniXcoder | 0.5784 | 0.7933 | 0.2121 | 0.9447 | 0.3347 | 0.2304 | 0.1568 | 0.4215 | 0.4215 | 0.6894 |
| CodeGen-Mono | 0.5333 | 0.6000 | 0.2000 | 0.8666 | 0.3000 | 0.0894 | 0.0666 | 0.4666 | 0.4666 | 0.4577 |
| CodeT5+ | 0.5819 | 0.7911 | 0.2228 | 0.9411 | 0.3477 | 0.2357 | 0.1639 | 0.4180 | 0.4180 | 0.6721 |
Code_vulnerability_python
| Model | Acc. | Pre. | Rec. | Spe. | F1. | MCC | Kappa. | MSE | MAE | AUC. |
|---|---|---|---|---|---|---|---|---|---|---|
| CodeBERT | 0.4787 | 0.4838 | 0.6367 | 0.3207 | 0.5498 | -0.0447 | -0.0424 | 0.5212 | 0.5212 | 0.5337 |
| CodeGPT | 0.5247 | 0.5221 | 0.5825 | 0.4669 | 0.5507 | 0.0498 | 0.0495 | 0.4752 | 0.4752 | 0.4575 |
| CodeBERTa | 0.5259 | 0.5205 | 0.6556 | 0.3962 | 0.5803 | 0.0518 | 0.0518 | 0.4740 | 0.4740 | 0.5387 |
| DeBERTa-v3 | 0.5283 | 0.5235 | 0.6297 | 0.4268 | 0.5717 | 0.0578 | 0.0566 | 0.4716 | 0.4716 | 0.5295 |
| CodeParrot | 0.5141 | 0.5090 | 0.7971 | 0.2311 | 0.6213 | 0.0343 | 0.0283 | 0.4858 | 0.4858 | 0.5011 |
| GraphCodeBERT | 0.5129 | 0.5088 | 0.7476 | 0.2783 | 0.6055 | 0.0293 | 0.0259 | 0.4870 | 0.4870 | 0.5726 |
| DistilBERT | 0.5341 | 0.5324 | 0.5613 | 0.5070 | 0.5464 | 0.0684 | 0.0683 | 0.4658 | 0.4658 | 0.5230 |
| UniXcoder | 0.5424 | 0.5302 | 0.7452 | 0.3396 | 0.6196 | 0.0928 | 0.0400 | 0.4575 | 0.4575 | 0.5872 |
| CodeGen-Mono | 0.4492 | 0.4188 | 0.2617 | 0.6367 | 0.3222 | -0.1093 | -0.1014 | 0.5507 | 0.5507 | 0.4394 |
| CodeT5+ | 0.5165 | 0.5128 | 0.6603 | 0.3726 | 0.5773 | 0.0344 | 0.0330 | 0.4834 | 0.4834 | 0.5561 |
Train Dataset: PyCode_Vul | Test Dataset: Buggy_python
| Model | Acc. | Pre. | Rec. | Spe. | F1. | MCC | Kappa. | MSE | MAE | AUC. |
|---|---|---|---|---|---|---|---|---|---|---|
| CodeBERT | 0.5173 | 0.6394 | 0.0769 | 0.9550 | 0.1417 | 0.0718 | 0.0347 | 0.4826 | 0.4826 | 0.4819 |
| CodeGPT | 0.5179 | 0.6376 | 0.0832 | 0.9526 | 0.1473 | 0.0727 | 0.0359 | 0.4820 | 0.4820 | 0.4865 |
| CodeBERTa | 0.5176 | 0.6439 | 0.0790 | 0.9562 | 0.1408 | 0.0736 | 0.0353 | 0.4823 | 0.4823 | 0.5243 |
| DeBERTa-v3 | 0.5173 | 0.6435 | 0.0778 | 0.9568 | 0.1389 | 0.0728 | 0.0347 | 0.4826 | 0.4826 | 0.4907 |
| CodeParrot | 0.5158 | 0.6280 | 0.0778 | 0.9538 | 0.1385 | 0.0658 | 0.0317 | 0.4841 | 0.4841 | 0.5629 |
| GraphCodeBERT | 0.5161 | 0.5363 | 0.0754 | 0.9568 | 0.1349 | 0.0684 | 0.0323 | 0.4838 | 0.4838 | 0.4336 |
| DistilBERT | 0.5173 | 0.6394 | 0.0763 | 0.9550 | 0.1417 | 0.0718 | 0.0347 | 0.4826 | 0.4826 | 0.5121 |
| UniXcoder | 0.5158 | 0.6345 | 0.0748 | 0.9568 | 0.1330 | 0.0673 | 0.0317 | 0.4841 | 0.4841 | 0.4242 |
| CodeGen-Mono | 0.5131 | 0.5814 | 0.0940 | 0.9322 | 0.1619 | 0.0483 | 0.0263 | 0.4868 | 0.4868 | 0.6046 |
| CodeT5+ | 0.5173 | 0.6380 | 0.0802 | 0.9544 | 0.1426 | 0.0711 | 0.0347 | 0.4826 | 0.4826 | 0.5347 |
Train Dataset: PyCode_Vul | Test Dataset: Py Data
| Model | Acc. | Pre. | Rec. | Spe. | F1. | MCC | Kappa. | MSE | MAE | AUC. |
|---|---|---|---|---|---|---|---|---|---|---|
| CodeBERT | 0.5666 | 0.6666 | 0.2666 | 0.8666 | 0.3809 | 0.1666 | 0.1333 | 0.4333 | 0.4333 | 0.5955 |
| CodeGPT | 0.5333 | 0.5714 | 0.2666 | 0.8000 | 0.3636 | 0.0788 | 0.0666 | 0.4666 | 0.4666 | 0.5444 |
| CodeBERTa | 0.5666 | 0.6666 | 0.2666 | 0.8666 | 0.3809 | 0.1666 | 0.1333 | 0.4333 | 0.4333 | 0.6266 |
| DeBERTa-v3 | 0.5666 | 0.6666 | 0.2666 | 0.8666 | 0.3809 | 0.1666 | 0.1333 | 0.4333 | 0.4333 | 0.6000 |
| CodeParrot | 0.5666 | 0.6000 | 0.4000 | 0.7333 | 0.4800 | 0.1414 | 0.1313 | 0.4333 | 0.4333 | 0.4977 |
| GraphCodeBERT | 0.5666 | 0.6666 | 0.2666 | 0.8666 | 0.3809 | 0.1666 | 0.1333 | 0.4333 | 0.4333 | 0.5111 |
| DistilBERT | 0.5333 | 0.5714 | 0.2666 | 0.8000 | 0.3636 | 0.0788 | 0.0666 | 0.4666 | 0.4666 | 0.5866 |
| UniXcoder | 0.6000 | 0.7142 | 0.3333 | 0.8666 | 0.4450 | 0.2364 | 0.1999 | 0.4000 | 0.4000 | 0.6133 |
| CodeGen-Mono | 0.5333 | 0.6000 | 0.2000 | 0.8666 | 0.3000 | 0.0894 | 0.0666 | 0.4666 | 0.4666 | 0.4577 |
| CodeT5+ | 0.5666 | 0.6666 | 0.2666 | 0.8666 | 0.3809 | 0.1666 | 0.1333 | 0.4333 | 0.4333 | 0.5688 |
PCV+MergeΔ
| Model | Acc. | Pre. | Rec. | Spe. | F1. | MCC | Kappa. | MSE | MAE | AUC. |
|---|---|---|---|---|---|---|---|---|---|---|
| CodeBERT | 0.7858 | 0.9461 | 0.6244 | 0.9613 | 0.7523 | 0.6161 | 0.5772 | 0.2141 | 0.2141 | 0.7872 |
| CodeGPT | 0.7870 | 0.9650 | 0.6133 | 0.9758 | 0.7500 | 0.6254 | 0.5799 | 0.2129 | 0.2129 | 0.8801 |
| CodeBERTa | 0.7962 | 0.9670 | 0.6303 | 0.9766 | 0.7632 | 0.6403 | 0.5979 | 0.2037 | 0.2037 | 0.8372 |
| DeBERTa-v3 | 0.7901 | 0.9613 | 0.6222 | 0.9726 | 0.7553 | 0.6285 | 0.5858 | 0.2098 | 0.2098 | 0.7835 |
| CodeParrot | 0.7959 | 0.9525 | 0.6400 | 0.9653 | 0.7656 | 0.6340 | 0.5968 | 0.2040 | 0.2040 | 0.8671 |
| GraphCodeBERT | 0.7951 | 0.9140 | 0.6392 | 0.9645 | 0.7647 | 0.6324 | 0.5953 | 0.2048 | 0.2048 | 0.8038 |
| DistilBERT | 0.7974 | 0.9598 | 0.6377 | 0.9710 | 0.7663 | 0.6393 | 0.6000 | 0.2025 | 0.2025 | 0.8512 |
| UniXcoder | 0.7935 | 0.9594 | 0.6303 | 0.9710 | 0.7608 | 0.6332 | 0.5925 | 0.2064 | 0.2034 | 0.7711 |
| CodeGen-Mono | 0.7677 | 0.9348 | 0.5955 | 0.9549 | 0.7276 | 0.5840 | 0.5416 | 0.2322 | 0.2322 | 0.8019 |
| CodeT5+ | 0.7889 | 0.9588 | 0.6214 | 0.9710 | 0.7541 | 0.6259 | 0.5835 | 0.2110 | 0.2110 | 0.8329 |
PyCode_Vul Test★
| Model | Acc. | Pre. | Rec. | Spe. | F1. | MCC | Kappa. | MSE | MAE | AUC. |
|---|---|---|---|---|---|---|---|---|---|---|
| CodeBERT | 0.9614 | 0.9572 | 0.9556 | 0.9659 | 0.9564 | 0.9217 | 0.9217 | 0.0385 | 0.0385 | 0.9608 |
| CodeGPT | 0.9621 | 0.9501 | 0.9651 | 0.9596 | 0.9576 | 0.9234 | 0.9233 | 0.0378 | 0.0378 | 0.9836 |
| CodeBERTa | 0.9775 | 0.9716 | 0.9778 | 0.9773 | 0.9747 | 0.9545 | 0.9545 | 0.0224 | 0.0224 | 0.9954* |
| DeBERTa-v3 | 0.9761 | 0.9776 | 0.9683 | 0.9823* | 0.9729 | 0.9516 | 0.9516 | 0.0238 | 0.0238 | 0.9941 |
| CodeParrot | 0.9515 | 0.9350 | 0.9572 | 0.9470 | 0.9460 | 0.9023 | 0.8984 | 0.0484 | 0.0484 | 0.9804 |
| GraphCodeBERT | 0.9621 | 0.9529 | 0.9620 | 0.9621 | 0.9574 | 0.9233 | 0.9233 | 0.0370 | 0.0370 | 0.9621 |
| DistilBERT | 0.9677 | 0.9665 | 0.9604 | 0.9735 | 0.9634 | 0.9345 | 0.9345 | 0.0322 | 0.0322 | 0.9669 |
| UniXcoder | 0.9810* | 0.9778* | 0.9794* | 0.9823* | 0.9786* | 0.9616* | 0.9616 | 0.0189* | 0.0189* | 0.9808 |
| CodeGen-Mono | 0.9038 | 0.9024 | 0.8781 | 0.9243 | 0.8901 | 0.8022 | 0.8046 | 0.0961 | 0.0961 | 0.9012 |
| CodeT5+ | 0.9754 | 0.9686 | 0.9762 | 0.9747 | 0.9724 | 0.9503 | 0.9502 | 0.0245 | 0.0245 | 0.9755 |
Key Result Summary
On the PyCode-Vul Test set, the evaluated models achieved strong performance. UniXcoder obtained the best reported performance across several metrics, including accuracy, precision, recall, specificity, F1, MCC, Kappa, MSE, and MAE. CodeBERTa achieved the highest AUC score in the reported table.
Related Links
- Hugging Face: https://huggingface.co/datasets/S-AIR-L/PyCode-Vul
- Zenodo DOI/Archive: https://zenodo.org/records/19746552
- GitHub: https://github.com/S-AiRLab/-PyCode_Vul-A-Benchmark-Dataset-for-Code-Level-Vulnerability-Detection-and-Analysis/tree/main
- Kaggle: https://www.kaggle.com/datasets/oulabspring/pycode-vul-a-benchmark-dataset-for-python/data
Citation
If you use PyCode-Vul in your research, please cite the following paper:
A Benchmark Dataset for Code-Level Vulnerability Detection and Analysis
Tasmin Karim, Mst Shapna Akter, and Alfredo Cuzzocrea.
In 2025 IEEE International Conference on Big Data (BigData), pp. 4237–4246, IEEE, 2025.
@inproceedings{karim2025benchmark,
title={A Benchmark Dataset for Code-Level Vulnerability Detection and Analysis},
author={Karim, Tasmin and Akter, Mst Shapna and Cuzzocrea, Alfredo},
booktitle={2025 IEEE International Conference on Big Data (BigData)},
pages={4237--4246},
year={2025},
organization={IEEE}
}
- Downloads last month
- 40