The dataset viewer is not available for this dataset.
Error code: ConfigNamesError
Exception: TypeError
Message: 'str' object is not a mapping
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/dataset/config_names.py", line 66, in compute_config_names_response
config_names = get_dataset_config_names(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/inspect.py", line 165, in get_dataset_config_names
dataset_module = dataset_module_factory(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/load.py", line 1663, in dataset_module_factory
raise e1 from None
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/load.py", line 1620, in dataset_module_factory
return HubDatasetModuleFactoryWithoutScript(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/load.py", line 991, in get_module
dataset_infos = DatasetInfosDict.from_dataset_card_data(dataset_card_data)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/info.py", line 386, in from_dataset_card_data
dataset_info = DatasetInfo._from_yaml_dict(dataset_card_data["dataset_info"])
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/info.py", line 317, in _from_yaml_dict
yaml_data["features"] = Features._from_yaml_list(yaml_data["features"])
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 2027, in _from_yaml_list
return cls.from_dict(from_yaml_inner(yaml_data))
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 2023, in from_yaml_inner
return {name: from_yaml_inner(_feature) for name, _feature in zip(names, obj)}
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 2023, in <dictcomp>
return {name: from_yaml_inner(_feature) for name, _feature in zip(names, obj)}
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 2020, in from_yaml_inner
return {"_type": snakecase_to_camelcase(_type), **unsimplify(obj)[_type]}
TypeError: 'str' object is not a mappingNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
DiverseVul Dataset Card
Dataset Description
DiverseVul is a comprehensive and meticulously curated dataset of vulnerable and non-vulnerable C/C++ source code, designed to advance deep learning-based vulnerability detection research. Originally introduced by Yizheng Chen, Zhoujie Ding, Lamya Alowain, Xinyun Chen, and David Wagner in their seminal paper, this dataset has been expanded and uploaded to Hugging Face to facilitate broader access and application. It captures real-world software vulnerabilities extracted from vulnerability-fixing commits across a diverse array of open-source projects, making it an invaluable resource for researchers, developers, and security professionals.
Dataset Summary
The version of DiverseVul hosted on Hugging Face represents an enhanced and more complete iteration of the dataset described in the original paper. It contains 523,956 rows of function-level source code samples, split into three predefined sections:
- Training Set: 419,404 rows
- Validation Set: 52,337 rows
- Test Set: 52,215 rows
These samples are derived from 933 unique projects and cover 155 Common Weakness Enumerations (CWEs), including:
- Number of target0 in training split: 386305
- Number of target1 in training split: 33099
- Number of target0 in test_data split: 48072
- Number of target1 in test_data split: 4143
- Number of target0 in val_data split: 48202
- Number of target1 in val_data split: 4135
Citation
This dataset was created by Yizheng Chen, Zhoujie Ding, Lamya Alowain, Xinyun Chen, and David Wagner. If you use DiverseVul in your work, please cite the original paper:
- Homepage: https://github.com/wagner-group/diversevul
- Repository: https://github.com/wagner-group/diversevul
- Paper: DiverseVul: A New Vulnerable Source Code Dataset for Deep Learning Based Vulnerability Detection
- Point of Contact: Yizheng Chen ([email protected]), Zhoujie Ding ([email protected])
@article{chen2023diversevul,
title={DiverseVul: A New Vulnerable Source Code Dataset for Deep Learning Based Vulnerability Detection},
author={Chen, Yizheng and Ding, Zhoujie and Alowain, Lamya and Chen, Xinyun and Wagner, David},
journal={arXiv preprint arXiv:2304.00409v2},
year={2023}
}
Note: The version uploaded to Hugging Face is an expanded dataset built upon the original work available at https://github.com/wagner-group/diversevul, with all credit attributed to the original authors.
Dataset Structure
Data Instances
Each row in DiverseVul represents a single C/C++ function extracted from a project, labeled as vulnerable (target: 1) or non-vulnerable (target: 0). The dataset is structured with the following columns:
project: The name of the open-source project from which the function originates (e.g., "debian", "bluez", "Chrome").commit_id: The unique identifier of the commit associated with the function. For non-vulnerable functions or cases where commit information is unavailable, this may beNone.target: Binary label indicating vulnerability status (0 = non-vulnerable, 1 = vulnerable).func: The full source code of the function as a string, preserving its original syntax and formatting.idx: A unique index assigned to the sample within the dataset.
Example Instances
Training Set (Index 0):
{ "project": "debian", "commit_id": null, "target": 0, "func": "static guint16 de_ciph_key_seq_num ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) {\n guint32 curr_offset , bit_offset ;\n curr_offset = offset ;\n if ( RIGHT_NIBBLE == len ) bit_offset = 4 ;\n else bit_offset = 0 ;\n proto_tree_add_bits_item ( tree , hf_gsm_a_spare_bits , tvb , ( curr_offset << 3 ) + bit_offset , 1 , ENC_BIG_ENDIAN ) ;\n proto_tree_add_bits_item ( tree , hf_gsm_a_key_seq , tvb , ( curr_offset << 3 ) + bit_offset + 1 , 3 , ENC_BIG_ENDIAN ) ;\n curr_offset ++ ;\n return ( curr_offset - offset ) ;\n }", "idx": 17792 }Description: A non-vulnerable function from the "debian" project, handling bit-level operations for GSM protocol parsing.
Test Set (Index 0):
{ "project": "bluez", "commit_id": "1cd644db8c23a2f530ddb93cebed7dacc5f5721a", "target": 1, "func": "bool bt_att_cancel(struct bt_att *att, unsigned int id)\n{\n\tconst struct queue_entry *entry;\n\tstruct att_send_op *op;\n\n\tif (!att || !id)\n\t\treturn false;\n\n\t/* Lookuo request on each channel first */\n\tfor (entry = queue_get_entries(att->chans); entry;\n\t\t\t\t\t\tentry = entry->next) {\n\t\tstruct bt_att_chan *chan = entry->data;\n\n\t\tif (bt_att_chan_cancel(chan, id))\n\t\t\treturn true;\n\t}\n\n\top = queue_remove_if(att->req_queue, match_op_id, UINT_TO_PTR(id));\n\tif (op)\n\t\tgoto done;\n\n\top = queue_remove_if(att->ind_queue, match_op_id, UINT_TO_PTR(id));\n\tif (op)\n\t\tgoto done;\n\n\top = queue_remove_if(att->write_queue, match_op_id, UINT_TO_PTR(id));\n\tif (op)\n\t\tgoto done;\n\n\tif (!op)\n\t\treturn false;\n\ndone:\n\tdestroy_att_send_op(op);\n\n\twakeup_writer(att);\n\n\treturn true;\n}", "idx": 7502 }Description: A vulnerable function from the "bluez" project, tied to a specific commit, managing Bluetooth ATT protocol operations.
Validation Set (Index 0):
{ "project": "Chrome", "commit_id": "d007b8b750851fe1b375c463009ea3b24e5c021d", "target": 1, "func": " IndexedDBCursor::~IndexedDBCursor() {\n Close();\n }\n", "idx": 10542 }Description: A concise, vulnerable destructor from the "Chrome" project, linked to a commit fixing an IndexedDB-related vulnerability.
Data Fields
project(string): Identifies the source project, reflecting the dataset’s diversity across 933 projects, including well-known ones like "linux," "Chrome," "debian," and "bluez."commit_id(string or null): Ties the function to a specific vulnerability-fixing commit, providing traceability where available.target(integer): Labels the function’s vulnerability status, enabling binary classification tasks.func(string): Contains the raw C/C++ code, offering rich context for code analysis and model training.idx(integer): A unique identifier for tracking and referencing individual samples.
Source Data
DiverseVul was constructed by crawling security issue websites to identify vulnerability-fixing commits from 933 open-source C/C++ projects. The authors cloned these projects, extracted relevant commits, and parsed C/C++ files to label functions as vulnerable (changed in the commit) or non-vulnerable (unchanged or post-fix). The process involved deduplication using MD5 hashes and mapping vulnerabilities to 155 CWEs via the National Vulnerability Database (NVD) API and manual annotation.
Annotation Process
- Vulnerable Functions: Functions modified in vulnerability-fixing commits are labeled
target: 1. Manual analysis of 50 samples fromDiverseVulshowed a 60% label accuracy, with errors due to multi-function vulnerabilities or irrelevant changes. - Non-Vulnerable Functions: Unchanged functions or post-fix versions are labeled
target: 0. - CWE Coverage: Approximately 85% of vulnerable functions are mapped to 155 CWE categories, enhancing the dataset’s utility for specific vulnerability type studies.
Projects Covered
The dataset spans a wide range of projects, including but not limited to: - leptonica, mongo, drogon, libuv, ark, exiv2, Bento4, perl5, e2guardian, libheif - pigz, Little-CMS, polarssl, godot, openafs, arangodb, infradead, android_security - qtbase, git, uftpd, linux-uek, xrootd, runc, dosfstools, openmpt, webserver - yast-core, jhead, cJSON, vim, openfortivpn, libgit2, abrt, c-blosc2, libfep - And many more
Uses
What Kind of Projects This Dataset Is Good For
DiverseVul is ideal for:
- Vulnerability Detection Research: Training and evaluating deep learning models (e.g., LLMs, GNNs) to identify C/C++ vulnerabilities.
- Software Security Tools: Developing or enhancing static analysis tools and code auditing systems.
- Educational Purposes: Teaching students about software vulnerabilities, CWEs, and secure coding practices.
- Generalization Studies: Investigating model performance on unseen projects, a critical challenge in real-world deployment.
- CWE-Specific Analysis: Studying patterns in specific vulnerability types due to its broad CWE coverage.
How People Can Use the Dataset
- Machine Learning Training: Use the train/validation/test splits to fine-tune models like CodeT5, NatGen, or custom architectures for binary classification (vulnerable vs. non-vulnerable).
- Example: Fine-tune a transformer model on the
funccolumn withtargetas the label.
- Example: Fine-tune a transformer model on the
- Code Analysis: Analyze the
funcfield to extract features (e.g., ASTs, CFGs) for traditional or hybrid vulnerability detection methods. - Project Benchmarking: Evaluate model generalization by training on a subset of projects and testing on others, leveraging the
projectfield. - CWE Research: Filter samples by CWE (via external mapping) to study specific vulnerability types or improve detection for hard-to-learn CWEs.
- Data Augmentation: Combine with other datasets (e.g., CVEFixes, BigVul) to increase training volume and diversity.
Limitations
- Label Noise: Automated labeling from commits introduces errors (e.g., irrelevant changes mislabeled as vulnerable), potentially affecting model performance.
- C/C++ Focus: Limited to C/C++ code, not applicable to other languages without adaptation.
- Pretraining Contamination Risk: Some LLMs may have seen code from these projects during pretraining, though this is unlikely to include vulnerability annotations.
- Whitespace Duplication: Lack of whitespace normalization during deduplication may retain redundant samples.
- Downloads last month
- 54