|
|
--- |
|
|
|
|
|
language: |
|
|
- en |
|
|
tags: |
|
|
- vulnerability-detection |
|
|
- cve |
|
|
- code-changes |
|
|
- software-security |
|
|
license: mit |
|
|
dataset_info: |
|
|
features: |
|
|
- name: CVE_ID |
|
|
dtype: string |
|
|
- name: CWE_ID |
|
|
dtype: string |
|
|
- name: Score |
|
|
dtype: float |
|
|
- name: Summary |
|
|
dtype: string |
|
|
- name: commit_id |
|
|
dtype: string |
|
|
- name: codeLink |
|
|
dtype: string |
|
|
- name: file_name |
|
|
dtype: string |
|
|
- name: func_after |
|
|
dtype: string |
|
|
- name: lines_after |
|
|
dtype: string |
|
|
dataset_size: 10GB |
|
|
--- |
|
|
|
|
|
# MSR Data Cleaned - C/C++ Code Vulnerability Dataset |
|
|
|
|
|
[](LICENSE) |
|
|
|
|
|
|
|
|
|
|
|
## π Dataset Description |
|
|
A curated collection of C/C++ code vulnerabilities paired with: |
|
|
- CVE details (scores, classifications, exploit status) |
|
|
- Code changes (commit messages, added/deleted lines) |
|
|
- File-level and function-level diffs |
|
|
|
|
|
## π Sample Data Structure |
|
|
```python |
|
|
+---------------+-----------------+----------------------+---------------------------+ |
|
|
| CVE ID | Attack Origin | Publish Date | Summary | |
|
|
+===============+=================+======================+===========================+ |
|
|
| CVE-2015-8467 | Remote | 2015-12-29 | "The samldb_check_user..."| |
|
|
+---------------+-----------------+----------------------+---------------------------+ |
|
|
| CVE-2016-1234 | Local | 2016-01-15 | "Buffer overflow in..." | |
|
|
+---------------+-----------------+----------------------+---------------------------+ |
|
|
``` |
|
|
|
|
|
## π οΈ Usage Instructions |
|
|
|
|
|
### 1. Accessing in Colab |
|
|
```python |
|
|
!pip install huggingface_hub -q |
|
|
from huggingface_hub import snapshot_download |
|
|
|
|
|
repo_id = "starsofchance/MSR_data_cleaned" |
|
|
dataset_path = snapshot_download(repo_id=repo_id, repo_type="dataset") |
|
|
``` |
|
|
|
|
|
### 2. Extracting the Dataset |
|
|
```python |
|
|
!apt-get install unzip -qq |
|
|
!unzip "/root/.cache/huggingface/.../MSR_data_cleaned.zip" -d "/content/extracted_data" |
|
|
``` |
|
|
**Note:** Extracted size is **10GB** (1.5GB compressed). |
|
|
|
|
|
### 3. Creating Splits (Colab Pro Recommended) |
|
|
We used this memory-efficient approach: |
|
|
```python |
|
|
from datasets import load_dataset |
|
|
dataset = load_dataset("csv", data_files="MSR_data_cleaned.csv", streaming=True) |
|
|
|
|
|
# Randomly distribute rows (80-10-10) |
|
|
for row in dataset: |
|
|
rand = random.random() |
|
|
if rand < 0.8: write_to(train.csv) |
|
|
elif rand < 0.9: write_to(validation.csv) |
|
|
else: write_to(test.csv) |
|
|
``` |
|
|
**Hardware Requirements:** |
|
|
- Minimum 25GB RAM |
|
|
- Strong CPU (Colab Pro T4 GPU recommended) |
|
|
|
|
|
## π Citation |
|
|
```bibtex |
|
|
@inproceedings{fan2020ccode, |
|
|
title={A C/C++ Code Vulnerability Dataset with Code Changes and CVE Summaries}, |
|
|
author={Fan, Jiahao and Li, Yi and Wang, Shaohua and Nguyen, Tien N}, |
|
|
booktitle={MSR '20: 17th International Conference on Mining Software Repositories}, |
|
|
pages={1--5}, |
|
|
year={2020}, |
|
|
doi={10.1145/3379597.3387501} |
|
|
} |
|
|
``` |
|
|
|
|
|
## π Dataset Creation |
|
|
- **Source**: Original data from [MSR 2020 Paper](https://doi.org/10.1145/3379597.3387501) |
|
|
- **Processing**: |
|
|
- Cleaned and standardized CSV format |
|
|
- Stream-based splitting to handle large size |
|
|
- Preserved all original metadata |
|
|
|
|
|
|